Skip to content

Align local ruff lint.select with trunk + stale-noqa audit #246

Description

@pbean

Findings F-6 + F-9b of the "Brownfield CLI/TUI Refactor Assessment" (local report, gitignored under _bmad-output/implementation-artifacts/).

Evidence

  • pyproject.toml has NO [tool.ruff.lint] table, so local ruff runs default rules while CI's trunk runs ruff + black + isort + bandit. Local green ≠ CI green.
  • ~72 # noqa comments across src/ include codes (BLE001, S105/S106, …) the local config never enables — a known false-positive class from past reviews. (The 63 except Exception sites are annotated seam translations by design — only their noqa-code audit belongs here.)
  • F-9b (folded in): 5 scattered BMAD_LOOP_* env reads — engine.py:2504 (BMAD_LOOP_SESSION_TIMEOUT_S), adapters/multiplexer.py:417,476 + cli.py:621 (BMAD_LOOP_MUX_BACKEND), process_host.py:394 (BMAD_LOOP_PROCESS_HOST) — undiscoverable and undocumented.

Recommendation

Lint alignment PR:

  1. Determine what rule set trunk's ruff actually enforces (check .trunk/ config and trunk's ruff defaults — verify against current trunk/ruff docs, don't assume).
  2. Add [tool.ruff.lint] select mirroring that — do NOT ratchet stricter than CI.
  3. Run ruff clean: fix cheap violations, per-rule ignores with reasons otherwise.
  4. Audit all noqa comments — delete stale ones whose codes still aren't enabled, keep and verify the rest.

Env-var registry PR (small, independent): create a ~30-line module (e.g. src/bmad_loop/envvars.py) with named typed readers for the three vars; update the read sites to go through it (re-grep, lines will have drifted); add a doc table of supported env vars where operator docs live. Semantics identical — tests must not need changes beyond import paths. Terse CHANGELOG line for the env-var docs.

Ordering

Sessions 11-12 of the refactor program. The lint PR assumes the verify.py-split re-exports exist (it must not delete them).

Traps

  • ruff F401 autofix silently DELETES re-exports (cli.py:42-56, plus the verify.py/install.py/runsetup.py re-exports from earlier sessions) — run trunk check --no-fix and diff-review any autofix before accepting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions