Skip to content

Bump Ruff to 0.12.9, update output parsing for new rendering#68

Open
hramezani wants to merge 1 commit into
pydantic:mainfrom
hramezani:hramezani/ruff-0.12.9
Open

Bump Ruff to 0.12.9, update output parsing for new rendering#68
hramezani wants to merge 1 commit into
pydantic:mainfrom
hramezani:hramezani/ruff-0.12.9

Conversation

@hramezani

@hramezani hramezani commented Jul 10, 2026

Copy link
Copy Markdown

Ruff 0.12.9 changed the full output rendering (astral-sh/ruff#19966): the diagnostic header is split so the location is emitted on a separate --> file:line:col line instead of the old file:line:col: CODE message single line. This broke ruff_check's offset rewriting and the associated tests.

This bumps the minimum Ruff to >=0.12.9 and updates the parsing to the new format.

Relationship to #65

This builds directly on @ntBre's work in #65 — same root cause and same fix approach. I opened a fresh PR for two reasons:

  1. Bump Ruff to 0.12.9, update regexes for new output rendering #65 now conflicts with main (after Add support for Python 3.14, drop EOL 3.8-3.9 #67 dropped EOL 3.8/3.9 and touched the same requires-python line). This branch is cut from current main, so it merges cleanly.
  2. It additionally handles the case where the lint error is on a multi-digit line number (see below).

Happy to fold these changes into #65 instead if that's preferable — I just wanted to get a mergeable, rebased version up.

Multi-digit line numbers

Ruff indents the --> arrow to align with the source gutter, so the leading whitespace widens once the line number reaches two digits:

 --> -:1:7      # 1 leading space
  --> -:10:7    # 2 leading spaces

To keep the offset substitution working regardless of line-number width, this matches variable leading whitespace (r'^( *)--> -:(\d+)') and preserves it in the replacement. It also adds test_ruff_offset_multiline, which puts the error on line 10 (and again with start_line=10) so this stays covered.

All existing tests pass, plus ruff format --check, ruff check, and pyright are clean.

Ruff 0.12.9 (astral-sh/ruff#19966) split the diagnostic header so the
location renders on a separate `--> file:line:col` line, indented to
align with the source gutter. Update the offset-rewriting regex to match
the new format and preserve the variable-width indentation (so the path
substitution still works when the error is on a multi-digit line number),
and bump the minimum Ruff to 0.12.9.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ntBre

ntBre commented Jul 10, 2026

Copy link
Copy Markdown

I'm also happy to rebase #65. I wasn't aware that that was the blocker to moving forward with the PR.

@hramezani

Copy link
Copy Markdown
Author

I'm also happy to rebase #65. I wasn't aware that that was the blocker to moving forward with the PR.

would be great if you could rebase your PR. Please consider the fix that I did for multi-digit line number and include the test

@ntBre

ntBre commented Jul 10, 2026

Copy link
Copy Markdown

Actually, I'll just close mine in favor of this given your additional improvements. Thanks for picking it up!

@hramezani

Copy link
Copy Markdown
Author

Actually, I'll just close mine in favor of this given your additional improvements. Thanks for picking it up!

Sorry @ntBre. I created the new PR because I didn't want to bother you after a long time for the rebase and review!

@ntBre

ntBre commented Jul 10, 2026

Copy link
Copy Markdown

No worries at all, I'm very happy to leave it in your hands! Let me know if you end up needing anything from me :)

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.

2 participants