diff --git a/README.md b/README.md index dcda1d6a21..7bba9d19b5 100644 --- a/README.md +++ b/README.md @@ -2077,7 +2077,7 @@ enforcing `RUF001`, `RUF002`, and `RUF003`. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2097,7 +2097,7 @@ system builtins. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2123,7 +2123,7 @@ variable, if set. **Default value**: `.ruff_cache` -**Type**: `PathBuf` +**Type**: `str` **Example usage**: @@ -2142,7 +2142,7 @@ default expression matches `_`, `__`, and `_var`, but not `_var_`. **Default value**: `"^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"` -**Type**: `Regex` +**Type**: `re.Pattern` **Example usage**: @@ -2175,7 +2175,7 @@ Note that you'll typically want to use **Default value**: `[".bzr", ".direnv", ".eggs", ".git", ".hg", ".mypy_cache", ".nox", ".pants.d", ".ruff_cache", ".svn", ".tox", ".venv", "__pypackages__", "_build", "buck-out", "build", "dist", "node_modules", "venv"]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2198,7 +2198,7 @@ in the current configuration file. **Default value**: `None` -**Type**: `Path` +**Type**: `str` **Example usage**: @@ -2231,7 +2231,7 @@ For more information on the glob syntax, refer to the [`globset` documentation]( **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2253,7 +2253,7 @@ since its usage is now interchangeable with `ignore`. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[RuleSelector]` **Example usage**: @@ -2272,7 +2272,7 @@ specified by `select`. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[RuleSelector]` **Example usage**: @@ -2293,7 +2293,7 @@ by Ruff. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2348,7 +2348,7 @@ considered autofixable. **Default value**: `["A", "ANN", "ARG", "B", "BLE", "C", "COM", "D", "DTZ", "E", "EM", "ERA", "EXE", "F", "FBT", "G", "I", "ICN", "INP", "ISC", "N", "PD", "PGH", "PIE", "PL", "PT", "PTH", "Q", "RET", "RUF", "S", "SIM", "T", "TCH", "TID", "TRY", "UP", "W", "YTT"]` -**Type**: `Vec` +**Type**: `list[RuleSelector]` **Example usage**: @@ -2396,7 +2396,7 @@ Actions annotations), `"gitlab"` (GitLab CI code quality report), or **Default value**: `"text"` -**Type**: `SerializationType` +**Type**: `"text" | "json" | "junit" | "github" | "gitlab" | "pylint"` **Example usage**: @@ -2420,7 +2420,7 @@ specific prefixes. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[RuleSelector]` **Example usage**: @@ -2459,7 +2459,7 @@ The line length to use when enforcing long-lines violations (like **Default value**: `88` -**Type**: `usize` +**Type**: `int` **Example usage**: @@ -2479,7 +2479,7 @@ contained an `__init__.py` file. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2497,7 +2497,7 @@ exclude, when considering any matching files. **Default value**: `{}` -**Type**: `HashMap>` +**Type**: `dict[str, list[RuleSelector]]` **Example usage**: @@ -2519,7 +2519,7 @@ file). **Default value**: `None` -**Type**: `String` +**Type**: `str` **Example usage**: @@ -2561,7 +2561,7 @@ specific prefixes. **Default value**: `["E", "F"]` -**Type**: `Vec` +**Type**: `list[RuleSelector]` **Example usage**: @@ -2621,7 +2621,7 @@ variables will also be expanded. **Default value**: `["."]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2642,7 +2642,7 @@ and instead must be specified explicitly (as seen below). **Default value**: `"py310"` -**Type**: `PythonVersion` +**Type**: `"py37" | "py38" | "py39" | "py310" | "py311"` **Example usage**: @@ -2664,7 +2664,7 @@ detection (`ERA`), and skipped by line-length rules (`E501`) if **Default value**: `["TODO", "FIXME", "XXX"]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2688,7 +2688,7 @@ as ordinary Python objects. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2705,7 +2705,7 @@ A list of rule codes or prefixes to consider non-autofix-able. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[RuleSelector]` **Example usage**: @@ -2839,7 +2839,7 @@ A list of directories to consider temporary. **Default value**: `["/tmp", "/var/tmp", "/dev/shm"]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2857,7 +2857,7 @@ specified by `hardcoded-tmp-directory`. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2877,7 +2877,7 @@ e.g., the `no-mutable-default-argument` rule (`B006`). **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2897,7 +2897,7 @@ Ignore list of builtins. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -2916,7 +2916,7 @@ Maximum string length for string literals in exception messages. **Default value**: `0` -**Type**: `usize` +**Type**: `int` **Example usage**: @@ -2963,7 +2963,7 @@ the `extend_aliases` option. **Default value**: `{"altair": "alt", "matplotlib": "mpl", "matplotlib.pyplot": "plt", "numpy": "np", "pandas": "pd", "seaborn": "sns", "tensorflow": "tf", "holoviews": "hv", "panel": "pn", "plotly.express": "px", "polars": "pl", "pyarrow": "pa"}` -**Type**: `FxHashMap` +**Type**: `dict[str, str]` **Example usage**: @@ -2988,7 +2988,7 @@ will be added to the `aliases` mapping. **Default value**: `{}` -**Type**: `FxHashMap` +**Type**: `dict[str, str]` **Example usage**: @@ -3057,7 +3057,7 @@ The following values are supported: **Default value**: `tuple` -**Type**: `ParametrizeNameType` +**Type**: `"csv" | "tuple" | "list"` **Example usage**: @@ -3079,7 +3079,7 @@ case of multiple parameters. The following values are supported: **Default value**: `tuple` -**Type**: `ParametrizeValuesRowType` +**Type**: `"tuple" | "list"` **Example usage**: @@ -3099,7 +3099,7 @@ The following values are supported: **Default value**: `list` -**Type**: `ParametrizeValuesType` +**Type**: `"tuple" | "list"` **Example usage**: @@ -3123,7 +3123,7 @@ list. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3141,7 +3141,7 @@ List of exception names that require a match= parameter in a **Default value**: `["BaseException", "Exception", "ValueError", "OSError", "IOError", "EnvironmentError", "socket.error"]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3176,12 +3176,11 @@ avoid-escape = false #### [`docstring-quotes`](#docstring-quotes) -Quote style to prefer for docstrings (either "single" (`'`) or "double" -(`"`)). +Quote style to prefer for docstrings (either "single" or "double"). **Default value**: `"double"` -**Type**: `Quote` +**Type**: `"single" | "double"` **Example usage**: @@ -3194,12 +3193,12 @@ docstring-quotes = "single" #### [`inline-quotes`](#inline-quotes) -Quote style to prefer for inline strings (either "single" (`'`) or -"double" (`"`)). +Quote style to prefer for inline strings (either "single" or +"double"). **Default value**: `"double"` -**Type**: `Quote` +**Type**: `"single" | "double"` **Example usage**: @@ -3212,12 +3211,12 @@ inline-quotes = "single" #### [`multiline-quotes`](#multiline-quotes) -Quote style to prefer for multiline strings (either "single" (`'`) or -"double" (`"`)). +Quote style to prefer for multiline strings (either "single" or +"double"). **Default value**: `"double"` -**Type**: `Quote` +**Type**: `"single" | "double"` **Example usage**: @@ -3237,7 +3236,7 @@ that extend into the parent module or beyond (`"parents"`). **Default value**: `"parents"` -**Type**: `Strictness` +**Type**: `"parents" | "all"` **Example usage**: @@ -3257,7 +3256,7 @@ and can be circumvented via `eval` or `importlib`. **Default value**: `{}` -**Type**: `HashMap` +**Type**: `dict[str, { "msg": str }]` **Example usage**: @@ -3279,7 +3278,7 @@ blocks. **Default value**: `["typing"]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3337,7 +3336,7 @@ An override list of tokens to always recognize as a Class for **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3373,7 +3372,7 @@ for `order-by-type` regardless of casing. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3391,7 +3390,7 @@ known to Ruff in advance. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3478,7 +3477,7 @@ can be identified as such via introspection of the local filesystem. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3496,7 +3495,7 @@ can be identified as such via introspection of the local filesystem. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3514,7 +3513,7 @@ section via empty lines. **Default value**: `[]` -**Type**: `Option>` +**Type**: `list["future" | "standard-library" | "third-party" | "first-party" | "local-folder"]` **Example usage**: @@ -3556,7 +3555,7 @@ this to "closest-to-furthest" is equivalent to isort's `reverse-relative **Default value**: `furthest-to-closest` -**Type**: `RelativeImportsOrder` +**Type**: `"furthest-to-closest" | "closest-to-furthest"` **Example usage**: @@ -3573,7 +3572,7 @@ Add the specified import line to all files. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3590,7 +3589,7 @@ One or more modules to exclude from the single line rule. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3628,7 +3627,7 @@ for `order-by-type` regardless of casing. **Default value**: `[]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3647,7 +3646,7 @@ The maximum McCabe complexity to allow before triggering `C901` errors. **Default value**: `10` -**Type**: `usize` +**Type**: `int` **Example usage**: @@ -3670,7 +3669,7 @@ expect that any method decorated by a decorator in this list takes a **Default value**: `["classmethod"]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3688,7 +3687,7 @@ A list of names to ignore when considering `pep8-naming` violations. **Default value**: `["setUp", "tearDown", "setUpClass", "tearDownClass", "setUpModule", "tearDownModule", "asyncSetUp", "asyncTearDown", "setUpTestData", "failureException", "longMessage", "maxDiff"]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3708,7 +3707,7 @@ expect that any method decorated by a decorator in this list has no **Default value**: `["staticmethod"]` -**Type**: `Vec` +**Type**: `list[str]` **Example usage**: @@ -3748,7 +3747,7 @@ documentation (`W505`), including standalone comments. **Default value**: `None` -**Type**: `usize` +**Type**: `int` **Example usage**: @@ -3768,7 +3767,7 @@ defaults when analyzing docstring sections. **Default value**: `None` -**Type**: `Convention` +**Type**: `"google" | "numpy" | "pep257"` **Example usage**: @@ -3788,7 +3787,7 @@ Constant types to ignore when used as "magic values" (see: `PLR2004`). **Default value**: `["str", "bytes"]` -**Type**: `Vec` +**Type**: `list["str" | "bytes" | "complex" | "float" | "int" | "tuple"]` **Example usage**: @@ -3805,7 +3804,7 @@ Maximum number of arguments allowed for a function definition (see: `PLR0913`). **Default value**: `5` -**Type**: `usize` +**Type**: `int` **Example usage**: diff --git a/ruff.schema.json b/ruff.schema.json index 16c4ceef3b..16f6986bd0 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -768,7 +768,7 @@ ] }, "docstring-quotes": { - "description": "Quote style to prefer for docstrings (either \"single\" (`'`) or \"double\" (`\"`)).", + "description": "Quote style to prefer for docstrings (either \"single\" or \"double\").", "anyOf": [ { "$ref": "#/definitions/Quote" @@ -779,7 +779,7 @@ ] }, "inline-quotes": { - "description": "Quote style to prefer for inline strings (either \"single\" (`'`) or \"double\" (`\"`)).", + "description": "Quote style to prefer for inline strings (either \"single\" or \"double\").", "anyOf": [ { "$ref": "#/definitions/Quote" @@ -790,7 +790,7 @@ ] }, "multiline-quotes": { - "description": "Quote style to prefer for multiline strings (either \"single\" (`'`) or \"double\" (`\"`)).", + "description": "Quote style to prefer for multiline strings (either \"single\" or \"double\").", "anyOf": [ { "$ref": "#/definitions/Quote" @@ -1188,14 +1188,14 @@ "Quote": { "oneOf": [ { - "description": "Use single quotes (`'`).", + "description": "Use single quotes.", "type": "string", "enum": [ "single" ] }, { - "description": "Use double quotes (`\"`).", + "description": "Use double quotes.", "type": "string", "enum": [ "double" diff --git a/src/rules/flake8_bandit/settings.rs b/src/rules/flake8_bandit/settings.rs index 43242b6d71..2ecc2f1929 100644 --- a/src/rules/flake8_bandit/settings.rs +++ b/src/rules/flake8_bandit/settings.rs @@ -21,14 +21,14 @@ fn default_tmp_dirs() -> Vec { pub struct Options { #[option( default = "[\"/tmp\", \"/var/tmp\", \"/dev/shm\"]", - value_type = "Vec", + value_type = "list[str]", example = "hardcoded-tmp-directory = [\"/foo/bar\"]" )] /// A list of directories to consider temporary. pub hardcoded_tmp_directory: Option>, #[option( default = "[]", - value_type = "Vec", + value_type = "list[str]", example = "extend-hardcoded-tmp-directory = [\"/foo/bar\"]" )] /// A list of directories to consider temporary, in addition to those diff --git a/src/rules/flake8_bugbear/settings.rs b/src/rules/flake8_bugbear/settings.rs index e372d23d99..266f7048bf 100644 --- a/src/rules/flake8_bugbear/settings.rs +++ b/src/rules/flake8_bugbear/settings.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct Options { #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" # Allow default arguments like, e.g., `data: List[str] = fastapi.Query(None)`. extend-immutable-calls = ["fastapi.Depends", "fastapi.Query"] diff --git a/src/rules/flake8_builtins/settings.rs b/src/rules/flake8_builtins/settings.rs index 7122caa415..243145586a 100644 --- a/src/rules/flake8_builtins/settings.rs +++ b/src/rules/flake8_builtins/settings.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct Options { #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = "builtins-ignorelist = [\"id\"]" )] /// Ignore list of builtins. diff --git a/src/rules/flake8_errmsg/settings.rs b/src/rules/flake8_errmsg/settings.rs index 849085d742..54f37d3779 100644 --- a/src/rules/flake8_errmsg/settings.rs +++ b/src/rules/flake8_errmsg/settings.rs @@ -13,11 +13,7 @@ use serde::{Deserialize, Serialize}; rename = "Flake8ErrMsgOptions" )] pub struct Options { - #[option( - default = "0", - value_type = "usize", - example = "max-string-length = 20" - )] + #[option(default = "0", value_type = "int", example = "max-string-length = 20")] /// Maximum string length for string literals in exception messages. pub max_string_length: Option, } diff --git a/src/rules/flake8_import_conventions/settings.rs b/src/rules/flake8_import_conventions/settings.rs index a63092bb11..b2248a4873 100644 --- a/src/rules/flake8_import_conventions/settings.rs +++ b/src/rules/flake8_import_conventions/settings.rs @@ -35,7 +35,7 @@ const CONVENTIONAL_ALIASES: &[(&str, &str)] = &[ pub struct Options { #[option( default = r#"{"altair": "alt", "matplotlib": "mpl", "matplotlib.pyplot": "plt", "numpy": "np", "pandas": "pd", "seaborn": "sns", "tensorflow": "tf", "holoviews": "hv", "panel": "pn", "plotly.express": "px", "polars": "pl", "pyarrow": "pa"}"#, - value_type = "FxHashMap", + value_type = "dict[str, str]", example = r#" [tool.ruff.flake8-import-conventions.aliases] # Declare the default aliases. @@ -52,7 +52,7 @@ pub struct Options { pub aliases: Option>, #[option( default = r#"{}"#, - value_type = "FxHashMap", + value_type = "dict[str, str]", example = r#" [tool.ruff.flake8-import-conventions.extend-aliases] # Declare a custom alias for the `matplotlib` module. diff --git a/src/rules/flake8_pytest_style/settings.rs b/src/rules/flake8_pytest_style/settings.rs index 1f28099e60..fb85267dcd 100644 --- a/src/rules/flake8_pytest_style/settings.rs +++ b/src/rules/flake8_pytest_style/settings.rs @@ -42,7 +42,7 @@ pub struct Options { pub fixture_parentheses: Option, #[option( default = "tuple", - value_type = "ParametrizeNameType", + value_type = r#""csv" | "tuple" | "list""#, example = "parametrize-names-type = \"list\"" )] /// Expected type for multiple argument names in `@pytest.mark.parametrize`. @@ -55,7 +55,7 @@ pub struct Options { pub parametrize_names_type: Option, #[option( default = "list", - value_type = "ParametrizeValuesType", + value_type = r#""tuple" | "list""#, example = "parametrize-values-type = \"tuple\"" )] /// Expected type for the list of values rows in `@pytest.mark.parametrize`. @@ -65,7 +65,7 @@ pub struct Options { pub parametrize_values_type: Option, #[option( default = "tuple", - value_type = "ParametrizeValuesRowType", + value_type = r#""tuple" | "list""#, example = "parametrize-values-row-type = \"list\"" )] /// Expected type for each row of values in `@pytest.mark.parametrize` in @@ -77,7 +77,7 @@ pub struct Options { pub parametrize_values_row_type: Option, #[option( default = r#"["BaseException", "Exception", "ValueError", "OSError", "IOError", "EnvironmentError", "socket.error"]"#, - value_type = "Vec", + value_type = "list[str]", example = "raises-require-match-for = [\"requests.RequestException\"]" )] /// List of exception names that require a match= parameter in a @@ -85,7 +85,7 @@ pub struct Options { pub raises_require_match_for: Option>, #[option( default = "[]", - value_type = "Vec", + value_type = "list[str]", example = "raises-extend-require-match-for = [\"requests.RequestException\"]" )] /// List of additional exception names that require a match= parameter in a diff --git a/src/rules/flake8_quotes/settings.rs b/src/rules/flake8_quotes/settings.rs index 31b71b7c65..34db0cdbe0 100644 --- a/src/rules/flake8_quotes/settings.rs +++ b/src/rules/flake8_quotes/settings.rs @@ -7,9 +7,9 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash, JsonSchema)] #[serde(deny_unknown_fields, rename_all = "kebab-case")] pub enum Quote { - /// Use single quotes (`'`). + /// Use single quotes. Single, - /// Use double quotes (`"`). + /// Use double quotes. Double, } @@ -30,33 +30,32 @@ impl Default for Quote { pub struct Options { #[option( default = r#""double""#, - value_type = "Quote", + value_type = r#""single" | "double""#, example = r#" inline-quotes = "single" "# )] - /// Quote style to prefer for inline strings (either "single" (`'`) or - /// "double" (`"`)). + /// Quote style to prefer for inline strings (either "single" or + /// "double"). pub inline_quotes: Option, #[option( default = r#""double""#, - value_type = "Quote", + value_type = r#""single" | "double""#, example = r#" multiline-quotes = "single" "# )] - /// Quote style to prefer for multiline strings (either "single" (`'`) or - /// "double" (`"`)). + /// Quote style to prefer for multiline strings (either "single" or + /// "double"). pub multiline_quotes: Option, #[option( default = r#""double""#, - value_type = "Quote", + value_type = r#""single" | "double""#, example = r#" docstring-quotes = "single" "# )] - /// Quote style to prefer for docstrings (either "single" (`'`) or "double" - /// (`"`)). + /// Quote style to prefer for docstrings (either "single" or "double"). pub docstring_quotes: Option, #[option( default = r#"true"#, diff --git a/src/rules/flake8_tidy_imports/options.rs b/src/rules/flake8_tidy_imports/options.rs index d2ad987c73..0be3e4c41f 100644 --- a/src/rules/flake8_tidy_imports/options.rs +++ b/src/rules/flake8_tidy_imports/options.rs @@ -20,7 +20,7 @@ use super::Settings; pub struct Options { #[option( default = r#""parents""#, - value_type = "Strictness", + value_type = r#""parents" | "all""#, example = r#" # Disallow all relative imports. ban-relative-imports = "all" @@ -31,7 +31,7 @@ pub struct Options { pub ban_relative_imports: Option, #[option( default = r#"{}"#, - value_type = "HashMap", + value_type = r#"dict[str, { "msg": str }]"#, example = r#" [tool.ruff.flake8-tidy-imports.banned-api] "cgi".msg = "The cgi module is deprecated, see https://peps.python.org/pep-0594/#cgi." diff --git a/src/rules/flake8_type_checking/settings.rs b/src/rules/flake8_type_checking/settings.rs index 6e4269f5d1..862ecf1b1b 100644 --- a/src/rules/flake8_type_checking/settings.rs +++ b/src/rules/flake8_type_checking/settings.rs @@ -26,7 +26,7 @@ pub struct Options { pub strict: Option, #[option( default = "[\"typing\"]", - value_type = "Vec", + value_type = "list[str]", example = r#" exempt-modules = ["typing", "typing_extensions"] "# diff --git a/src/rules/isort/settings.rs b/src/rules/isort/settings.rs index 8e208421a1..48efc62cbc 100644 --- a/src/rules/isort/settings.rs +++ b/src/rules/isort/settings.rs @@ -68,7 +68,7 @@ pub struct Options { pub force_single_line: Option, #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" single-line-exclusions = ["os", "json"] "# @@ -120,7 +120,7 @@ pub struct Options { pub force_sort_within_sections: Option, #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" known-first-party = ["src"] "# @@ -130,7 +130,7 @@ pub struct Options { pub known_first_party: Option>, #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" known-third-party = ["src"] "# @@ -140,7 +140,7 @@ pub struct Options { pub known_third_party: Option>, #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" extra-standard-library = ["path"] "# @@ -150,7 +150,7 @@ pub struct Options { pub extra_standard_library: Option>, #[option( default = r#"furthest-to-closest"#, - value_type = "RelativeImportsOrder", + value_type = r#""furthest-to-closest" | "closest-to-furthest""#, example = r#" relative-imports-order = "closest-to-furthest" "# @@ -166,7 +166,7 @@ pub struct Options { pub relative_imports_order: Option, #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" required-imports = ["from __future__ import annotations"] "# @@ -175,7 +175,7 @@ pub struct Options { pub required_imports: Option>, #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" classes = ["SVC"] "# @@ -185,7 +185,7 @@ pub struct Options { pub classes: Option>, #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" constants = ["constant"] "# @@ -195,7 +195,7 @@ pub struct Options { pub constants: Option>, #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" variables = ["VAR"] "# @@ -205,7 +205,7 @@ pub struct Options { pub variables: Option>, #[option( default = r#"[]"#, - value_type = "Option>", + value_type = r#"list["future" | "standard-library" | "third-party" | "first-party" | "local-folder"]"#, example = r#" no-lines-before = ["future", "standard-library"] "# diff --git a/src/rules/mccabe/settings.rs b/src/rules/mccabe/settings.rs index bb5b639562..95a1b63172 100644 --- a/src/rules/mccabe/settings.rs +++ b/src/rules/mccabe/settings.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub struct Options { #[option( default = "10", - value_type = "usize", + value_type = "int", example = r#" # Flag errors (`C901`) whenever the complexity level exceeds 5. max-complexity = 5 diff --git a/src/rules/pep8_naming/settings.rs b/src/rules/pep8_naming/settings.rs index e9dc2ab025..bc1e0cb275 100644 --- a/src/rules/pep8_naming/settings.rs +++ b/src/rules/pep8_naming/settings.rs @@ -34,7 +34,7 @@ const STATICMETHOD_DECORATORS: [&str; 1] = ["staticmethod"]; pub struct Options { #[option( default = r#"["setUp", "tearDown", "setUpClass", "tearDownClass", "setUpModule", "tearDownModule", "asyncSetUp", "asyncTearDown", "setUpTestData", "failureException", "longMessage", "maxDiff"]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" ignore-names = ["callMethod"] "# @@ -43,7 +43,7 @@ pub struct Options { pub ignore_names: Option>, #[option( default = r#"["classmethod"]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" # Allow Pydantic's `@validator` decorator to trigger class method treatment. classmethod-decorators = ["classmethod", "pydantic.validator"] @@ -56,7 +56,7 @@ pub struct Options { pub classmethod_decorators: Option>, #[option( default = r#"["staticmethod"]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" # Allow a shorthand alias, `@stcmthd`, to trigger static method treatment. staticmethod-decorators = ["staticmethod", "stcmthd"] diff --git a/src/rules/pycodestyle/settings.rs b/src/rules/pycodestyle/settings.rs index 36e96c8a10..df1e70a868 100644 --- a/src/rules/pycodestyle/settings.rs +++ b/src/rules/pycodestyle/settings.rs @@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize}; pub struct Options { #[option( default = "None", - value_type = "usize", + value_type = "int", example = r#" max-doc-length = 88 "# diff --git a/src/rules/pydocstyle/settings.rs b/src/rules/pydocstyle/settings.rs index 9105440dd1..1cfa4ae9cd 100644 --- a/src/rules/pydocstyle/settings.rs +++ b/src/rules/pydocstyle/settings.rs @@ -74,7 +74,7 @@ impl Convention { pub struct Options { #[option( default = r#"None"#, - value_type = "Convention", + value_type = r#""google" | "numpy" | "pep257""#, example = r#" # Use Google-style docstrings. convention = "google" diff --git a/src/rules/pylint/settings.rs b/src/rules/pylint/settings.rs index 9d91d3946e..f0647cc217 100644 --- a/src/rules/pylint/settings.rs +++ b/src/rules/pylint/settings.rs @@ -46,14 +46,14 @@ impl TryFrom<&Constant> for ConstantType { pub struct Options { #[option( default = r#"["str", "bytes"]"#, - value_type = "Vec", + value_type = r#"list["str" | "bytes" | "complex" | "float" | "int" | "tuple"]"#, example = r#" allow-magic-value-types = ["int"] "# )] /// Constant types to ignore when used as "magic values" (see: `PLR2004`). pub allow_magic_value_types: Option>, - #[option(default = r"5", value_type = "usize", example = r"max_args = 5")] + #[option(default = r"5", value_type = "int", example = r"max_args = 5")] /// Maximum number of arguments allowed for a function definition (see: `PLR0913`). pub max_args: Option, } diff --git a/src/settings/options.rs b/src/settings/options.rs index a735a59393..c2fbf6eebb 100644 --- a/src/settings/options.rs +++ b/src/settings/options.rs @@ -21,7 +21,7 @@ use crate::settings::types::{PythonVersion, SerializationFormat, Version}; pub struct Options { #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" # Allow minus-sign (U+2212), greek-small-letter-rho (U+03C1), and the asterisk-operator (U+2217), # which could be confused for "-", "p", and "*", respectively. @@ -33,7 +33,7 @@ pub struct Options { pub allowed_confusables: Option>, #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" builtins = ["_"] "# @@ -43,7 +43,7 @@ pub struct Options { pub builtins: Option>, #[option( default = ".ruff_cache", - value_type = "PathBuf", + value_type = "str", example = r#"cache-dir = "~/.cache/ruff""# )] /// A path to the cache directory. @@ -59,7 +59,7 @@ pub struct Options { pub cache_dir: Option, #[option( default = r#""^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$""#, - value_type = "Regex", + value_type = "re.Pattern", example = r#" # Only ignore variables named "_". dummy-variable-rgx = "^_$" @@ -71,7 +71,7 @@ pub struct Options { pub dummy_variable_rgx: Option, #[option( default = r#"[".bzr", ".direnv", ".eggs", ".git", ".hg", ".mypy_cache", ".nox", ".pants.d", ".ruff_cache", ".svn", ".tox", ".venv", "__pypackages__", "_build", "buck-out", "build", "dist", "node_modules", "venv"]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" exclude = [".venv"] "# @@ -95,7 +95,7 @@ pub struct Options { pub exclude: Option>, #[option( default = r#"None"#, - value_type = "Path", + value_type = "str", example = r#" # Extend the `pyproject.toml` file in the parent directory. extend = "../pyproject.toml" @@ -113,7 +113,7 @@ pub struct Options { pub extend: Option, #[option( default = "[]", - value_type = "Vec", + value_type = "list[str]", example = r#" # In addition to the standard set of exclusions, omit all tests, plus a specific file. extend-exclude = ["tests", "src/bad.py"] @@ -136,7 +136,7 @@ pub struct Options { pub extend_exclude: Option>, #[option( default = "[]", - value_type = "Vec", + value_type = "list[RuleSelector]", example = r#" # Skip unused variable rules (`F841`). extend-ignore = ["F841"] @@ -151,7 +151,7 @@ pub struct Options { pub extend_ignore: Option>, #[option( default = "[]", - value_type = "Vec", + value_type = "list[RuleSelector]", example = r#" # On top of the default `select` (`E`, `F`), enable flake8-bugbear (`B`) and flake8-quotes (`Q`). extend-select = ["B", "Q"] @@ -162,7 +162,7 @@ pub struct Options { pub extend_select: Option>, #[option( default = "[]", - value_type = "Vec", + value_type = "list[str]", example = r#" # Avoiding flagging (and removing) `V101` from any `# noqa` # directives, despite Ruff's lack of support for `vulture`. @@ -183,7 +183,7 @@ pub struct Options { pub fix_only: Option, #[option( default = r#"["A", "ANN", "ARG", "B", "BLE", "C", "COM", "D", "DTZ", "E", "EM", "ERA", "EXE", "F", "FBT", "G", "I", "ICN", "INP", "ISC", "N", "PD", "PGH", "PIE", "PL", "PT", "PTH", "Q", "RET", "RUF", "S", "SIM", "T", "TCH", "TID", "TRY", "UP", "W", "YTT"]"#, - value_type = "Vec", + value_type = "list[RuleSelector]", example = r#" # Only allow autofix behavior for `E` and `F` rules. fixable = ["E", "F"] @@ -194,7 +194,7 @@ pub struct Options { pub fixable: Option>, #[option( default = r#""text""#, - value_type = "SerializationType", + value_type = r#""text" | "json" | "junit" | "github" | "gitlab" | "pylint""#, example = r#" # Group violations by containing file. format = "grouped" @@ -226,7 +226,7 @@ pub struct Options { pub force_exclude: Option, #[option( default = "[]", - value_type = "Vec", + value_type = "list[RuleSelector]", example = r#" # Skip unused variable rules (`F841`). ignore = ["F841"] @@ -254,7 +254,7 @@ pub struct Options { pub ignore_init_module_imports: Option, #[option( default = "88", - value_type = "usize", + value_type = "int", example = r#" # Allow lines to be as long as 120 characters. line-length = 120 @@ -265,7 +265,7 @@ pub struct Options { pub line_length: Option, #[option( default = "None", - value_type = "String", + value_type = "str", example = r#" required-version = "0.0.193" "# @@ -287,7 +287,7 @@ pub struct Options { pub respect_gitignore: Option, #[option( default = r#"["E", "F"]"#, - value_type = "Vec", + value_type = "list[RuleSelector]", example = r#" # On top of the defaults (`E`, `F`), enable flake8-bugbear (`B`) and flake8-quotes (`Q`). select = ["E", "F", "B", "Q"] @@ -314,7 +314,7 @@ pub struct Options { pub show_source: Option, #[option( default = r#"["."]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" # Allow imports relative to the "src" and "test" directories. src = ["src", "test"] @@ -347,7 +347,7 @@ pub struct Options { pub src: Option>, #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#" namespace-packages = ["airflow/providers"] "# @@ -358,7 +358,7 @@ pub struct Options { pub namespace_packages: Option>, #[option( default = r#""py310""#, - value_type = "PythonVersion", + value_type = r#""py37" | "py38" | "py39" | "py310" | "py311""#, example = r#" # Always generate Python 3.7-compatible code. target-version = "py37" @@ -371,7 +371,7 @@ pub struct Options { pub target_version: Option, #[option( default = r#"["TODO", "FIXME", "XXX"]"#, - value_type = "Vec", + value_type = "list[str]", example = r#"task-tags = ["HACK"]"# )] /// A list of task tags to recognize (e.g., "TODO", "FIXME", "XXX"). @@ -382,7 +382,7 @@ pub struct Options { pub task_tags: Option>, #[option( default = r#"[]"#, - value_type = "Vec", + value_type = "list[str]", example = r#"typing-modules = ["airflow.typing_compat"]"# )] /// A list of modules whose imports should be treated equivalently to @@ -396,7 +396,7 @@ pub struct Options { pub typing_modules: Option>, #[option( default = "[]", - value_type = "Vec", + value_type = "list[RuleSelector]", example = r#" # Disable autofix for unused imports (`F401`). unfixable = ["F401"] @@ -472,7 +472,7 @@ pub struct Options { // Tables are required to go last. #[option( default = "{}", - value_type = "HashMap>", + value_type = "dict[str, list[RuleSelector]]", example = r#" # Ignore `E402` (import violations) in all `__init__.py` files, and in `path/to/file.py`. [tool.ruff.per-file-ignores]