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:

  • whitelistallowList, allowed;

  • blacklistblockList, denylist, blocked;

  • master / slaveprimary / replica, leader / follower, parent / child, controller / worker;

  • grandfatherlegacy, existing;

  • sanityvalidity, 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].

Remediation

Rename the identifier using an inclusive alternative appropriate to the domain.