Ruff Review
Run Ruff against a selected folder, present a numbered list of findings, and guide an interactive flow where the user decides whether to fix or ignore each issue.
Requirements
- •
ruffinstalled and on PATH (pipx install ruffis a common setup). - •
uvis recommended for running the helper script (optional if you preferpython).
Run Ruff and List Issues
bash
uv run {baseDir}/scripts/ruff_report.py <path> --save .ruff-issues.json
# or
python {baseDir}/scripts/ruff_report.py <path> --save .ruff-issues.json
- •
<path>can be a folder or a single file. - •
--savewrites raw JSON issues so you can reference details later. - •
--config path/to/pyproject.tomlif you need a custom config.
Interactive Review Flow
- •Run the report using the command above.
- •Present the numbered list to the user.
- •Ask for actions using a clear prompt, for example:
- •"Fix 1-3 and 7"
- •"Ignore 4"
- •"Skip for now"
- •Fix path
- •Prefer manual edits for targeted fixes.
- •If the issue is marked as
(fixable)and the user approves auto-fix, you may run:This may fix other occurrences of the same code; confirm scope with the user first.bashruff check <path> --fix --select <CODE>
- •Ignore path
- •Ask which ignore style they want:
- •Inline: add
# noqa: <CODE>on the flagged line. - •Config-level: add a
per-file-ignoresentry inpyproject.tomlorruff.toml.
- •Inline: add
- •Ask which ignore style they want:
- •Re-run the report to confirm remaining issues.
Output Format
The helper script prints results like:
code
1. src/app.py:12:5 F401 `os` imported but unused (fixable) 2. src/app.py:88:1 E501 line too long (88 > 79 characters) (manual) Total issues: 2 (fixable: 1)
Use the numbering to map user selections to specific issues.