Skip to content

fix(ruff): ruff 0.16.0 compatibility - #43

Merged
CybotTM merged 2 commits into
mainfrom
fix/ruff-016-compat
Jul 24, 2026
Merged

fix(ruff): ruff 0.16.0 compatibility#43
CybotTM merged 2 commits into
mainfrom
fix/ruff-016-compat

Conversation

@CybotTM

@CybotTM CybotTM commented Jul 24, 2026

Copy link
Copy Markdown
Member

Why

The reusable validate.yml Python-lint step now pins ruff 0.16.0 (netresearch/skill-repo-skill#184). Under 0.16.0 defaults, uvx ruff@0.16.0 check . reports 11 findings on this repo, which would fail CI once the pin lands.

Note: the expected EXE001 findings do not occur here — the scripts already carry the executable bit (mode 100755). The actual findings are import-order, modernization, and lint rules.

Findings before (ruff 0.16.0, default config)

Rule Count File
I001 (import sort) 1 detect-mechanical.py
UP035 (typing.Iterable) 1 detect-mechanical.py
RUF007 (zip pairs) 2 detect-mechanical.py
DTZ005 (datetime.now() no tz) 1 scan-cross-session.py
DTZ006 (fromtimestamp() no tz) 1 scan-cross-session.py
SIM115 (temp file ctx manager) 1 test_detect_mechanical.py
PERF102 (.items() unused key) 1 test_detect_mechanical.py
RUF059 (unused unpack) 3 test_detect_mechanical.py

ruff format --check . was already clean.

Fixes (all behaviour-preserving)

  • I001, UP035: safe autofix (ruff check --fix --select I001,UP035) — sorted imports; typing.Iterablecollections.abc.Iterable.
  • RUF007 ×2: zip(x, x[1:])itertools.pairwise(x) (added import itertools).
  • PERF102: unused-key loop → .values().
  • RUF059 ×3: prefixed unused unpacked test locals with _.
  • DTZ005 / DTZ006: # noqa with reason — naive local time is intentional; cutoff and file mtimes are both naive, so adding a tz would change the comparison.
  • SIM115: # noqa with reason — NamedTemporaryFile(delete=False) path is returned for later use and unlinked by the caller; a context manager would change lifetime.

Verification

  • uvx ruff@0.16.0 check .All checks passed!
  • uvx ruff@0.16.0 format --check . → clean
  • python -m unittest discover -s tests76 tests OK

Came from /retro follow-up.

The reusable validate.yml Python-lint step now pins ruff 0.16.0
(netresearch/skill-repo-skill#184). Under 0.16.0 defaults, ruff check .
reported 11 findings (no EXE001/FURB105/BLE001 in this repo). Fixes,
all behaviour-preserving:

- I001, UP035: safe autofix (ruff check --fix --select I001,UP035) --
  sorted imports; typing.Iterable -> collections.abc.Iterable.
- RUF007 x2: zip(x, x[1:]) -> itertools.pairwise(x) (added import itertools).
- PERF102: unused-key dict loop -> .values().
- RUF059 x3: prefixed unused unpacked test locals with _.
- DTZ005, DTZ006: # noqa with reason -- naive local time is intentional
  (cutoff and file mtimes are both naive; adding tz would change the
  comparison).
- SIM115: # noqa with reason -- NamedTemporaryFile(delete=False) path is
  returned for later use and unlinked by the caller.

ruff check . and ruff format --check . clean under 0.16.0; all 76
unit tests pass.

Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
Copilot AI review requested due to automatic review settings July 24, 2026 13:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

ruff 0.16.0 enables EXE001 by default; the scripts carry a shebang but were
tracked 100644. Force 100755 via git plumbing (a WSL/DrvFs exec-bit quirk hid
this locally) so CI's fresh checkout clears EXE001.

Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
@sonarqubecloud

Copy link
Copy Markdown

@CybotTM
CybotTM merged commit 632ab4f into main Jul 24, 2026
10 checks passed
@CybotTM
CybotTM deleted the fix/ruff-016-compat branch July 24, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants