PY-NAMI0001 · boolean_predicate_name
Require Boolean symbols to read as predicates.
This is a deterministic rule for python. Read its implementation.
Definition
Section titled “Definition”Require attributes, properties, functions, and methods proven to return Boolean values to begin
with a configured question prefix after removing any visibility prefix. The default prefixes
are is_, has_, can_, should_, and supports_.
Evidence
Section titled “Evidence”Each finding names the symbol, the exact place it is declared, and how many references a rename would have to move with it, which is what says whether the repair is safe. The rename itself arrives from the fix this rule already declares rather than from a second statement of the same edit. A symbol whose references are incomplete is reported and left unrepaired.
Exceptions
Section titled “Exceptions”Exclude local variables, Python special methods, required overrides, and names imposed by an external framework or protocol.
Examples
Section titled “Examples”ready: bool fails while is_ready: bool passes. A required __contains__ method is excluded
even though it returns bool.
References
Section titled “References”- Adapts Pylint C0103 invalid-name
- Cites “PEP 8, Style Guide for Python Code”, naming conventions
- Cites “The Python Standard Library”, predicate naming conventions
- Cites “Clean Code”, meaningful names