Repository navigation
Pre-commit: add ruff and enforce all hooks in CI - #343
abhirajadhikary06 wants to merge 13 commits into
Conversation
|
@tae898 — opening this as a draft per your timing request. This is commit 1 only: configuration that touches no source file, so it shouldn't conflict with the open
A couple of notes on choices, happy to change any:
As expected on the draft, the Commits 2 (ruff fixes) and 3 (prettier reformat) will be added after |
|
Thank you, this is the shape I asked for: configuration only, actions pinned by SHA, uv pinned in the install URL, every hook pinned, and no source file touched. One thing before it can go in. As you note in the description, the new Please do two things:
|
|
Converted to draft. Ran
Ready to start on the fix commits as soon as I get updates from you. |
|
Thank you for the counts. The release line is on A split that keeps the review small:
You can take it out of draft when the rebase is done. If a finding looks like a change of behavior and not a style fix, ask here before changing it, and I will answer. |
Config only (commit 1 of ArcadeData#270): add ruff (default rules E4/E7/E9/F, line length 88), the hygiene/prettier/shellcheck/hadolint hooks, the CI job that runs uvx pre-commit run --all-files, and the install instructions in CONTRIBUTING.md. The 63 ruff fixes and the first prettier reformat land in separate commits after release/26.11.1 merges to main.
4c78f2a to
e023d64
Compare
|
@tae898
|
|
Thank you for asking before touching them. Both can be fixed without
If a later finding is less clear than these two, ask here before changing it, and I will answer. |
… under TYPE_CHECKING
|
@tae898 Ruff commits are done. 11 findings remain, all marked unsafe by ruff. Before I touch them, confirming each: examples/06_vector_search_recommendations.py:115 — F841 examples/08_stackoverflow_tables_olap.py:1975 — E731 examples/download_data.py:2100 — F841 tests/test_bulk_insert.py:804 — F841 tests/test_free_threading.py:350 — E731 tests/test_typed_rows.py:166 — F841 tests/test_vector.py:1084-1088 — F401 unused tests/test_vector_sql.py:385 — F841 tests/test_vector_sql.py:804, 870 — F841 |
|
Thank you for confirming each one before touching it. I read the code on
Everything except the optional assertions in 8 and 9 is a deletion or an equivalent rewrite, so your ruff run and a normal CI run cover it. When CI is green, take the pull request out of draft and I will review it. |
|
@tae898 please confirm the ones below too:
All are loop variable renames ( |
|
Yes,
A rename of the |
- examples/06: drop dead count_type call inside try/except pass - examples/08: rewrite pid_provider lambda as def (matches 07) - examples/download_data: drop unread meta_path assignment - tests/test_bulk_insert: pytest.importorskip (pytest already imported) - tests/test_free_threading: rewrite gil lambda as def - tests/test_typed_rows: drop unread hash_map assignment - tests/test_vector: remove dead use_numpy try/except in test_lsm_euclidean_distance - tests/test_vector_sql: drop vec_data assignment, add assert vertex is not None - tests/test_vector_sql: drop index_name assignments; add assert any() at second site
|
ruff, prettier, shfmt, pretty-format-yaml, actionlint, and all hygiene hooks now pass. The remaining failures are shellcheck (info-level + 2 warnings in build-native.sh and build-image.sh) and hadolint (Dockerfile.build) — both deferred to the follow-up PR as agreed. |
|
Thank you, this is nearly there. Two things have to change before I approve the CI run, and one thing you should know:
The workflow itself matches the conventions of the repository (pinned action SHAs, read-only permissions, a pinned |
|
I checked the Python changes statement by statement: I compared the syntax tree of every changed
Everything else is behavior-neutral: the unused imports and assignments (nothing else uses them), the When you have pushed these two fixes and the two from my previous comment, I approve the workflows. |
- tests/test_log_dir.py: import render_logging_config directly from arcadedb._logdir; the alias in jvm.py was removed as unused by ruff but the test still called jvm._render_logging_config (would have been an AttributeError) - tests/test_bulk_insert.py: delete the first (duplicate) copy of TestInsertManyVertexType (byte-identical to the second; pytest already collected only the second one) - pyproject.toml: update the per-file-ignores comment to reflect that the duplicate class has now been removed Note: tests/test_vector_sql.py drops vec_data = arcadedb.to_python_array(...) which was the only call exercising that conversion in the test; replaced with assert vertex is not None as agreed in review.
|
@tae898 All three fixes from your review are pushed:
Local hook run: ruff, black, isort, prettier, shfmt, pretty-format-yaml, Ready for your review. |
|
Thank you, those three are what I asked for. Two items from my earlier comment, the one about the generated files, are still open, and they decide whether the first CI run can be green:
When both are pushed I approve the workflow runs and do the final read of the diff. |
…dolint in CI - .prettierignore: exclude native/wheel/THIRD_PARTY_NOTICES.md, native/wheel/notice-texts/ and native/src/main/resources/META-INF/ native-image/ (generated by gen_notices.py and the GraalVM build; reformatting them would fail the notices drift check) - restore the four generated files to their content on main - .github/workflows/pre-commit.yml: add SKIP: shellcheck,hadolint-docker to the CI step; the findings are fixed in the follow-up PR
|
Both fixes pushed:
Ready for final review. |
What does this PR do?
Enforces pre-commit in CI and adds ruff as the Python linter (#270). This is commit 1 of three — configuration only, touching no source file, so it does not conflict with the open
26.11.1.post1PRs.pyproject.toml:[tool.ruff]with default rules E4/E7/E9/F at line length 88 (Black's default; E501 is intentionally not enabled, so the lines Black leaves long are not flagged)..pre-commit-config.yaml: addsruff-check(check only), the basic hygiene hooks (trailing whitespace, end-of-file, merge-conflict markers, large files, private keys, check-yaml/toml/json/xml), prettier (Java, XML, Markdown, JSON; printWidth 160 for Java/XML, prose not hard-wrapped), shellcheck, and hadolint. Keeps black, isort, shfmt, pretty-format-yaml, actionlint..prettierrc.json: printWidth 160 for*.java/*.xml,proseWrap: preserve..github/workflows/pre-commit.yml: a CI job runninguvx pre-commit run --all-fileson every pull request and push tomain.CONTRIBUTING.md: documentsuvx pre-commit installand the Docker note for shellcheck/hadolint.Related issues
Closes #270 .
Performance changes
None — configuration only.
Docs
CONTRIBUTING.md(the Pre-commit section). NoREADME.mdordocs/change needed for config.Checklist
uvx pre-commit run --files <changed files>passes (run withSKIP=prettier,shellcheck,hadolint-docker,no-old-package-name: the prettier reformat is commit 3, the docker/python3 hooks are Linux-CI only).Update:
Ran uvx pre-commit run --all-files on the rebased branch (rebased onto 7e05787):
rest are info-level (deferred to follow-up)