Inclusive Function Name

ID

javascript.inclusive_function

Severity

info

Remediation Complexity

trivial

Remediation Risk

medium

Remediation Effort

low

Resource

Naming Convention

Language

JavaScript

Tags

inclusive, naming

Description

Reports function declarations, function expressions, methods (regular, async, generator) and named arrow functions whose name contains a non-inclusive term such as blacklist/whitelist, master/slave, grandfather, dummy or sanity.

Anonymous function literals carry no name and are not reported. Class constructors are syntactically named constructor; they are excluded so that a class with a non-inclusive name (already covered by javascript.inclusive_class) is not reported twice.

Rationale

Non-inclusive terms carry social and historical weight with no technical value; neutral, intent-carrying replacements (promote/syncReplica, legacy, stub, smoke) make APIs friendlier to contributors and more precise about what they actually do.

// Bad
function loadBlacklist() { /* ... */ }
class Service {
  promoteToMaster() { /* ... */ }
}

// Good
function loadDenylist() { /* ... */ }
class Service {
  promoteToPrimary() { /* ... */ }
}

Remediation

Rename the function 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