mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:09:22 +00:00
Allow legacy C and T selectors in JSON schema (#3889)
This commit is contained in:
parent
7b6e55a2e0
commit
e0bccfd2d9
2 changed files with 47 additions and 31 deletions
|
@ -207,7 +207,18 @@ impl JsonSchema for RuleSelector {
|
|||
Schema::Object(SchemaObject {
|
||||
instance_type: Some(InstanceType::String.into()),
|
||||
enum_values: Some(
|
||||
std::iter::once("ALL".to_string())
|
||||
[
|
||||
// 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| {
|
||||
|
@ -232,9 +243,9 @@ impl JsonSchema for RuleSelector {
|
|||
.chain(Linter::iter().filter_map(|l| {
|
||||
let prefix = l.common_prefix();
|
||||
(!prefix.is_empty()).then(|| prefix.to_string())
|
||||
}))
|
||||
.sorted(),
|
||||
})),
|
||||
)
|
||||
.sorted()
|
||||
.map(Value::String)
|
||||
.collect(),
|
||||
),
|
||||
|
|
7
ruff.schema.json
generated
7
ruff.schema.json
generated
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue