NDepend customizing rule: Declare types in namespaces

NDepend is a tool that offers a wide range of features to let developers analyze a .NET code base. It comes with about 200 built in rules. But there are a few default rules that do not fit “my rules”. This blog post shows how to customize one and even more important why.

Avoid namespaces with few types

In general types should be placed in namespaces. But compiler generated types (caused by linq queries) are sometimes not.


Here is my fixed rule to skip the compiler generated types:

warnif count > 0 from t in
 Application.Namespaces.Where(n=>n.Name == "").
  SelectMany(n=>n.ChildTypes) where !t.IsGeneratedByCompiler
select new { t, }
Comments are closed