Inclusive Function Name
ID |
python.inclusive_function |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Best Practice |
Language |
Python |
Tags |
inclusive, naming |
Description
Reports def declarations whose name contains a non-inclusive term (the default deny-list: blacklist, whitelist, master, slave, grandfather, dummy, sanity).
def is_blacklisted(item): # FLAW
...
def master_node(): # FLAW
...
def is_blocked(item): # OK
...
def primary_node(): # OK
Rationale
Function names are public API. A non-inclusive term in a function name leaks across every call site and every doc page; renaming the symbol later breaks downstream consumers. Catching this at definition time is cheaper than coordinating a rename across releases.
Remediation
Common replacements:
| Old | New |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|