ruff icon indicating copy to clipboard operation
ruff copied to clipboard

idea: add generic name to rule violations if `message` contains formatted strings when output in `--statistics`

Open diceroll123 opened this issue 1 year ago • 1 comments
trafficstars

This is probably a bit of a stretch to ask, but running ruff check --select=ANN201 --statistics for example will show something like

25445	ANN201	Missing return type annotation for public function `THING`

Which obviously does not actually apply to all 25445 instances of the ANN201 violations.

So I propose some generic analogue to Violation::message but for the basic violation. In this case, Missing return type annotation for public function.

Of course, this suggestion applies to all violations with formatted strings.

diceroll123 avatar Apr 23 '24 02:04 diceroll123

This sounds reasonable, although adding one more field to all violations is a rather involved change (and having it on Message also has a performance cost). I wonder if we should just show the rule name instead with a link or change the titles of our rules to never include dynamic parts?

MichaReiser avatar Apr 23 '24 07:04 MichaReiser

Let's change this to use the rule name rather than the violation.

charliermarsh avatar Jun 01 '24 23:06 charliermarsh