fix casing of analyze.direction variant names (#18892)

## Summary

Fixes `analyze.direction` to use kebab-case for the variant names. 

Fixes https://github.com/astral-sh/ruff/issues/18887

## Test Plan

Created a `ruff.toml` and tested that both `dependents` and `Dependents`
were accepted
This commit is contained in:
Micha Reiser 2025-06-23 14:30:30 +02:00 committed by GitHub
parent 291413b126
commit b64307f65e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -36,14 +36,20 @@ impl fmt::Display for AnalyzeSettings {
} }
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, CacheKey)] #[derive(Default, Debug, Copy, Clone, PartialEq, Eq, CacheKey)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(
feature = "serde",
derive(serde::Serialize, serde::Deserialize),
serde(rename_all = "kebab-case")
)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))] #[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
pub enum Direction { pub enum Direction {
/// Construct a map from module to its dependencies (i.e., the modules that it imports). /// Construct a map from module to its dependencies (i.e., the modules that it imports).
#[default] #[default]
#[cfg_attr(feature = "serde", serde(alias = "Dependencies"))]
Dependencies, Dependencies,
/// Construct a map from module to its dependents (i.e., the modules that import it). /// Construct a map from module to its dependents (i.e., the modules that import it).
#[cfg_attr(feature = "serde", serde(alias = "Dependents"))]
Dependents, Dependents,
} }

4
ruff.schema.json generated
View file

@ -873,14 +873,14 @@
"description": "Construct a map from module to its dependencies (i.e., the modules that it imports).", "description": "Construct a map from module to its dependencies (i.e., the modules that it imports).",
"type": "string", "type": "string",
"enum": [ "enum": [
"Dependencies" "dependencies"
] ]
}, },
{ {
"description": "Construct a map from module to its dependents (i.e., the modules that import it).", "description": "Construct a map from module to its dependents (i.e., the modules that import it).",
"type": "string", "type": "string",
"enum": [ "enum": [
"Dependents" "dependents"
] ]
} }
] ]