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

Ignore preview status for fixable and unfixable selectors #9538

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

charliermarsh
Copy link
Member

Summary

Right now, if you run with explicit-preview-rules, and use something like select = ["RUF017"], we won't actually enable fixing for that rule, because fixable = ["ALL"] (the default) won't include RUF017 due to the explicit-preview-rules.

The framing in this PR is that explicit-preview-rules should only affect the enablement selectors, whereas the fixable selectors should just include all possible matching rules. I think this will lead to the most intuitive behavior.

Closes #9282. (An alternative to #9284.)

@charliermarsh charliermarsh requested a review from zanieb January 15, 2024 20:15
@@ -786,7 +786,7 @@ impl LintConfiguration {
.chain(selection.extend_fixable.iter())
.filter(|s| s.specificity() == spec)
{
for rule in selector.rules(&preview) {
for rule in selector.all_rules() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we only apply the change to the initial let mut fixable_set: RuleSet = RuleSelector::All.all_rules().collect(), and not here, confusing things can happen... E.g. if you used select = ["RUF017"], then unfixable = ["RUF"] wouldn't mark RUF017 as unfixable, which seems confusing.

@charliermarsh charliermarsh added bug Something isn't working configuration Related to settings and configuration labels Jan 15, 2024
Copy link

codspeed-hq bot commented Jan 15, 2024

CodSpeed Performance Report

Merging #9538 will degrade performances by 4.33%

Comparing charlie/fix (37f42fa) with main (f9331c7)

Summary

❌ 1 regressions
✅ 29 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main charlie/fix Change
parser[numpy/ctypeslib.py] 12.2 ms 12.8 ms -4.33%

Copy link
Contributor

github-actions bot commented Jan 15, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep thanks!

@charliermarsh
Copy link
Member Author

Gonna add a test prior to merging.

@charliermarsh charliermarsh merged commit 9a2f3e2 into main Jan 16, 2024
16 of 17 checks passed
@charliermarsh charliermarsh deleted the charlie/fix branch January 16, 2024 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working configuration Related to settings and configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

explicit-preview-rules does not work for fixes
2 participants