scan-scripts.py: ruff failures yield zero findings, every ruff rule is 'high', and the workflow-builder copy flags itself

Aperta
#130 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
testing, tooling

Direzione di ricerca

Start by reading skills/bmad-*/scripts/scan-scripts.py, especially lint_python_ruff(), and compare the workflow-builder and agent-builder copies. Then inspect test_canon_sync.py and run the reproduction steps from the issue to confirm the current lint behavior. Done means ruff setup failures produce a finding, rule severities are calibrated with a fixed ruleset, the workflow-builder copy no longer flags itself, and a test prevents the copies from drifting.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

skills/bmad-*-builder/scripts/scan-scripts.py lint_python_ruff() has three problems.

  1. Silent pass when ruff itself fails. Only rc -1 (not found) and -2 (timeout) are handled. When ruff exits 2 (e.g. an invalid [tool.ruff] in the target project), stdout is empty, so the scanner records zero lint findings. The same file reports 7 issues once the config is fixed, including F821 Undefined name.
  2. No severity calibration, unpinned ruleset. Every ruff hit is high, so I001 import order ranks the same as F821. Ruff runs without --isolated/--select, so it uses whatever config is nearest the target, and results differ between machines.
  3. Drift between copies. The workflow-builder copy flags itself: scripts/scan-scripts.py: References requirements.txt or pip install — use PEP 723 inline deps (high). The agent-builder copy already uses string concatenation to avoid self-detection, but the fix was never synced back. Related to #115.

Steps to reproduce

mkdir -p sk/scripts && cd sk
printf -- '---\nname: sk\ndescription: x\n---\n' > SKILL.md
printf 'import os, sys\ndef f():\n    try:\n        x = undefined_name\n    except:\n        pass\n' > scripts/bad.py
printf '[tool.ruff]\nline-length = "not-a-number"\n' > pyproject.toml
python3 <bmb>/skills/bmad-workflow-builder/scripts/scan-scripts.py .   # no lint findings at all
rm pyproject.toml
python3 <bmb>/skills/bmad-workflow-builder/scripts/scan-scripts.py .   # 7 findings, all "high"
python3 <bmb>/skills/bmad-workflow-builder/scripts/scan-scripts.py <bmb>/skills/bmad-workflow-builder  # self-flag

Expected behavior

  • Treat any rc other than 0/1, or unparseable output, as a lint-setup finding that names the stderr.
  • Run ruff check --isolated --select <documented set> so results are reproducible.
  • Map rule families to severities, e.g. F8xx/E9xx/B high and I/E5xx/style low.
  • Extend test_canon_sync.py (or add a sibling test) so the two scanner copies can't drift.

Environment

  • Model(s) used: n/a (deterministic script)
  • Agentic IDE used: n/a (scripts run directly)
  • BMad version: bmad-builder main @ d4a921c (v2.2.2 + #118)
  • Project language: Python 3.13, Linux
Lingua principale
Python
Stelle
220
Fork
54
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bmad-code-org/bmad-builder

Tutte le issue di bmad-code-org/bmad-builder

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.