ruff icon indicating copy to clipboard operation
ruff copied to clipboard

(🎁) `PGH004` should suggest the code

Open KotlinIsland opened this issue 1 year ago • 5 comments

a  # noqa 
> ruff check
test.py:1:4: PGH004 Use specific rule codes when using `noqa`

it should suggest the required error codes, additionally, it could have an autofix

https://play.ruff.rs/e847f4d3-7278-482b-a334-a1073b101829

KotlinIsland avatar Oct 10 '24 02:10 KotlinIsland

A fix would definitely be useful. I'm not convinced that we should include the error codes in the message. It could make the message unnecessarily long. But we could include a hint when we have our revamped diagnostic system

MichaReiser avatar Oct 10 '24 05:10 MichaReiser

I don't think suggesting the code in the error message would make the message very long:

-test.py:1:4: PGH004 Use specific rule codes when using `noqa`
+test.py:1:4: PGH004 Use `noqa: F811` rather than catch-all suppression comment

AlexWaygood avatar Oct 10 '24 11:10 AlexWaygood

It could be if we use rule names instead of codes or if there are multiple codes.

MichaReiser avatar Oct 10 '24 15:10 MichaReiser

couldn't it just be in the help part of the output?

KotlinIsland avatar Oct 24 '24 03:10 KotlinIsland

couldn't it just be in the help part of the output?

Yeah, that's what I would prefer.

MichaReiser avatar Oct 24 '24 06:10 MichaReiser