Skip to content

Gendarme.Rules.Design.AvoidSmallNamespaceRule(2.10)

Sebastien Pouliot edited this page Jan 22, 2011 · 2 revisions

AvoidSmallNamespaceRule

Assembly: Gendarme.Rules.Design
Version: 2.10

Description

This rule fires if a namespace contains less than five (by default) visible types. Note that this rule enumerates the types in all the assemblies being analyzed instead of simply considering each assembly in turn. The rule exempts:

  • specialized namespaces : e.g. *.Design, *.Interop and *.Permissions
  • internal namespaces : namespaces without any visible (outside the assemble) types
  • small assemblies : that contains a single namespace but less than the minimal number of types (e.g. addins)
  • assembly entry point : the namespace of the type being used in an assemble (EXE) entry-point

Examples

Bad example:

namespace MyStuff.Special {
    // single type inside a namespace
    public class Helper {
    }
}

Good example:

namespace MyStuff {
    public class Helper {
    }
    // ... many other types ...
}

Configuration

Some elements of this rule can be customized to better fit your needs.

Minimum

The minimum number of types which must exist within a namespace.

Clone this wiki locally