Skip to content

fix: stop ruff format and ruff check --fix undoing each other - #875

Merged
realmarcin merged 1 commit into
masterfrom
chore/restore-tox-gate
Aug 22, 2026
Merged

fix: stop ruff format and ruff check --fix undoing each other#875
realmarcin merged 1 commit into
masterfrom
chore/restore-tox-gate

Conversation

@realmarcin

Copy link
Copy Markdown
Collaborator

Closes #874.

tox -e format has been a silent no-op

poetry run tox is mandated before every commit and failed on a clean master. The cause was not what it looked like.

The format env runs ruff format then ruff check --fix. D211 (no-blank-line-before-class) is ignored, leaving its mutually exclusive opposite D203 (one-blank-line-before-class) active. So the formatter strips the blank line before a class docstring and the linter immediately restores it:

ruff format      -> 98 files changed
ruff check --fix -> 0 files changed    (all 98 reverted)

Net zero, exit 0. The env reports success while changing nothing, and ruff format --check has reported the same ~98 files unformatted indefinitely, because the fix can never stick. Ruff prints a warning naming this exact pairing on every run — it was just never acted on.

I got the diagnosis wrong first

I filed #874 blaming #862 for removing [tool.black] line-length = 100 without reformatting. The removal is real but is not the cause: the oscillation reproduces on 6be5f93^, the commit before #862 (91 files, net zero). It long predates it. Corrected on the issue.

What is #862's is the docstr-coverage half — five functions with no docstring.

The fix

D203 added to extend-ignore. With D211 already ignored, letting the formatter decide is the only self-consistent option. The 98-file reformatting here is the backlog that could never land while the two tools fought.

Verified the oscillation stops:

ruff format      -> 98 files changed
ruff check --fix -> 98 files changed   (retained)
ruff format --check -> 196 files already formatted

Plus docstrings for LocalToolkit.__init__, LegacyToolkit.__init__, guarded_getaddrinfo, guarded_connect and fail_edges — each saying what it is for rather than restating its name.

Result

format, lint, codespell and docstr-coverage all pass. Two test failures remain, neither from this change:

  • test_every_referenced_curie_has_stub_node (PO:0009005) — long-standing, needs an ontologies_stubs re-run held for the MIM SSSOM
  • StaleOutputGuardTest — my local gold output was built from fix(gold): bridge MeSH per term, recovering the sites #821 gave up #864's gold.py, so the content fingerprint correctly reports a mismatch. That is the guard working.

Mostly mechanical, but large (102 files). Worth landing on its own and ahead of #863/#864, both of which will need a trivial rebase after it.

🤖 Generated with Claude Code

`poetry run tox` — mandated before every commit — failed on a clean master, and
the cause was not what it looked like.

**`tox -e format` has been a silent no-op.** It runs `ruff format` then
`ruff check --fix`. `D211` (`no-blank-line-before-class`) is ignored, leaving
its mutually exclusive opposite `D203` (`one-blank-line-before-class`) active.
So the formatter strips the blank line before a class docstring and the linter
puts it straight back:

    ruff format      -> 98 files changed
    ruff check --fix -> 0 files changed   (all 98 reverted)

Net zero, exit 0, and `ruff format --check` has therefore reported ~98 files
unformatted indefinitely, because the fix can never stick. Ruff emits a warning
naming this exact pairing on every run.

I first blamed #862 for removing `[tool.black] line-length = 100` without
reformatting. That was wrong: the oscillation reproduces on the commit *before*
#862 (91 files, net zero), so it long predates it. Corrected on the issue.

Ignoring `D203` leaves the formatter to decide, which is the only
self-consistent option given `D211` is already ignored. The 98-file
reformatting is the backlog that could never land while the two fought.

**Five functions added by #862 had no docstring**, failing the same gate:
`LocalToolkit.__init__`, `LegacyToolkit.__init__`, `guarded_getaddrinfo`,
`guarded_connect`, `fail_edges`. Each now says what it is for rather than
restating its name.

format, lint, codespell and docstr-coverage all pass. Two test failures remain,
neither from this change: `test_every_referenced_curie_has_stub_node`
(PO:0009005, long-standing, needs an ontologies_stubs re-run held for the MIM
SSSOM) and `StaleOutputGuardTest` (local gold output built from the #864
branch's gold.py — the fingerprint guard working as designed).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

master fails its own mandated poetry run tox gate: 99 files unformatted, 5 missing docstrings

1 participant