realvizu/NsDepCop

[Q] Are transient dependencies supported?

Closed this issue · 1 comments

o7g8 commented

Hello,

Is it possible to capture transient dependencies on type level?
Let's say we have a dependency chain A->B->C:

namespace A {
 class ClassA {
    public B.ClassB B = new B.ClassB();
 }
}

namespace B {
 class ClassB {
    public C.ClassC C = new C.ClassC();
 }
}

namespace C {
 class ClassC {
    public int i = 0;
 }
}

I would like to implement a rule disallowing A->..->C.
I couldn't make it work with current NsDepCop.
Is it possible?

I need to convert big code base to .NET Standard and some of lower layers of the code-base have .NET Standard-incompatible references: to System.Forms, etc. I need to know which upper level code transitively depends on the incompatible stuff (and which doesn't). Is it possible to find out with the help of NsDepCop?

I see my question is related to #35

Sorry, but transitive dependency checking is not supported.
It's possible that it will be added later, but not in the short term.

You should check out other tools, eg. NDepend supports transitive type dependency quieries AFAIK.