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

Add --selector option for ruff rule #16030

Open
InSyncWithFoo opened this issue Feb 8, 2025 · 2 comments
Open

Add --selector option for ruff rule #16030

InSyncWithFoo opened this issue Feb 8, 2025 · 2 comments
Labels
needs-decision Awaiting a decision from a maintainer

Comments

@InSyncWithFoo
Copy link
Contributor

InSyncWithFoo commented Feb 8, 2025

There are multiple kinds of rule selectors:

[tool.ruff.lint]
select = [
	"ALL",     # All codes
	"Q000",    # Full code
	"TCH001",  # Redirected code
	"ANN0",    # Prefix
	"UP",      # Linter
	"E",       # Category
	"T"        # Cross-linter (legacy)
]

Out of all selectors above, only Q000 is query-able using ruff rule. Thus, an informational popup like this can not be shown for the rest:

ruff rule should accept a --selector option that, when enabled, would cause Ruff to output a list of selected rules, similar to how ruff config handles a subkey.

@MichaReiser MichaReiser added the needs-decision Awaiting a decision from a maintainer label Feb 8, 2025
@MichaReiser
Copy link
Member

I don't think this is necessarily the scope of this command. Maybe a ruff rule list but not sure

@InSyncWithFoo
Copy link
Contributor Author

I ended up using ruff check --show-settings --isolated --select SEL. One drawback is that I have to check whether a selector is a full code or not on my own (using length and/or known code list), which leads to unwanted results for redirected codes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-decision Awaiting a decision from a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants