Inclusive Language
ID |
swift.inclusive_language |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
medium |
Remediation Effort |
low |
Resource |
Naming Convention |
Language |
Swift |
Tags |
naming |
Description
Reports identifiers — variables, parameters, functions, types — whose
name contains a non-inclusive substring such as whitelist, blacklist,
master, slave, grandfather or sanity. The forbidden-word list is
configurable.
Rationale
Inclusive language costs nothing to adopt and lowers the barrier to entry for collaborators. Most non-inclusive terms have natural, more accurate alternatives:
-
whitelist→allowList,allowed; -
blacklist→blockList,denylist,blocked; -
master/slave→primary/replica,leader/follower,parent/child,controller/worker; -
grandfather→legacy,existing; -
sanity→validity,consistency.
// Bad
let whitelist: [String] = []
class MasterController {}
// Good
let allowList: [String] = []
class PrimaryController {}
Parameters
terms-
List of non-inclusive substrings to flag. Matching is case-insensitive. Defaults to
[blacklist, whitelist, master, slave, grandfather, dummy, sanity].