Skip to content

fix(scripts): make .github/scripts ruff-clean; pin ruff in Workflow Scripts - #370

Merged
jdfalk merged 2 commits into
mainfrom
ci/workflow-scripts-ruff
Oct 5, 2026
Merged

jdfalk merged 2 commits into
mainfrom
ci/workflow-scripts-ruff

Conversation

@jdfalk

@jdfalk jdfalk commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Workflow Scripts ran ruff check and ruff format --check on .github/scripts and hit 411 findings, so it failed on every manual dispatch. With #369 merged it now also fails the forced weekly schedule (dispatch run 37272339104).

  • ruff.toml: .github/scripts/** gets the same per-file ignores as scripts/** (T20, S602/S603/S607), plus RUF001 (status emoji) and PLR2004 (argv and semver-part counts). The rationale is written inline.
  • ruff format, plus safe and unsafe autofixes reviewed in the diff.
  • The remaining findings were fixed by hand: docstrings, PLW2901, B904, a scheme check before urlopen, a logged warning instead of except: pass, hoisted imports, os.popen('date') replaced by datetime, and unused parameters removed together with their call sites.
  • Real bug fixed: get_env_bool(key, default) ignored default.
  • reusable-ci.yml now installs ruff==0.16.10.

Local checks: ruff check, ruff format --check and compileall are clean. pytest tests passes 67/67, the same as before the change.

🤖 Generated with Claude Code

https://claude.ai/code/session_017MtQ5LP2n3t3bs7AhptkKJ

jdfalk and others added 2 commits October 5, 2026 02:53
The Workflow Scripts job runs `ruff check` and `ruff format --check` over
.github/scripts and had 411 findings, so it failed on every run that
reached it (manual dispatches, and now the forced weekly schedule).

- ruff.toml: give .github/scripts the same per-file ignores as scripts/**
  (T20, S602/S603/S607) plus RUF001 (status emoji) and PLR2004 (argv and
  semver-part counts), with the rationale inline.
- ruff format and the safe/unsafe autofixes (import order, unused unpacked
  variables, merged comparisons, implicit Optional, needless assigns).
- Hand fixes: module/function docstrings, loop-variable shadowing, raise
  ... from, a scheme check before urlopen, a logged warning instead of a
  bare except/pass, inline json imports hoisted, `os.popen('date')`
  replaced by datetime, and two unused parameters removed with their call
  sites. get_env_bool now honors its `default` argument, which it ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017MtQ5LP2n3t3bs7AhptkKJ
An unpinned `pip install ruff` lets each new ruff release add findings
and fail the job with no change in the repo. Pin to 0.16.10, the version
the scripts were cleaned against.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017MtQ5LP2n3t3bs7AhptkKJ
@github-actions github-actions Bot added size/XL github-actions GitHub Actions related work type:documentation Improvements or additions to documentation module:config Configuration management tech:python Python programming language workflow:github-actions GitHub Actions workflows labels Oct 5, 2026
script_path.write_text(script_content)
os.chmod(script_path, 0o755)
# Generated scripts are executables invoked by workflows.
os.chmod(script_path, 0o755) # noqa: S103
@jdfalk
jdfalk merged commit 769ea83 into main Oct 5, 2026
41 of 42 checks passed
@jdfalk
jdfalk deleted the ci/workflow-scripts-ruff branch October 5, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github-actions GitHub Actions related work module:config Configuration management size/XL tech:python Python programming language type:documentation Improvements or additions to documentation workflow:github-actions GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants