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

Configuration

The deny-list is configurable via the rule’s terms property in the scan profile.

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

blacklist

denylist / block_list

whitelist

allowlist / allow_list

master / slave

primary / replica / worker

grandfather

legacy / old

dummy

placeholder / fake

sanity

quick_check