VBC-049: magic-boolean
warningCategory: clean-code
Analysis: Regex (line by line)
File types: .js, .ts, .tsx, .py, .go, .rs, .astro
Scope: source code only, ignoring anything inside strings and comments
Excluded paths: **/test/**, **/tests/**, **/__tests__/**, **/test_*.py, **/*_test.py, **/*_test.go, **/*.test.*, **/*.spec.*
Tags: clean-code
What it reports
Magic boolean passed as first argument at line {line}. Use named parameters or a descriptive variable.
Flagged
js
renderList(true, items);py
toggle_server(True, port)rs
format_warn(false, "health", msg);Not flagged
js
renderList({ compact: true }, items);rs
healthy.store(false, Ordering::Relaxed);py
dry_run: bool = typer.Option(False, "--dry-run")Pattern
regex
\b(?!(?:store|swap|compare_exchange|compare_and_swap|Option)\b)[a-zA-Z0-9_]+\((true|false|True|False)\s*,