fix(lint): the ruff pre-commit hook runs again: --force-exclude given once #1837
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1837
Loading…
Reference in a new issue
No description provided.
Delete branch "GrimVisage/Longshot:fix/ruff-hook-args"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Since #1802, every commit that changes a Python file fails its pre-commit hook, and so does
mise run lint: ruff refuses to start witherror: the argument '--force-exclude' cannot be used multiple times. The ruff-pre-commit v0.12.0 hook's own entry is alreadyruff check --force-exclude, and.pre-commit-config.yamlgaveargs: [--force-exclude]on top. This drops the extra argument; ruff.toml's excludes still apply through the entry's flag.To see it on
main: change any.pyfile andgit commit, or runpre-commit run ruff --files scripts/dev.py.Read first:
.pre-commit-config.yaml, the ruff hook.Testing
Tested: Fedora 45 (Linux 7.3), pre-commit 4.0.1 from mise.
pre-commit run ruff --files scripts/dev.pyfails onmainwith the error above and passes here.mise run lint: pre-commit passes; actionlint then fails on.forgejo/workflows/build-windows.yml(SC2016), which this doesn't touch and which fails onmaintoo.mise run test: 704 passed, 150 failed, 17 skipped. 107 of the failures are--strictrefusing to skip checks whose tools this PC doesn't have (the Vulkan and SPIR-V headers,spirv-val); the others don't read.pre-commit-config.yaml, the only file this changes, so they fail the same way onmain.Still to test: None.
Measurements
Nothing to measure: a hook's configuration, no code the game runs.
Risks
None for players. If ruff-pre-commit is moved to a version whose entry no longer passes
--force-exclude, ruff.toml's excludes would stop applying to files pre-commit names directly; the comment on the hook says why the flag isn't there. A revert brings the error back.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
ruff-pre-commit v0.12.0's hook entry is `ruff check --force-exclude`; the config's args gave it again, and ruff refused to start ("the argument '--force-exclude' cannot be used multiple times"), so every commit or `mise run lint` that touches a Python file failed. ruff.toml's excludes still apply through the entry's flag. Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <[email protected]>Closing this for now: withdrawn by the author, no review needed. The ruff hook's duplicate --force-exclude is still on main if someone else wants to fix it.
Reopened: I closed this by mistake. It is still ready for review.
Recommendation: Approve. It removes a duplicate
--force-excludethat makes ruff refuse to start, so the pre-commit hook andmise run lintwork again for every Python change, and ruff.toml's excludes still apply through the hook's own entry. Recommend approval; not approved on the forge.For contributors: committing a
.pychange no longer fails in the ruff hook withthe argument '--force-exclude' cannot be used multiple times. It makes the config better and nothing gets worse. Players get nothing new and lose nothing.Does it help: not a perf change. The fix holds up on reading: ruff-pre-commit v0.12.0's
ruffhook already hasentry: ruff check --force-exclude, and ruff's CLI (clap 4) refuses a boolean flag given twice. The author's run agrees:pre-commit run ruff --files scripts/dev.pyfails onmainand passes on this head.Other systems: the CircleCI
lintjob (.circleci/shared.yml,pre-commit run --from-ref $BASE --to-ref HEAD) runs the same hook from the same file, so it gets the same fix. Forgejo'sci.ymldoesn't run pre-commit. No game, build or packaging code reads the ruff hook (scripts/devtools/packs.pylists.pre-commit-config.yamlas not built). The other hooks are untouched.Switches: none.
Reviewed:
5bc4231848against3df5c13ed2(main@origin):.pre-commit-config.yamlin full,ruff.toml,mise.toml(the ruff pin and thelinttask),.circleci/shared.yml's lint job,.forgejo/workflows/ci.yml, and068fb8ebe2(#1802), which addedargs: [--force-exclude]. Nothing run (a code review).Fixed in this review: nothing.
Checked and fine:
rev: v0.12.0and mise'spypi:ruff = 0.12.0.ruffhook id is valid at that rev.--force-exclude(now from the entry, given once) makes ruff apply ruff.toml'sextend-exclude(third_party,gpu/third_party,gpu/vk/sirit,website/node_modules,_deps,docs/old) to those files too. Before #1802 there were no pre-commit-levelexclude:patterns on the ruff hook, and none are lost now.exclude:patterns on end-of-file-fixer and trailing-whitespace are unchanged.# ...comment after- id: ruffis valid YAML.mainand don't read this file.Suggestions (the author may take or leave)
.pre-commit-config.yaml:38: the rest of the file puts comments on their own line above the entry. A line above- id: ruffreads better than a trailing comment, and it is where someone bumpingrev:will look.Testing: by the author on Fedora 45 (pre-commit 4.0.1): the hook fails on
mainand passes here;mise run lintgets past pre-commit, then actionlint fails onbuild-windows.yml(SC2016), which fails onmaintoo. CI's pre-commit only checks changed files, and this PR changes no.pyfile, so CI won't run the ruff hook on this PR. The author's run is the evidence. Nothing else is needed: no game or hardware path.Overlaps and merge order: #68 also edits
.pre-commit-config.yaml, but only the trailing-whitespaceexclude:(lines 9-12). There's no overlap with the ruff hook and no textual conflict, so either can merge first. No other open PR touches the ruff hook.@ -37,3 +37,2 @@hooks:- id: ruffargs: [--force-exclude]- id: ruff # (the hook's entry passes --force-exclude itself; given again, ruff refuses to run)Nit: the rest of this file puts comments on their own line above the entry; a line above
- id: ruffwould match, and is where someone bumpingrev:looks.