Skip to content

Repo-wide ruff pass + enforce it in CI #106

Description

@asmacdo

mechababs has no [tool.ruff] config and no CI workflows, so formatting is unenforced and drifting. ruff format --check currently reports 17 files would be reformatted, 3 already formatted. (ruff check . passes clean — this is purely formatting.)

Now that the repo takes outside contributions, unenforced formatting is a contributor-facing papercut rather than just an internal one: a PR gets reformatted incidentally, or a reviewer spends the round-trip on it.

Do it as one deliberate pass

Not piecemeal. Running ruff format on individual files as you touch them rewrites unrelated lines into an otherwise small diff — that has already happened once here, where a test-file rename commit also carried a wholesale reformat of that file, making the rename unreviewable.

Scope

  • Add [tool.ruff] to pyproject.toml.
  • One repo-wide ruff format commit, separate from any behaviour change.
  • Add a CI workflow running both steps, matching what babs runs: ruff check . and ruff format --check .. These are two separate steps; ruff check alone does not catch formatting.

Pin the ruff version in CI rather than pip install ruff — an unpinned install silently changes the rule set on someone else's PR (this bit babs: PennLINC/babs#397).

Metadata

Metadata

Assignees

No one assigned

    Labels

    automationDeployment glue: deploy pattern, ledger, scripts

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions