Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
diceroll123 opened this issue Apr 23, 2024 · 2 comments · Fixed by #11697
Assignees
Milestone

Comments

@diceroll123
Copy link
Contributor

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.

@MichaReiser
Copy link
Member

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?

@charliermarsh
Copy link
Member

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

@charliermarsh charliermarsh self-assigned this Jun 2, 2024
@charliermarsh charliermarsh added this to the v0.5.0 milestone Jun 2, 2024
MichaReiser pushed a commit that referenced this issue Jun 24, 2024
Co-authored-by: Micha Reiser <micha@reiser.io>
Closes #11097.
@MichaReiser MichaReiser mentioned this issue Jun 26, 2024
MichaReiser pushed a commit that referenced this issue Jun 27, 2024
Co-authored-by: Micha Reiser <micha@reiser.io>
Closes #11097.
MichaReiser pushed a commit that referenced this issue Jun 27, 2024
Co-authored-by: Micha Reiser <micha@reiser.io>
Closes #11097.
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 a pull request may close this issue.

3 participants