Skip to content

chore: make the tree lint-clean under ruff 0.16 - #357

Merged
F1uctus merged 4 commits into
mainfrom
chore/ruff-0.16
Jul 29, 2026
Merged

chore: make the tree lint-clean under ruff 0.16#357
F1uctus merged 4 commits into
mainfrom
chore/ruff-0.16

Conversation

@F1uctus

@F1uctus F1uctus commented Jul 29, 2026

Copy link
Copy Markdown
Owner

main is currently red: uv.lock pinned ruff 0.15.20 while pyproject.toml asked for >=0.15.22, so uv sync re-resolved to 0.16.0 on every CI run — and ruff 0.16.0 raised its default rule set from 59 to 413 rules. That surfaced 336 diagnostics.

  • uv.lock refreshed (ruff 0.15.20 → 0.16.0, pytest-cov 7.0.0 → 7.1.0) so the linter version is pinned again.
  • 331 diagnostics fixed by ruff check --fix --unsafe-fixes: PEP 585/604 annotations, import sorting, exitsys.exit, zip(x, x[1:])itertools.pairwise, PEP 695 type parameters.
  • The remainder by hand: orphaned imports and the now-unused T TypeVar, the four nested ifs ruff had no fix for, and the match: Span = match self-assignment in the replicizer (replaced with a distinct loop variable, mirroring the AUTHOR_INSERTION block above it).

Two judgement calls worth a look:

  • RUF012 is silenced for token_patterns.py. The flagged attributes are Enum members holding spaCy token patterns. Enum members are singletons, so the shared-mutable-state concern does not apply, and the rule's suggested ClassVar annotation would tell type checkers they are not members at all. Ruff has no Enum exemption for this rule.
  • [tool.black]'s include was broken. include replaces Black's default file filter, so the bare (tests|ttc) directory pattern also matched the JSON/JSONL/CSV corpus fixtures under tests/ — running Black rewrote them as if they were Python. Now '/(tests|ttc)/.*\.pyi?$'.

ruff check, ty check ttc and all 69 tests pass locally (with --all-groups, i.e. the large models installed).

https://claude.ai/code/session_01CqqB29TdAZ183MjNnpkTFD

ruff 0.16.0 raised its default rule set from 59 to 413 rules, which turns
CI red on `main`: uv.lock still pinned ruff 0.15.20 while pyproject asked
for >=0.15.22, so `uv sync` re-resolved to 0.16.0 on every run.

Refresh uv.lock (ruff 0.15.20 -> 0.16.0, pytest-cov 7.0.0 -> 7.1.0) so
the linter version is pinned again, and clear the 336 resulting
diagnostics:

- 331 by `ruff check --fix [--unsafe-fixes]` — PEP 585/604 annotations,
  import sorting, `exit` -> `sys.exit`, `zip(x, x[1:])` -> `pairwise`,
  PEP 695 type parameters, and similar mechanical rewrites;
- the rest by hand: drop the imports and the `T` TypeVar the rewrites
  orphaned, collapse the nested `if`s ruff could not fix on its own, and
  replace the `match: Span = match` self-assignment in the replicizer
  with a distinct loop variable, matching the block above it.

RUF012 is silenced for token_patterns.py: the attributes it flags are
Enum members holding spaCy token patterns, so the shared-mutable-state
concern does not apply, and its `ClassVar` remedy would tell type
checkers they are not members at all.

Also fix [tool.black]'s `include`, which replaced Black's default file
filter with a bare directory pattern — running Black rewrote the JSON,
JSONL and CSV corpus fixtures under tests/ as though they were Python.

`ruff check`, `ty check ttc` and the 69 tests all pass.
@semanticdiff-com

semanticdiff-com Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  tests/russian/test_actor_classification.py  100% smaller
  tests/russian/test_dialogue_extraction.py  100% smaller
  assets/coverage-map.svg  79% smaller
  ttc/cli.py  66% smaller
  ttc/corpora/__init__.py  52% smaller
  ttc/language/common/token_extensions.py  52% smaller
  ttc/language/russian/pipelines/line_numerator.py  50% smaller
  ttc/iterables.py  48% smaller
  ttc/language/russian/pipelines/sentencizer.py  41% smaller
  ttc/corpora/pdnc.py  39% smaller
  ttc/language/russian/pipelines/actor_classifier.py  33% smaller
  ttc/language/play.py  32% smaller
  ttc/__init__.py  31% smaller
  ttc/annotate.py  29% smaller
  ttc/language/russian/pipelines/replicizer.py  29% smaller
  ttc/language/russian/extensions/syntax_iterators.py  28% smaller
  ttc/language/common/span_extensions.py  26% smaller
  ttc/eval.py  18% smaller
  ttc/language/dialogue.py  17% smaller
  ttc/language/russian/conversation_classifier.py  10% smaller
  ttc/corpora/schema.py  10% smaller
  ttc/corpus.py  9% smaller
  ttc/language/russian/token_patterns.py  4% smaller
  ttc/language/russian/pipelines/__init__.py  4% smaller
  ttc/corpora/native.py  4% smaller
  ttc/corpora/jy_quoteplus.py  3% smaller
  pyproject.toml Unsupported file format
  tests/corpora/test_droc.py  0% smaller
  tests/corpora/test_jy_quoteplus.py  0% smaller
  tests/corpora/test_native.py  0% smaller
  tests/corpora/test_pdnc.py  0% smaller
  tests/corpora/test_quoteli3.py  0% smaller
  tests/corpora/test_riqua.py  0% smaller
  tests/corpora/test_rusdracor.py  0% smaller
  tests/corpora/test_splits.py  0% smaller
  tests/corpora/util.py  0% smaller
  ttc/corpora/audit.py  0% smaller
  ttc/corpora/droc.py  0% smaller
  ttc/corpora/quoteli3.py  0% smaller
  ttc/corpora/riqua.py  0% smaller
  ttc/corpora/rusdracor.py  0% smaller
  uv.lock Unsupported file format

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Coverage Map

@F1uctus
F1uctus merged commit bb569ae into main Jul 29, 2026
@F1uctus
F1uctus deleted the chore/ruff-0.16 branch July 29, 2026 16:21
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.

1 participant