mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 05:45:24 +00:00
Ignore preview status for fixable and unfixable selectors (#9538)
## 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 https://github.com/astral-sh/ruff/issues/9282. (An alternative to https://github.com/astral-sh/ruff/pull/9284.)
This commit is contained in:
parent
f9331c7683
commit
9a2f3e2cef
2 changed files with 69 additions and 5 deletions
|
@ -714,7 +714,7 @@ impl LintConfiguration {
|
|||
.collect();
|
||||
|
||||
// The fixable set keeps track of which rules are fixable.
|
||||
let mut fixable_set: RuleSet = RuleSelector::All.rules(&preview).collect();
|
||||
let mut fixable_set: RuleSet = RuleSelector::All.all_rules().collect();
|
||||
|
||||
// Ignores normally only subtract from the current set of selected
|
||||
// rules. By that logic the ignore in `select = [], ignore = ["E501"]`
|
||||
|
@ -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() {
|
||||
fixable_map_updates.insert(rule, true);
|
||||
}
|
||||
}
|
||||
|
@ -796,7 +796,7 @@ impl LintConfiguration {
|
|||
.chain(carriedover_unfixables.into_iter().flatten())
|
||||
.filter(|s| s.specificity() == spec)
|
||||
{
|
||||
for rule in selector.rules(&preview) {
|
||||
for rule in selector.all_rules() {
|
||||
fixable_map_updates.insert(rule, false);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue