Inclusive Variable Name

ID

javascript.inclusive_variable

Severity

info

Remediation Complexity

trivial

Remediation Risk

medium

Remediation Effort

low

Resource

Naming Convention

Language

JavaScript

Tags

inclusive, naming

Description

Reports var, let, const declarations and formal function/method parameters whose identifier contains a non-inclusive term such as blacklist/whitelist, master/slave, grandfather, dummy or sanity.

Destructured patterns and rest parameters are out of scope; only plain identifier bindings are checked.

Rationale

Non-inclusive terms carry social and historical weight with no technical value; neutral, intent-carrying replacements (denylist/allowlist, primary/replica, legacy, stub, smoke) make data flow easier to read and the codebase more inviting to contributors.

// Bad
const blacklistUsers = [];
let masterNode = null;
function process(masterIp, slaveIp) { /* ... */ }

// Good
const denylistUsers = [];
let primaryNode = null;
function process(primaryIp, replicaIp) { /* ... */ }

Remediation

Rename the binding using a neutral equivalent. Common substitutions:

  • blacklistdenylist / blocklist

  • whitelistallowlist

  • masterprimary / leader / main

  • slavereplica / follower / secondary

  • grandfatherlegacy

  • dummystub / placeholder

  • sanity checksmoke test / check

Configuration

The list of non-inclusive terms is configurable via the terms property in the YAML configuration:

properties:
  terms:
    - blacklist
    - whitelist
    - master
    - slave
    - grandfather
    - dummy
    - sanity
    - your-custom-term