fix: tighten ruff.toml + add CI lint step (#108) #109
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
ai-working
bug
enhancement
feature
in-queue
performance
security
tech-debt
todo
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-discord#109
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-discord#108"
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?
Closes #108
Summary
ruff.toml— scoped to legacy directories viaper-file-ignoresso new files in new paths get full enforcement__init__.py), E712 (SQLModel ORM==), F541 (1000+ legacy f-strings — cosmetic, deferred cleanup).gitea/workflows/ruff-lint.yml— runsruff checkon every PR tomain, so violations are caught before merge even if the hook was bypassed with--no-verifyWhat this fixes
The pre-commit hook was blocked on 26 violations across 12 files with the current ruff.toml. Developers were using
--no-verifyto bypass. The global F841 suppression also undercut the hook for the exact bug class PRs #37/#38 were created to fix.After this change:
ruff check .returns zero violations (verified locally)--no-verifyneededFiles changed
ruff.toml— removed global F841/F401; added[lint.per-file-ignores]section.gitea/workflows/ruff-lint.yml— new CI lint workflowOther observations
The
cogs/players.py:979-1002has a duplicatepaperdex_cardset_slashmethod definition (F811). Theplay_lock.py:13,28hasF821undefinedPlay(used in a string annotation without import). These are pre-existing issues suppressed per-file here — worth fixing in follow-up issues.AI Code Review
Files Reviewed
ruff.toml(modified).gitea/workflows/ruff-lint.yml(added)Findings
Correctness
[lint.per-file-ignores]is the correct ruff pattern for legacy codebases. New files outside the listed directories will now get full enforcement.ruff check .locally againstmainto baseline violations: violations incogs/gameplay_legacy.py(E713 ×3),cogs/players.py(F811 ×2),play_lock.py(F821 ×2),tests/**,in_game/game_helpers.py,helpers/main.py,helpers/discord_utils.py— all are covered by the appropriate per-file-ignore entries.discord_ui/**is not listed inper-file-ignoresbut is also not in the legacy-violation list. Presumably clean per local verification stated in the PR body.docker-build.yml(Gitea-prefixed action URLs, same checkout/python setup pattern).Security
Style & Conventions
.gitea/workflows/docker-build.ymlconventions (ubuntu-latest, actions/checkout@v4, actions/setup-python@v5).ruff.tomlare clear and explain the rationale for each suppression tier.Suggestions
pip install ruff==<version>). Unpinnedpip install ruffmeans CI picks up whatever PyPI has at run time. A ruff upgrade could add rules or change behaviour, causing CI failures that aren't reproducible locally. Ifrequirements-dev.txt(added in PR #83) pins ruff, considerpip install -r requirements-dev.txtinstead. Not a blocker.cogs/players.py:979-1002(F811 duplicate method) andplay_lock.py:13,28(F821 undefinedPlay) as pre-existing issues worth follow-up — good housekeeping.Verdict: APPROVED
Clean, purposeful config change that unblocks the pre-commit hook and adds a meaningful CI safety net. The per-file-ignores approach is the right pattern for incrementally tightening linting on a legacy codebase. Posting as COMMENT — Gitea blocks self-approval.
Automated review by Claude PR Reviewer
AI Code Review
Files Reviewed
ruff.toml(modified).gitea/workflows/ruff-lint.yml(added)Findings
Correctness
per-file-ignorespaths (cogs/**,in_game/**,helpers/**,command_logic/**,tests/**,utilities/**,migrations/**) all correspond to directories that exist in the repo. Top-level file suppressions (db_calls_gameplay.py,gauntlets.py,dice.py,manual_pack_distribution.py,play_lock.py,paperdynasty.py,api_calls.py,health_server.py) also all exist.pull_request: branches: [main], matching the existingdocker-build.ymltrigger pattern.ruffvia a barepip install ruffwithout pinning a version. This is a minor consistency concern sincerequirements-dev.txtlikely pins a version. Not a blocker, but a follow-up to pin ruff in CI would prevent drift.Security
Style & Conventions
https://github.com/actions/...) as the existingdocker-build.yml.ruff.tomlclearly document the rationale for each suppression, which is the right pattern for a config that will need ongoing maintenance.# Remove entries here as files are cleaned upcomment establishes a clear expectation for incremental cleanup.Suggestions
pip install ruff==X.Y.Z) to match whatever is inrequirements-dev.txt, so local and CI behavior stay consistent.play_lock.py:13,28has an F821 undefinedPlayin a string annotation without import — worth filing a follow-up issue to fix that import rather than leaving it indefinitely suppressed.Verdict: APPROVED
The change does exactly what it claims: removes the two global suppressions that were masking real violations (F841, F401), scopes legacy suppressions to specific directories and files, and adds a CI lint gate so the pre-commit hook bypass path no longer lets violations through. All referenced paths exist. The PR description is accurate and complete. The unversioned
pip install ruffis a minor nit that does not block merge.Automated review by Claude PR Reviewer