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

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 titleAdd 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

@ntBre

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

@ntBre

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

@dcreager

@ntBre ntBre mentioned this pull request

Dec 31, 2025

7 tasks

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

[ Show hidden characters]({{ revealButtonHref }})