Interface name should begin with a 'I'

Rule ND2002 Naming Conventions

.NET interface names are commonly prefixed with an upper case I; this widely accepted convention is recommended. COM interfaces typically don't follow it, so interfaces tagged ComVisibleAttribute are not matched.

How to fix

Prefix matched interfaces names with an upper I.

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>Interface name should begin with a 'I'</Name>
// <Id>ND2002:InterfaceNameShouldBeginWithAI</Id>

// Don't query all Application.Types because some interface generated might not start with an 'I' 
// like for example when adding a WSDL reference to a project.
warnif count > 0 from t in JustMyCode.Types where 
   t.IsInterface  &&
   // Don't apply this rule for COM interfaces.
  !t.HasAttribute("System.Runtime.InteropServices.ComVisibleAttribute".AllowNoMatch())

// Discard outer type(s) name prefix for nested types
let name = !t.IsNested  ? 
   t.Name : 
   t.Name.Substring(t.Name.LastIndexOf('+') + 1, t.Name.Length - t.Name.LastIndexOf('+') - 1) 

where name[0] != 'I'
select new {
   t,
   Debt = 5.ToMinutes().ToDebt(),
   Severity = Severity.High
}

//<Expl>
// The *{0}'s name* must begin with a **I**.
//</Expl>

//<Desc>
// .NET interface names are commonly prefixed with an upper case **I**; this
// widely accepted convention is recommended. COM interfaces typically don't
// follow it, so interfaces tagged *ComVisibleAttribute* are not matched.
//</Desc>

//<HowToFix>
// Prefix matched interfaces names with an upper **I**.
//</HowToFix>

Naming Conventions: all 23 items