[`pyflakes`] Add secondary annotation showing previous definition (`F811`) by ntBre · Pull Request #19900 · astral-sh/ruff

added 4 commits

August 13, 2025 11:50

@ntBre ntBre marked this pull request as ready for review

August 13, 2025 16:56

@ntBre ntBre changed the title Add sub-diagnostic to F811 [pyflakes] Add sub-diagnostic (F811)

Aug 13, 2025

MichaReiser

@ntBre

@ntBre

@ntBre ntBre changed the title [pyflakes] Add sub-diagnostic (F811) [pyflakes] Add secondary annotation showing previous definition (F811)

Aug 14, 2025

ntBre added a commit that referenced this pull request

Aug 14, 2025
Summary
--

This is a quick implementation of the idea in
#19900 (comment). Especially
as we start using new diagnostic features, it seems like a good idea to keep an
eye on the `concise` output format as well as the `full`. This PR just appends a
second rendering of the diagnostics in our rule snapshots in the `concise`
format. The concise message is typically reused in the other output formats too,
so this gives us a bit of coverage for all the output formats.

I noticed that some of our concise messages are still quite long. That might be
another good class of diagnostic to use new features for. Some explanatory
pieces might fit better as sub-diagnostics.

Test Plan
--

Existing snapshots. Again, I clicked through these individually, but very, very
quickly

@ntBre ntBre mentioned this pull request

Aug 14, 2025

ntBre added a commit that referenced this pull request

Aug 14, 2025
Summary
--

This is a quick implementation of the idea in
#19900 (comment). Especially
as we start using new diagnostic features, it seems like a good idea to keep an
eye on the `concise` output format as well as the `full`. This PR just appends a
second rendering of the diagnostics in our rule snapshots in the `concise`
format. The concise message is typically reused in the other output formats too,
so this gives us a bit of coverage for all the output formats.

I noticed that some of our concise messages are still quite long. That might be
another good class of diagnostic to use new features for. Some explanatory
pieces might fit better as sub-diagnostics.

Test Plan
--

Existing snapshots. Again, I clicked through these individually, but very, very
quickly

BurntSushi

MichaReiser

@ntBre ntBre deleted the brent/redefined-while-unused branch

August 14, 2025 17:23

dcreager added a commit that referenced this pull request

Aug 14, 2025
* main:
  [ty] Add diagnostics for invalid `await` expressions (#19711)
  [ty] Synthesize read-only properties for all declared members on `NamedTuple` classes (#19899)
  [ty] Remove use of `ClassBase::try_from_type` from `super()` machinery (#19902)
  [ty] Speedup project file discovery  (#19913)
  [`pyflakes`] Add secondary annotation showing previous definition (`F811`) (#19900)
  Bump 0.12.9 (#19917)
  [ty] support `kw_only=True` for `dataclass()` and `field()` (#19677)

@ntBre ntBre mentioned this pull request

Dec 31, 2025

7 tasks