diff --git a/crates/ruff/src/rule_selector.rs b/crates/ruff/src/rule_selector.rs index 55d8efaf06..b3ce3df5be 100644 --- a/crates/ruff/src/rule_selector.rs +++ b/crates/ruff/src/rule_selector.rs @@ -207,36 +207,47 @@ impl JsonSchema for RuleSelector { Schema::Object(SchemaObject { instance_type: Some(InstanceType::String.into()), enum_values: Some( - std::iter::once("ALL".to_string()) - .chain( - RuleCodePrefix::iter() - .filter(|p| { - // Once logical lines are active by default, please remove this. - // This is here because generate-all output otherwise depends on - // the feature sets which makes the test running with - // `--all-features` fail - !Rule::from_code(&format!( - "{}{}", - p.linter().common_prefix(), - p.short_code() - )) - .unwrap() - .lint_source() - .is_logical_lines() - }) - .map(|p| { - let prefix = p.linter().common_prefix(); - let code = p.short_code(); - format!("{prefix}{code}") - }) - .chain(Linter::iter().filter_map(|l| { - let prefix = l.common_prefix(); - (!prefix.is_empty()).then(|| prefix.to_string()) - })) - .sorted(), - ) - .map(Value::String) - .collect(), + [ + // Include the non-standard "ALL" selector. + "ALL".to_string(), + // Include the legacy "C" and "T" selectors. + "C".to_string(), + "T".to_string(), + // Include some common redirect targets for those legacy selectors. + "C9".to_string(), + "T1".to_string(), + "T2".to_string(), + ] + .into_iter() + .chain( + RuleCodePrefix::iter() + .filter(|p| { + // Once logical lines are active by default, please remove this. + // This is here because generate-all output otherwise depends on + // the feature sets which makes the test running with + // `--all-features` fail + !Rule::from_code(&format!( + "{}{}", + p.linter().common_prefix(), + p.short_code() + )) + .unwrap() + .lint_source() + .is_logical_lines() + }) + .map(|p| { + let prefix = p.linter().common_prefix(); + let code = p.short_code(); + format!("{prefix}{code}") + }) + .chain(Linter::iter().filter_map(|l| { + let prefix = l.common_prefix(); + (!prefix.is_empty()).then(|| prefix.to_string()) + })), + ) + .sorted() + .map(Value::String) + .collect(), ), ..SchemaObject::default() }) diff --git a/ruff.schema.json b/ruff.schema.json index 7ac29a7c25..aaa04c3f6c 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -1438,13 +1438,13 @@ "RuleSelector": { "type": "string", "enum": [ - "ALL", "A", "A0", "A00", "A001", "A002", "A003", + "ALL", "ANN", "ANN0", "ANN00", @@ -1518,6 +1518,7 @@ "BLE0", "BLE00", "BLE001", + "C", "C4", "C40", "C400", @@ -1537,6 +1538,7 @@ "C415", "C416", "C417", + "C9", "C90", "C901", "COM", @@ -2175,8 +2177,11 @@ "SLF0", "SLF00", "SLF001", + "T", + "T1", "T10", "T100", + "T2", "T20", "T201", "T203",