-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependency by inheritance is permitted #35
Comments
I'm not sure if I understand the situation. There's no special treatment for inheritance chains in the tool.
If you haven't allowed these dependencies then there's something wrong. Can you send me your config.nsdepcop file so I can take a look? |
Hi @realvizu yes, in the example I did some namespace wrong. I' ve edited and fixed it and what I meant is exactly your guess. What I'm trying to do is to make Is there any plan to support this scenario? |
So you're suggesting that the dependency analyzer should track down transitive (indirect) dependencies by checking base types recursively, right? Well, I haven't considered such feature so far. There are a number of questions that come to my mind. Can you help elaborating on them a bit?
|
I wouldn't call this kind of dependency a transitive dependency. I mean, if I have a class If instead I have a class |
Well, just to make sure I'm not mistaken, I've just tried the scenario that you have described: Don't get me wrong, I'm not trying to dismiss your feature idea but I'd like to understand well its value and whether it conceptually fits NsDepCop before putting effort into the implementation. |
Hi @realvizu
Maybe you just created the class, and not invoked any of the inherited methods? Anyway, take a look at my fork (74ec4c7) where I've created a sample for the feature request. Basically you can work around NsDepCop by creating a "proxy" class in an allowed namespace that just inherith from the forbidden class you want to use. |
Ok, I see your point. |
Let's say i want to separate data access logic from UI, and to enforce it i will create
MyApp.UI
andMyApp.Data
namespaces with the following rules:What I want to enforce is that using
System.Data
fromMyApp.UI
is not permitted, and this seems to work properly. However if I create a class like this:I am able to use it in
MyApp.UI
, and this will generate a dependency onSystem.Data
.Is this intentional?
The text was updated successfully, but these errors were encountered: