From 2aa74bd393acc5481a578e3f1685ba8a774c7760 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Fri, 22 Sep 2023 17:46:28 +0200 Subject: [PATCH] Rename `ConfigurationOptions` derive macro to `OptionsMetadata` --- crates/ruff_macros/src/lib.rs | 4 +- crates/ruff_workspace/src/options.rs | 56 ++++++++++++++-------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/crates/ruff_macros/src/lib.rs b/crates/ruff_macros/src/lib.rs index 7efedaabadb09..ed9e77508f493 100644 --- a/crates/ruff_macros/src/lib.rs +++ b/crates/ruff_macros/src/lib.rs @@ -15,8 +15,8 @@ mod rule_code_prefix; mod rule_namespace; mod violation; -#[proc_macro_derive(ConfigurationOptions, attributes(option, doc, option_group))] -pub fn derive_config(input: TokenStream) -> TokenStream { +#[proc_macro_derive(OptionsMetadata, attributes(option, doc, option_group))] +pub fn derive_options_metadata(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); config::derive_impl(input) diff --git a/crates/ruff_workspace/src/options.rs b/crates/ruff_workspace/src/options.rs index f81612e6e8d19..bff96a404d07b 100644 --- a/crates/ruff_workspace/src/options.rs +++ b/crates/ruff_workspace/src/options.rs @@ -27,12 +27,12 @@ use ruff_linter::settings::types::{ IdentifierPattern, PythonVersion, SerializationFormat, Version, }; use ruff_linter::{warn_user_once, RuleSelector}; -use ruff_macros::{CombineOptions, ConfigurationOptions}; +use ruff_macros::{CombineOptions, OptionsMetadata}; use ruff_python_formatter::QuoteStyle; use crate::settings::LineEnding; -#[derive(Debug, PartialEq, Eq, Default, ConfigurationOptions, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Eq, Default, OptionsMetadata, Serialize, Deserialize)] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct Options { @@ -393,7 +393,7 @@ pub struct Options { /// Options specified in the `lint` section take precedence over the top-level settings. #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive( - Debug, PartialEq, Eq, Default, ConfigurationOptions, CombineOptions, Serialize, Deserialize, + Debug, PartialEq, Eq, Default, OptionsMetadata, CombineOptions, Serialize, Deserialize, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] pub struct LintOptions { @@ -737,7 +737,7 @@ pub struct LintOptions { #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive( - Debug, PartialEq, Eq, Default, ConfigurationOptions, CombineOptions, Serialize, Deserialize, + Debug, PartialEq, Eq, Default, OptionsMetadata, CombineOptions, Serialize, Deserialize, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] pub struct Flake8AnnotationsOptions { @@ -805,7 +805,7 @@ impl Flake8AnnotationsOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -853,7 +853,7 @@ impl Flake8BanditOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -883,7 +883,7 @@ impl Flake8BugbearOptions { } } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -905,7 +905,7 @@ impl Flake8BuiltinsOptions { } } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -930,7 +930,7 @@ impl Flake8ComprehensionsOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -984,7 +984,7 @@ impl Flake8CopyrightOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -1003,7 +1003,7 @@ impl Flake8ErrMsgOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -1040,7 +1040,7 @@ impl Flake8GetTextOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -1073,7 +1073,7 @@ impl Flake8ImplicitStrConcatOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -1155,7 +1155,7 @@ impl Flake8ImportConventionsOptions { } } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -1291,7 +1291,7 @@ impl Flake8PytestStyleOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -1354,7 +1354,7 @@ impl Flake8QuotesOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -1394,7 +1394,7 @@ impl Flake8SelfOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -1451,7 +1451,7 @@ impl Flake8TidyImportsOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -1525,7 +1525,7 @@ impl Flake8TypeCheckingOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -1548,7 +1548,7 @@ impl Flake8UnusedArgumentsOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -2031,7 +2031,7 @@ impl IsortOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -2059,7 +2059,7 @@ impl McCabeOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -2152,7 +2152,7 @@ impl Pep8NamingOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -2194,7 +2194,7 @@ impl PycodestyleOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -2275,7 +2275,7 @@ impl PydocstyleOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -2303,7 +2303,7 @@ impl PyflakesOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -2366,7 +2366,7 @@ impl PylintOptions { } #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] @@ -2451,7 +2451,7 @@ impl OptionsMetadata for FormatOrOutputFormat { /// /// Please provide feedback in [this discussion](https://github.com/astral-sh/ruff/discussions/7310). #[derive( - Debug, PartialEq, Eq, Default, Serialize, Deserialize, ConfigurationOptions, CombineOptions, + Debug, PartialEq, Eq, Default, Serialize, Deserialize, OptionsMetadata, CombineOptions, )] #[serde(deny_unknown_fields, rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]