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:
-
blacklist→denylist/blocklist -
whitelist→allowlist -
master→primary/leader/main -
slave→replica/follower/secondary -
grandfather→legacy -
dummy→stub/placeholder -
sanity check→smoke test/check