Inclusive Class

ID

csharp.inclusive_class

Severity

info

Remediation Complexity

trivial

Remediation Risk

medium

Remediation Effort

low

Resource

Best Practice

Language

CSharp

Tags

inclusive, naming

Description

Reports class, struct, interface, enum and record names that contain a non-inclusive term such as blacklist, whitelist, master, slave, grandfather, dummy or sanity. The term list is configurable through the terms property.

Rationale

Type names are part of the public vocabulary of a codebase: they appear in APIs, documentation and every call site. Non-inclusive terminology carries unintended connotations and clearer, neutral alternatives almost always read better. Choosing inclusive names is a low-cost habit that keeps the codebase welcoming and precise.

public class Blacklist { }            // FLAW
public class MasterController { }     // FLAW
public interface ISlaveNode { }       // FLAW

public class Denylist { }             // OK
public class PrimaryController { }    // OK
public interface IReplicaNode { }     // OK

Remediation

Rename the type using an inclusive alternative, for example allowlist/denylist instead of whitelist/blacklist, or primary/replica instead of master/slave.