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

Display enabled rules #11002

Closed
BlindChickens opened this issue Apr 17, 2024 · 5 comments · Fixed by #11003
Closed

Display enabled rules #11002

BlindChickens opened this issue Apr 17, 2024 · 5 comments · Fixed by #11003
Labels
question Asking for support or clarification

Comments

@BlindChickens
Copy link

Is there any way to just see the enabled rules in a list like this with name and code(s)?

('comparison-with-itself', 'R0124')
('comparison-of-constants', 'R0133')
('no-classmethod-decorator', 'R0202')
('no-staticmethod-decorator', 'R0203')
('property-with-parameters', 'R0206')
('consider-using-from-import', 'R0402')
('too-many-public-methods', 'R0904')
('too-many-return-statements', 'R0911')
('too-many-branches', 'R0912')
...

I have seen the other discussions regarding issues resembling this that mention improving the categorisation of the rules etcetera.
And all those improvements will be welcomed. But internally when linting there must be a list after config is parsed that can just be shard with me on the terminal :)

If there is any way to get it that I am missing, please share.

@BlindChickens BlindChickens changed the title Ruff display enabled rules Display enabled rules Apr 17, 2024
@MichaReiser
Copy link
Member

You can run ruff check --show-settings It shows the entire resolved configuration and I think there's a lint.rule key somewhere

@zanieb zanieb added the question Asking for support or clarification label Apr 17, 2024
@BlindChickens
Copy link
Author

You can run ruff check --show-settings It shows the entire resolved configuration and I think there's a lint.rule key somewhere

Yes I've seen that. And the whole output is useful actually for everything it tells me.
But the output of the rules are displayed like this:

	LoggingStringFormat,
	LoggingPercentFormat,
	LoggingStringConcat,
	LoggingFString,
	LoggingWarn,
	LoggingExtraAttrClash,
	LoggingExcInfo,
	LoggingRedundantExcInfo,
	BadQuotesInlineString,
	BadQuotesMultilineString,
	BadQuotesDocstring,
	AvoidableEscapedQuote,
	UnnecessaryEscapedQuote,
	UnsortedImports,
	MissingRequiredImport,

Which I cannot even map to a rule in the output of the ruff rule --output-format=json --all. That would have sufficed, would just have had a piece of glue-code to get from the one to the other.

Let me also just add what I need it for. We want to move as much rules from pylint over to ruff. I have a script checking current enabled pylint rules, then checking in the full list of ruff rules if it is there, and then it prints it all in a list. This list is then something we can systematically take and enable in ruff, and disable in pylint.

And it will be nice if I can have the already enabled rules in ruff to better structure the output of the script. And for added sanity make sure there are no rules enabled in both.

@zanieb
Copy link
Member

zanieb commented Apr 17, 2024

Hi! I've opened a fix for this at #11003

@BlindChickens
Copy link
Author

Aah! This is perfect thanks. When does it release? ;)

@zanieb
Copy link
Member

zanieb commented Apr 18, 2024

Soon! We're planning on releasing 0.4.0 this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for support or clarification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants