Attribute class name should be suffixed with 'Attribute'

Rule ND2005 Naming Conventions

Warns about attribute classes not suffixed with Attribute, a common .NET practice.

How to fix

Suffix the names of matched attribute classes with Attribute.

CQLinq source

This rule is written in CQLinq, C# LINQ over the NDepend code model. It ships with every new NDepend project: you can read it, adapt it, or use it as a starting point for your own custom rules.

// <Name>Attribute class name should be suffixed with 'Attribute'</Name>
// <Id>ND2005:AttributeClassNameShouldBeSuffixedWithAttribute</Id>

warnif count > 0 from t in Application.Types where 
   t.IsAttributeClass && 
   // We use SimpleName, because in case of generic Attribute type
   // SimpleName suppresses the generic suffix (like <T>).
  !t.SimpleNameLike(@"Attribute$") &&
  !t.SimpleNameLike(@"AttributeBase$") // Allow the second suffix Base
                                       // for base attribute classes.!t.SimpleName.EndsWith(@"Attribute")
select new {
   t,
   Debt = 5.ToMinutes().ToDebt(),
   Severity = Severity.High
}

//<Expl>
// The *attribute {0}'s name* should be suffixed with *Attribute*.
//</Expl>

//<Desc>
// Warns about *attribute classes* not suffixed with **Attribute**, a common
// .NET practice.
//</Desc>

//<HowToFix>
// Suffix the names of matched attribute classes with **Attribute**.
//</HowToFix>

Naming Conventions: all 23 items