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

Method for enabling specific preview rules #7434

Closed
btjones0 opened this issue Sep 16, 2023 · 3 comments · Fixed by #7390
Closed

Method for enabling specific preview rules #7434

btjones0 opened this issue Sep 16, 2023 · 3 comments · Fixed by #7390
Assignees
Labels
configuration Related to settings and configuration needs-decision Awaiting a decision from a maintainer preview Related to preview mode features

Comments

@btjones0
Copy link

My ruff configuration is structured as a deny list where I've enabled all rules and then disable the rules that I don't want.

In 0.0.289, this looked something like:

preview = true  # added in 0.0.289
select = [
    "ALL",
    # other specific preview codes
]
ignore = [
    "PREVIEW",  # added in 0.0.289
    # other selectors I don't want
]

With the removal of the "PREVIEW" selector in 0.0.290, it doesn't look like there's an easy way to disable all the preview checks that I don't want without either:

  • changing my config to be an allow list rather than a deny list, or
  • explicitly ignoring every preview check that I'm not selecting with it's fully qualified code.

I would love to have some mechanism to select specific preview rules without doing either of these.

@charliermarsh
Copy link
Member

Thanks for this -- we actually discussed this internally last week and have something proposed in #7390 that would enable this kind of workflow (although we haven't yet decided to merge it). I'll \cc @zanieb who is owning preview behavior and thinking about these kinds of configuration issues.

(Zanie is out next week so might be a few days before a reply.)

@charliermarsh charliermarsh added configuration Related to settings and configuration preview Related to preview mode features needs-decision Awaiting a decision from a maintainer labels Sep 16, 2023
@zanieb
Copy link
Member

zanieb commented Sep 16, 2023

Ah we thought the PREVIEW selector was generally useless for ignores because of it's precedence but I missed that it was usable with ALL.

I'm happy with the approach in #7390 but wanted to wait for some user feedback regarding the current experience to ensure it resolves your needs. Please let us know if it'd work for you!

@btjones0
Copy link
Author

The approach in #7390 looks good to me.

zanieb added a commit that referenced this issue Sep 28, 2023
…rules (#7390)

Closes #7434 

Replaces the `PREVIEW` selector (removed in #7389) with a configuration
option `explicit-preview-rules` which requires selectors to use exact
rule codes for all preview rules. This allows users to enable preview
without opting into all preview rules at once.

## Test plan

Unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Related to settings and configuration needs-decision Awaiting a decision from a maintainer preview Related to preview mode features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants