There is no good excuse for an empty class. If it’s being used simply as a common extension point, it should be replaced with an
interface. If it was stubbed in as a placeholder for future development it should be fleshed-out. In any other case, it should be
eliminated.
public class Empty // Noncompliant
{
}
public interface IEmpty
{
}
Command, Message, Event, or Query are ignored as messaging
libraries often use them. System.Exception are ignored; even an empty Exception class can provide helpful information by its type name alone.
System.Attribute and classes annotated with attributes are ignored. PageModel class used in ASP.NET Core Razor Pages — are ignored.
using Microsoft.AspNetCore.Mvc.RazorPages;
public class EmptyPageModel: PageModel // Compliant - an empty PageModel can be fully functional, the C# code can be in the cshtml file
{
}