Inclusive Variables
ID |
go.inclusive_variables |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
medium |
Remediation Effort |
low |
Resource |
Best Practice |
Language |
Go |
Tags |
inclusive, naming |
Description
Reports variable, constant, parameter and struct-field 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
Identifiers are read far more often than they are written and shape how developers reason about code. Non-inclusive terminology carries unintended connotations, and neutral alternatives are usually clearer. Preferring inclusive names is a low-cost habit that keeps the codebase welcoming and precise.
var blacklist []string // FLAW
var masterKey string // FLAW
func connect(slaveHost string) {} // FLAW
var denylist []string // OK
var primaryKey string // OK
func dial(replicaHost string) {} // OK