-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Enabling specific preview rules #12343
Comments
Thanks for the detailed write up.
This is somewhat intentional because we want to encourage users to give feedback on preview rules. Whether we promote a rule to stable depends on the feedback we receive from users. Without feedback, we'll end up promoting a rule that then creates a lot of churn downstream.
Could you explain which part isn't working for you? I tried to reproduce your setup by enabling the same rules as in your example and using I can set |
So on scikit-learn, adding
results in:
while on
Here are the outputs of |
Thanks, I now see what's happening. What you're experience isn't that it enables additional preview-only rules, but that you see new violations because of some preview-only changes to stable rules. We don't support enabling preview functionality for specific rules only. Enabling preview mode enables the preview functionality for all rules (if they have any). |
Oh now I understand. However, that puts us in a weird position, because:
I feel like there should be a middle ground there? I hope this makes sense. |
If those rule changes are giving you false positives in preview mode, I'd highly recommend opening issues because the behavior is likely to become stable soon. Unfortunately we don't have enough bandwidth to manage different preview modes, that's why we have a single global flag. An option here is to allow explicit selection of preview rules without enabling preview mode. We'd probably need to display a warning that the rule is in preview, though. |
Not sure if this is the same issue when dealing with formatting. Related to this issue, the "single flag to rule them all" has caused confusion and consternation. My projects adopted the setting in order to make "quote-style=preserve" work for compatibility when migrating from black, but that caused "hugged parenthesis" to be adopted implicitly. Later, when quote-style=preserve graduated to stable, we tried to remove the setting but that would roll back other behaviors. In my projects, I'm opting to have "preview=true" by default (and the uncertainty that will bring), but at least that will allow the projects to continue to shift left (work at head). I realize it's difficult to manage feature-specific flags, but just be aware that the user experience is muddled by the shifting meaning of this flag over time and releases. |
Our usecase scikit-learn/scikit-learn#29477 is that we'd like to enable
CPY001
. Since it's apreview
rule, one needs to enable preview mode.However, preview mode enables many other rules which don't work as intended on our repo, give false positives, ...
That's why I looked into enabling preview rules only explicitly. However, when one does something like
select = ["E", "F", "W", "I", "CPY001"]
in the configuration, everything under those categories are enabled, regardless of them being in preview mode or not.I'd argue that the above
select
doesn't really explicitly select those preview rules underE
,F
, ..., however, they're selected.This is related to #7434, and I think
explicit-preview-rules
introduced in #7390 somewhat intends to fix the issue, but in this case it doesn't.What should one do in this case?
In effect, I think I'd expect this config:
to only include stable rules under those categories, and enable
CPY001
on top of them, and no other preview rule should be enabled.The text was updated successfully, but these errors were encountered: