Repository navigation
refactor(backend): add ruff and apply lint autofixes and formatting - #112
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
1 task done
This branch was successfully deployed
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.
Summary
Adds Ruff to the backend and applies it once across the codebase, so formatting and import order are enforced from here on.
.git-blame-ignore-revs.pyproject.toml, backend design docs moved intobackend/docs/.Merge with a merge commit, not squash or rebase.
.git-blame-ignore-revslists two commit SHAs that have to survive the merge.What changed
Backend
Tooling
ruffas a dev dependency, configured inpyproject.toml(line length 100; rulesE4,E7,E9,F,I,UP,B).E712, because its fix (not Column) would break SQLAlchemy== True/Falsefilters.Depends/Query/Body/Pathas safe in default arguments, soB008only flags real cases.alembicas third-party, since the localalembic/folder would otherwise make Ruff sort it as first-party.post_write_hooksinalembic.ini).script.py.makousesstr | Noneandcollections.abc.Sequence.version_path_separatorrenamed topath_separator(the old name is deprecated in Alembic).pytest.iniinto[tool.pytest]; the redundant rootconftest.pyis removed.Mechanical changes
Optional/UniontoX | None,typingtocollections.abc,timezone.utctoUTC, 56 unused imports removed. (16db72d4)ruff formatacross the backend, including migrations. (3c6811f5)main.Tests
test_event_shifts_come_back_in_time_order; the first copy was being overridden and never ran.Docs
backend/intobackend/docs/, with every reference in code comments updated.alembic/README.Repo
.githooks/pre-commitformats staged backend files and sorts their imports.pytest.yml) runsruff format --checkandruff check --select Ibefore pytest..git-blame-ignore-revslists the autofix and format commits.git config core.hooksPath .githooksandgit config blame.ignoreRevsFile .git-blame-ignore-revs.Frontend
backend/docs/paths.Out of scope / follow up
B904,B008onDepends(require_permission(...)), andB023), left for a follow-up PR.ruff checklinting waits until those are fixed.models.pytoMapped[]style.Test plan
pytestpasses locallyAutomated
test_sheets_service,test_sheets,test_form_validationandtest_authpass after the autofixes (291 tests).ruff format --checkandruff check --select Ipass on the branch.Manual
op/saimports.