-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Added ignoring deprecated rules for --select=ALL #10497
Added ignoring deprecated rules for --select=ALL #10497
Conversation
/// Return all matching rules, regardless of rule group filters like preview and deprecated. | ||
pub fn all_rules(&self) -> impl Iterator<Item = Rule> + '_ { | ||
match self { | ||
RuleSelector::All => RuleSelectorIter::All(Rule::iter()), | ||
|
||
RuleSelector::All => { | ||
RuleSelectorIter::All(Rule::iter().filter(|rule| !rule.is_deprecated())) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the comment prefacing this function, we should not do this filtering here. Perhaps in rules()
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @WindowGenerator just want to check in again as we get closer to 0.4.0, did you want to work on this still?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @zanieb!
Yes, I will do it before the end of the weekend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a rush! Thanks for the reply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zanieb Hi!
Code was changed, you can check it.
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
ANN101 | 34467 | 0 | 34467 | 0 | 0 |
ANN102 | 652 | 0 | 652 | 0 | 0 |
D107 | 2 | 1 | 1 | 0 | 0 |
Linter (preview)
✅ ecosystem check detected no linter changes.
Is this a breaking change because we remove rules from a selector? |
@MichaReiser that's a good call... maybe. It'd be easy to hold off merging until v0.4.0 which seems reasonable. |
It might be fine, at least from our versioning policy. The change is reasonable to me but it might be worth documenting that all selects all not deprecated rules to make it clear to users that they might "loose" rules even when upgrading to a new patch version |
fb70a9a
to
5577cb0
Compare
hi, this changed was planned for version what is the reason behind this choice? |
Hey @Alexdelia, we ended up releasing the parser in 0.4.0 and focused on delivery of that. We routinely move things to later milestones when they aren't high priority for the given release. |
// Deprecated rules are excluded in preview mode unless explicitly selected | ||
|| (rule.is_deprecated() && (!preview_enabled || self.is_exact())) | ||
// Ignore deprecated rules for All option | ||
|| (rule.is_deprecated() && (!preview_enabled || self.is_exact()) && !matches!(self, RuleSelector::All { .. })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you combine this comment with the one above? e.g.
Deprecated rules are excluded from ALL in stable require exact selection in preview
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did it!
bb3f038
to
eeb9c3b
Compare
eeb9c3b
to
d990130
Compare
I tested that running ruff without preview no longer raises To me this raises the question if deprecated rules should be removed from all non-exact selectors. It now feels kind of inconsistent that using |
I'll go ahead with merging this. It's heading in the right direction but we might need to figure out how we want to handle deprecation in combination with other group selectors. |
Co-authored-by: Micha Reiser <micha@reiser.io>
Co-authored-by: Micha Reiser <micha@reiser.io>
Summary
#10342: Added ignoring deprecated rules for --select=ALL
Test Plan
Changed integration tests with --select=ALL option