Skip to content

Commit ca133c7

Browse files
docs(skill): recommend ruff --fix workflow for PRs failing ruff check (#15218)
* docs(skill): recommend ruff --fix then --unsafe-fixes for PRs failing ruff check * Update .github/skills/code-review/SKILL.md --------- Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent ece9b39 commit ca133c7

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

.github/skills/code-review/SKILL.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@ suggest the fix — never just "rejected".
3333
- [ ] Descriptive variable and function names (no single letters where a word helps).
3434
- [ ] Code is formatted and lint-clean (`ruff`, `pre-commit`).
3535

36+
#### When a PR fails `ruff check`
37+
38+
Don't just report the failure — try the mechanical fixes and recommend the one
39+
that works, in this order:
40+
41+
1. Run `ruff check --fix file_path.py`. If that makes the file pass, recommend
42+
that solution — these are the fixes `ruff` considers **safe**.
43+
2. If it still fails, run `ruff check --fix --unsafe-fixes file_path.py`. If that
44+
makes the file pass **and** the resulting diff is genuinely safe (it preserves
45+
behavior — review it, don't trust it blindly), recommend that solution and note
46+
that it required `--unsafe-fixes`.
47+
3. If neither passes, or the unsafe fix would change behavior, describe the
48+
remaining rule violations and the manual change the author needs to make.
49+
50+
Always quote the exact rule code(s) `ruff` reports (e.g., `ruff rule UP047`,
51+
`ruff rule RUF100`) so the author can run those commands to read the rules being
52+
flagged. Also, paste the concrete command you ran.
53+
3654
### 3. Other Requirements for Submissions
3755

3856
- [ ] At least one **Wikipedia (or equivalent) URL** documenting the algorithm.

0 commit comments

Comments
 (0)