From b64307f65ef9fc5029ecd8b22f51adae18eaaed9 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Mon, 23 Jun 2025 14:30:30 +0200 Subject: [PATCH] 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 --- crates/ruff_graph/src/settings.rs | 8 +++++++- ruff.schema.json | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/ruff_graph/src/settings.rs b/crates/ruff_graph/src/settings.rs index f7174c8592..3e47b97ef3 100644 --- a/crates/ruff_graph/src/settings.rs +++ b/crates/ruff_graph/src/settings.rs @@ -36,14 +36,20 @@ impl fmt::Display for AnalyzeSettings { } #[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 = "clap", derive(clap::ValueEnum))] pub enum Direction { /// Construct a map from module to its dependencies (i.e., the modules that it imports). #[default] + #[cfg_attr(feature = "serde", serde(alias = "Dependencies"))] Dependencies, /// Construct a map from module to its dependents (i.e., the modules that import it). + #[cfg_attr(feature = "serde", serde(alias = "Dependents"))] Dependents, } diff --git a/ruff.schema.json b/ruff.schema.json index b35fcdc8da..6e64471f93 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -873,14 +873,14 @@ "description": "Construct a map from module to its dependencies (i.e., the modules that it imports).", "type": "string", "enum": [ - "Dependencies" + "dependencies" ] }, { "description": "Construct a map from module to its dependents (i.e., the modules that import it).", "type": "string", "enum": [ - "Dependents" + "dependents" ] } ]