I write about design rules a lot, but I sometimes forget to: The rules should work in most cases, but sometimes need to be "violated".
Whereas in practice it should be more like: Yeah, I know that rule, but it makes more sense to follow that other rule here, because
.
To check if we didn't "violate" the dependency rule, we'd have to iterate over all the classes and look at two things: the namespace of the class and the namespaces of the classes and interfaces that are imported in this class.
In order to do that it should look at each class, figure out what type of class it is, and according to a certain rule set make a judgement.
We want to ensure that the core of our application contains pure functions only, and that it is surrounded by impure functions that facilitate the communication with external actors for us.