Lint and format the files excluded from ruff
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 18/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- git, python
- Lĩnh vực
- developer-experience, tooling
Hướng nghiên cứu
Start with the [tool.ruff].exclude list in pyproject.toml, then empty it locally and run ruff on operations.py, backends/postgres.py, backends/sqlite.py and tests/testapp/tests/test_crypto.py to see the findings. The issue says it is not open for contribution, and it depends on #392 merging first. Done means a recorded decision for each excluded path, prek run --all-files passing, and reformatting in its own commit listed in .git-blame-ignore-revs.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Evaluate the files that ruff excludes in pyproject.toml, and bring them under linting and formatting where that is practical.
Background & Motivation
[tool.ruff].exclude in pyproject.toml lists these paths:
"morango/*/migrations/*",
"docs",
"morango/sync/operations.py",
"morango/sync/backends/postgres.py",
"morango/sync/backends/sqlite.py",
"tests/testapp/tests/test_crypto.py",
The list is older than ruff. It was the flake8 exclude list in setup.cfg, added in 805967a (2019, "Refactor project structure"), with no recorded reason. The uv migration (665c52f) and the ruff migration (292f58e, #311) carried it over unchanged.
With ruff, the exclude covers more than it did before:
- Before ruff, only flake8 skipped these files.
reorder-python-importsstill sorted their imports, and the project had no formatter. - With ruff, the same list skips linting, import sorting and formatting. The
ruff-pre-commithooks pass--force-exclude, so the hooks skip these files even when a commit changes them.
This caused a real gotcha in #392. Removing the legacy deserialization code from morango/sync/operations.py left 19 unused imports, and prek reported nothing. They were found only by running ruff on the file by hand.
User Story / Use Case
As a Morango developer,
I want every Python file that I change to be checked by the same lint and format hooks,
So that unused imports, unsorted imports and style drift are caught at commit time, not in review.
Description & Expected Outcomes
First evaluate, then decide. For each excluded path, find out what removing the exclude means, and whether it should be removed.
A first measurement with ruff 0.15.16 (the pinned hook version) on release-v0.9.x (4eacad2), with the exclude list emptied:
| Path | Lint findings | Formatter changes |
|---|---|---|
morango/sync/operations.py |
1 I001; 1 C901 (_deserialize_from_store, which #392 removes) |
~163 changed lines |
morango/sync/backends/postgres.py |
1 I001; 1 F522 (unused rmc= argument to a SQL .format()) |
~28 changed lines |
morango/sync/backends/sqlite.py |
1 I001; 1 F522 (same) |
~16 changed lines |
tests/testapp/tests/test_crypto.py |
none | ~50 changed lines |
docs (only docs/conf.py) |
none | would be reformatted |
morango/*/migrations/* |
n/a | n/a |
Notes on the measurement:
- The migrations pattern matches nothing. Migrations live in
morango/migrations/, notmorango/*/migrations/. Ruff already lints and formats all 30 migration files, and they pass. Remove the entry, or fix the pattern if migrations should be excluded on purpose. - Formatter changes are mostly line joins. Most of the code was wrapped for a shorter line length than the current 100 characters. The rest is trailing commas and blank lines. The multi-line SQL inside string literals is not changed.
- The
F522auto-fix changes code. It removes the unused keyword argument. Keep it out of any formatting-only commit. - The numbers change as other work lands. For example, on the #392 branch
operations.pyhas no lint findings and about 100 formatter lines.
Value Add & Impact
- Commit hooks give the same checks for every Python file.
- Fewer review comments about style and unused code in the sync operations and backends. These are some of the most-changed files in the repository.
- One less config surprise for new contributors.
Deliverables & Contracts
- A short record (in the PR description is enough) of the decision for each excluded path: remove the exclude, keep it with a stated reason, or narrow it.
- Each path that is no longer excluded passes
prek run --all-files. - Any change made only by reformatting is in its own commit, with no other changes. That commit's full SHA is added to
.git-blame-ignore-revs, as was done for 292f58e and cff1e87. - Lint fixes that change code (for example
F522) are in separate commits from the reformatting.
Acceptance Criteria
- Each entry in
[tool.ruff].excludeis removed, or kept with a reason in a comment inpyproject.toml. - The
morango/*/migrations/*entry is removed or corrected, so no entry matches nothing. -
prek run --all-filespasses. -
git blamewithblame.ignoreRevsFileset shows the pre-reformat authors for the reformatted files. -
make testpasses on SQLite and PostgreSQL.
Technical Pointers & Architecture
- Target Components / Context:
pyproject.toml([tool.ruff]),.pre-commit-config.yaml,.git-blame-ignore-revs, and the excluded files listed above. - Related Patterns: 292f58e ("replace flake8/isort with ruff") and cff1e87 ("Reformat imports to new single-line settings") are formatting commits already in
.git-blame-ignore-revs. - Data Model & Schema Considerations: None.
- Resilience & Failure Modes: The backends and
operations.pybuild raw SQL. Make sure no change touches SQL string contents. Run the full suite on both databases.
Notes & Tradeoffs
- Dependencies: Best done after #392 merges, because #392 removes a large part of
operations.py. Reformatting first would conflict with it. - Testing Requirements: Run the full suite on SQLite and PostgreSQL. The backends hold SQL for each database.
- Tradeoffs & Alternatives Considered:
- Keeping the excludes avoids a reformatting diff, but leaves the hooks silent on these files.
- Lint-only inclusion is possible, through
[tool.ruff.lint].excludeand[tool.ruff.format].exclude. This keeps the formatting stable while still catching unused imports. - Reformatting causes merge conflicts with open branches that touch these files.
.git-blame-ignore-revskeepsgit blameuseful.
- Compatibility & Migrations: No runtime behavior change is expected.
Metadata
Complexity: Low
Target Branch: release-v0.9.x
Labels: TAG: tech update / debt, TAG: dev experience
AI Usage
Drafted with Claude Code, after we found the gotcha while working on #392. Claude traced the history of the exclude list in git and measured the effect of removing it with the pinned ruff version (0.15.16) on release-v0.9.x. It also confirmed that the migrations pattern matches no files. I asked for the issue and set its scope: evaluate before deciding, and record any reformatting in .git-blame-ignore-revs.
- Ngôn ngữ chính
- Python
- Star
- 15
- Fork
- 23
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của learningequality/morango
-
DEV: dev-ops DEV: distributions DOCS: developer
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
learningequality/morango#387 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DEV: backend DEV: dev-ops TAG: unit tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
learningequality/morango#385 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DEV: backend P0 - critical TAG: tech update / debt TAG: unit tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
learningequality/morango#364 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Streaming operator modules need similar `begin` hookCó thể đã có người làm @bjester đã nhận 2 ngày trước. Đang mởDEV: backend TAG: tech update / debt
learningequality/morango#393 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
learningequality/morango#391 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của learningequality/morango
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ok-oldking/ok-wuthering-waves#1785 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
healthchecks/healthchecks#1349 ·
-
deployment release-lag
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
nolte/kamerplanter#2374 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug v1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
modelcontextprotocol/python-sdk#3725 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
batchterms() drops queries without a similar() clause, misaligning results with inputsCó thể đã có người làm @MohammadHijjawi97 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày