chore: introduce ruff linting - #170
Draft
pnewsam wants to merge 1 commit into
Draft
Conversation
Establishes ruff as the linter for cowork-server (the repo had no linter). - pyproject: line-length 120, target py312, starter ruleset E/F/W/I/UP/C4. Deferred to follow-ups (kept out of this PR to bound the diff): the ruff formatter + E501 line-length, B/SIM rules needing manual judgement, and UP042 (str+Enum → StrEnum). - Add ruff to the dev dependency group + uv.lock. - CI: run `ruff check` in the unit-tests workflow. - Apply the resulting fixes: 219 auto-fixed (unused imports, import sorting, pyupgrade modernizations) + 10 fixed by hand. Notably the one `== False` was a SQLModel filter, rewritten to `.is_(False)` rather than ruff's `not` suggestion (which would break the SQL). All 318 unit tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Automatic Review Skipped Too many files for automatic review. If you would still like a review, you can trigger one manually by commenting: |
Contributor
Author
|
@Entelligence review |
pnewsam
marked this pull request as draft
July 7, 2026 23:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Introduces ruff as the linter for
cowork-server. The repo had no linter — this is the split-out, long-term counterpart to the hotfix in #169, which removed 3.12-only f-string syntax that crashed the server on stranded venvs. (That hotfix is now purely the source fix; the CI/lint concern lives here instead.)Config (intentionally lean for a first adoption PR)
line-length = 120,target-version = "py312"E, F, W, I, UP, C4— high-signal and overwhelmingly auto-fixable.ruffadded to thedevdependency group (+uv.lock).uv run ruff check coworkadded to the unit-tests workflow.Deliberately deferred to follow-ups to keep this diff reviewable:
E501line-length that rides with it.B/SIM(bugbear / simplify) — need case-by-case judgement (e.g. 87raise ... from).UP042(str, Enum→StrEnum) — a behavior-adjacent migration worth its own review.Fixes applied
datetime.UTC, PEP 604 unions/optionals, deprecated imports).dict()→ literal, ambiguousl→ln, alignedif x: returnsplit, trailing whitespace, an unused local + its now-dead import..where(ScheduleRun.is_manual == False)was a SQLModel filter — rewritten to.is_(False)(the SQL-correct form) rather than ruff'snot ...suggestion, which would have evaluated in Python and broken the query.Verification
ruff check cowork→ All checks passedmake test/unit→ 318 passed🤖 Generated with Claude Code