Empty static constructor can be discarded

Rule ND1308 Design

Warns about static constructors (cctor in IL, run by the CLR before the type's first use) containing no lines of code: useless, safely removable.

How to fix

Remove matched empty static constructors.

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>Empty static constructor can be discarded</Name>
// <Id>ND1308:EmptyStaticConstructorCanBeDiscarded</Id>

warnif count > 0 from m in JustMyCode.Methods where 
  m.IsClassConstructor && 
  m.NbLinesOfCode == 0
select new { 
   m,
   Debt = 2.ToMinutes().ToDebt(),
   Severity = Severity.Medium
}

//<Expl>
// The *empty {0}* can be safely removed.
//</Expl>

//<Desc>
// Warns about *static constructors* (*cctor* in IL, run by the CLR before
// the type's first use) containing no lines of code: useless, safely
// removable.
//</Desc>

//<HowToFix>
// Remove matched empty *static constructors*.
//</HowToFix>

Design: all 16 items