A stateless class or structure might be turned into a static type

Rule ND1206 Object Oriented Design

Matches non-static, non-generic classes/structures with no instance fields, no interface implemented and no base class (other than System.Object): a stateless collection of pure functions, better hosted in a static class so clients needn't create an object.

How to fix

Declare all methods static and make the class/structure static. Severity is Low: more an advice than a problem.

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>A stateless class or structure might be turned into a static type</Name>
// <Id>ND1206:AStatelessClassOrStructureMightBeTurnedIntoAStaticType</Id>
warnif count > 0

from t in JustMyCode.Types where
  !t.IsStatic &&                  
  !t.IsGeneric &&
  !t.IsAbstract &&
   t.InstanceFields.Count() == 0 &&
   t.SimpleName != "Program" &&     // Don't warn on Program classes generated by designers

   // Don't match:
   // --> types that implement some interfaces.
   t.NbInterfacesImplemented == 0 &&

   // --> or classes that have sub-classes children.                            
   t.NbChildren == 0 &&

   // --> or classes that have a base class
   ((t.IsClass && t.DepthOfDeriveFrom("System.Object".AllowNoMatch()) == 1) ||
     t.IsStructure) &&

   // Don't warn about classes instantiated by Dependency Injection frameworks
   !t.TypesUsingMe.Any(t1 => t1.TypesUsed.ParentNamespaces().Any(n => n.Name.StartsWithAny(
       "Microsoft.Extensions.DependencyInjection",
       "Autofac", "Microsoft.Practices.Unity", "Ninject",
       "StructureMap", "SimpleInjector", "Castle.Windsor",
       "LightInject", "Spring", "Lamar", "AutoMapper"
   ))) &&
   !t.BaseClasses.Any(bc => bc.FullName.StartsWith("AutoMapper")) &&
   
   // Don't match marker classes
  !(t.IsSealed && t.Members.Count() == 1 && 
    t.Members.Single().IsMethod && 
    t.Members.Single().AsMethod.IsConstructor &&
    t.Members.Single().AsMethod.NbParameters == 0)

let methodsUsingMe = t.TypesUsingMe.ChildMethods().Where(m => m.IsUsing(t))

select new {
   t,
   methodsUsingMe,
   Debt = (1 + methodsUsingMe.Count()).ToMinutes().ToDebt(),
   Severity = Severity.Low
}

//<Expl>
// The *{0}* doesn't contain any instance field.
// Since it solely performs processing without managing any state, 
// should it be refactored into a *static class*?
//</Expl>

//<Desc>
// Matches non-static, non-generic classes/structures with no instance
// fields, no interface implemented and no base class (other than
// *System.Object*): a *stateless* collection of *pure* functions, better
// hosted in a **static class** so clients needn't create an object.
//</Desc>

//<HowToFix>
// Declare all methods *static* and make the class/structure *static*.
// Severity is **Low**: more an advice than a problem.
//</HowToFix>

Object Oriented Design: all 14 items