-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Naming.AvoidRedundancyInTypeNameRule(git)
Assembly: Gendarme.Rules.Naming
Version: git
This rule will fire if a type is prefixed with the last component of its namespace. Using prefixes like this makes type names more verbose than they need to be and makes them harder to use with tools like auto-complete. Note that an exception is made if removal of the prefix would cause an ambiguity with another type. If this is the case the rule will not report a defect.
Bad example:
namespace Foo.Lang.Compiler {
public class CompilerContext {
}
}
using Foo.Lang;
...
Compiler.CompilerContext context = new Compiler.CompilerContext ();
using Foo.Lang.Compiler;
...
CompilerContext context = new CompilerContext ();
Good example:
namespace Foo.Lang.Compiler {
public class Context {
}
}
using Foo.Lang;
...
Compiler.Context context = new Compiler.Context ();
using Foo.Lang.Compiler;
...
Context context = new Context ();
Another good example (more meaningful term in the context of the namespace):
namespace Foo.Lang.Compiler {
public class CompilationContext {
}
}
You can browse the latest source code of this rule on github.com
Note that this page was autogenerated (3/17/2011 1:55:44 PM) based on the xmldoc
comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!