Inclusive Function Definition
ID |
java.inclusive_function |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
medium |
Remediation Effort |
low |
Resource |
Naming Convention |
Language |
Java |
Tags |
inclusive, naming |
Description
Reports method declarations whose name contains a non-inclusive term such as blacklist/whitelist, master/slave, grandfather, dummy or sanity.
Rationale
See java.inclusive_class — the same argument applies at the method level. Method names are part of the callable API surface and end up in stack traces and log lines; renaming them carries its weight in readability.
// Bad
void addToBlacklist(User u) { ... }
void promoteSlave() { ... }
boolean sanityCheck() { ... }
// Good
void addToDenylist(User u) { ... }
void promoteReplica() { ... }
boolean smokeTest() { ... }
Remediation
Rename the method using a neutral equivalent. See the "Remediation" section of java.inclusive_class for the substitution table.