Inclusive Types
ID |
go.inclusive_types |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
medium |
Remediation Effort |
low |
Resource |
Best Practice |
Language |
Go |
Tags |
inclusive, naming |
Description
Reports type names — structs, interfaces, defined types and aliases — 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 package: they appear in APIs, documentation and every use 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.
type Blacklist struct{} // FLAW
type MasterController struct{} // FLAW
type SlaveNode interface{} // FLAW
type Denylist struct{} // OK
type PrimaryController struct{} // OK
type ReplicaNode interface{} // OK
Remediation
Rename the type using an inclusive alternative, for example allowlist/denylist instead of
whitelist/blacklist, or primary/replica instead of master/slave.