fix: stop ruff format and ruff check --fix undoing each other - #875
Merged
Conversation
`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>
This was referenced Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #874.
tox -e formathas been a silent no-oppoetry run toxis mandated before every commit and failed on a clean master. The cause was not what it looked like.The format env runs
ruff formatthenruff check --fix.D211(no-blank-line-before-class) is ignored, leaving its mutually exclusive oppositeD203(one-blank-line-before-class) active. So the formatter strips the blank line before a class docstring and the linter immediately restores it:Net zero, exit 0. The env reports success while changing nothing, and
ruff format --checkhas 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 = 100without reformatting. The removal is real but is not the cause: the oscillation reproduces on6be5f93^, the commit before #862 (91 files, net zero). It long predates it. Corrected on the issue.What is #862's is the
docstr-coveragehalf — five functions with no docstring.The fix
D203added toextend-ignore. WithD211already 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:
Plus docstrings for
LocalToolkit.__init__,LegacyToolkit.__init__,guarded_getaddrinfo,guarded_connectandfail_edges— each saying what it is for rather than restating its name.Result
format,lint,codespellanddocstr-coverageall pass. Two test failures remain, neither from this change:test_every_referenced_curie_has_stub_node(PO:0009005) — long-standing, needs anontologies_stubsre-run held for the MIM SSSOMStaleOutputGuardTest— my local gold output was built from fix(gold): bridge MeSH per term, recovering the sites #821 gave up #864'sgold.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