Copy/paste from the slack:
From a code perspective sanity check class often looks like:
Where inspect() run the sanity check and store problems.
message() return the state of the result of the inspection (OK,Warning,Error) and the “list” of problems and the states if it’s cleanable or not.
clean(): clean what is cleanable.
This kind of class can then be used in UI.
You can came deeper (per-problem cleaning, select problematic nodes, etc.) but it’s just to give an idea of what can be done.