Skip to content

Enforce pre-commit in CI and add a linter (ruff defaults: 63 findings on main); line length stays 88 #270

Closed

Description

@tae898

Pre-commit formats the code (black, isort with the black profile, shfmt, pretty-format-yaml, actionlint, the old-name check), but nothing enforces it: no workflow runs pre-commit, so a contribution made without the local hooks is not checked, and there is no Python linter at all (CI runs Bandit only).

What a linter finds on main (a53f9cd6cc) with ruff's default rules (E4, E7, E9, F): 63 findings, 25 auto-fixable.

Rule Count Note
F401 unused import 22 e.g. core.py:34 json_bulk_dumps
E402 import not at top 15
F811 redefinition 9 tests/test_bulk_insert.py:249 defines TestInsertManyVertexType a second time, byte-identical to the class at line 151 (a duplicated block); the other 8 are pytest fixture parameters named like the fixture
F841 unused variable 8
F541 f-string without placeholders 4
E731, E741 2 each
F821 undefined name 1 core.py:1562, the string annotation "VectorIndex" (no import under TYPE_CHECKING)

Proposal, after the 26.11.1 tag (it touches many files and would conflict with the release pull requests):

  • add ruff check with its default rules to pre-commit, fix the 63 findings (keep black and isort as the formatters);
  • add the basic hygiene hooks (trailing whitespace, end of file, merge-conflict markers, large files, private keys);
  • add a CI job that runs uvx pre-commit run --all-files on every pull request and push, so the hooks are enforced for every contribution;
  • keep the line length at 88, Black's default, which already applies to code, and state it in pyproject.toml; no hard limit on comments and strings (ruff's E501 at 88 would flag 2,904 lines that Black deliberately leaves alone);
  • say how to install the hooks (uvx pre-commit install) in CONTRIBUTING.md.
  • cover every file type, not only Python, and match upstream ArcadeDB where the code shares its style:
Files Tool Width
Java (src/java, native/src/main/java), XML (pom.xml) prettier 3.9.10 with prettier-plugin-java 2.11.0 and prettier-plugin-xml, the hook and versions of ArcadeData/arcadedb's .pre-commit-config.yaml 160, upstream's printWidth
Python black + isort (as today), ruff check 88
Markdown, JSON prettier with proseWrap: preserve (prose is not hard-wrapped) no limit on prose
Shell shfmt (as today) and shellcheck
Dockerfile (scripts/Dockerfile.build) hadolint
YAML, TOML pretty-format-yaml (as today), check-yaml, check-toml
GitHub Actions actionlint (as today)
AsciiDoc docs the Antora build in docs.yml already fails on any warning

The first run of prettier on the Java and XML files may reformat many lines; it lands as its own commit in the same PR, so the review can skip it.

Edited 2026-11-05: the scope widened from Python to every file type in the repository, with upstream ArcadeDB's Java and XML formatter.

Activity

  1. added this to the 26.12.1 milestone on Nov 6, 2026
  2. added
    github_actionsPull requests that update GitHub Actions code
    pythonPull requests that update python code
    on Nov 6, 2026
  3. abhirajadhikary06 commented on Nov 9, 2026

    @abhirajadhikary06
    Contributor

    Hi @tae898! I'd love to take this on and set up the pre-commit checks and Ruff linter integration for the repository.

    Here is the plan I can follow to address this:

    1. Ruff Integration & Cleanup: Configure .pre-commit-config.yaml and pyproject.toml to run ruff check (targeting default rulesets E4, E7, E9, F with line length 88) and resolve the existing 63 findings across main.
    2. Basic Hygiene Hooks: Add standard pre-commit hooks for general file hygiene (trailing whitespace, end-of-file fixer, YAML/JSON validation, merge conflict checks).
    3. Multi-Language Formatting: Include configurations for prettier (Java/XML/Markdown/JSON) and formatters/linters for Shell, Dockerfile, and GitHub Actions as outlined in the proposal.
    4. CI Enforcement: Create/update a GitHub Actions workflow step running uvx pre-commit run --all-files on push and pull_request triggers to ensure ongoing enforcement.

    Let me know if this scope looks good to you, and I can open a PR shortly!

  4. tae898 commented on Nov 9, 2026

    @tae898
    CollaboratorAuthor

    Thank you, that is the plan I had in mind, and it matches the issue: ruff with its default rules (E4, E7, E9, F) at line length 88, the hygiene hooks, prettier for Java, XML, Markdown and JSON, shellcheck and hadolint, and a CI job that runs uvx pre-commit run --all-files on every pull request and push. I have assigned the issue to you.

    One request about timing. Twelve pull requests of mine for 26.11.1.post1 are open and touch most of the Python and Java files (type_conversion.py, core.py, graph_batch.py, _native/*, BulkOps.java, NativeExtras.java and many tests), so the ruff fixes and the first prettier run would conflict with all of them. Please start with the parts that touch no source file: the ruff and line-length settings in pyproject.toml, the pre-commit hook configuration, the CI job and CONTRIBUTING.md. The 63 fixes and the prettier reformat should start from main after release/26.11.1 has been merged into it. I will comment here when that has happened. If the configuration is ready before then, open it as a draft pull request.

    Two details so that the pull request stays easy to review: keep the prettier reformat of the Java and XML files in its own commit, and keep the ruff fixes in a separate commit from the configuration. Questions are welcome here.

  5. tae898 commented on Nov 10, 2026

    @tae898
    CollaboratorAuthor

    The release line is merged into main (#351, merge commit 6619f13), as I wrote I would tell you here. You can start the parts that touch source files from that commit:

    1. Rebase #343 (configuration only, as agreed) on the new main if it needs it. I will review it first.
    2. Then the ruff fixes and the prettier reformat as separate commits, in one or two PRs, as in the plan above. The count of 63 findings is from a53f9cd6cc; the merge brought in many files, so please run uvx ruff check with the default rules (E4, E7, E9, F) on the new main and put the new count in the PR description.

    Black and isort already report a handful of files on main that the merge did not touch (uvx black==26.10.1 --check .); they belong to the same cleanup, in the formatting commit.

    Questions are welcome here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

github_actionsPull requests that update GitHub Actions codein progressThe team is actively working on this issuepythonPull requests that update python code

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions