From 2ada8b6634864b2777d419a2c5c67f170fab5736 Mon Sep 17 00:00:00 2001 From: Brent Westbrook <36778786+ntBre@users.noreply.github.com> Date: Tue, 30 Dec 2025 08:44:11 -0500 Subject: [PATCH] Document options for more rules (#22295) Summary -- This is a follow up to #22198 documenting more rule options I found while going through all of our rules. The second commit renames the internal `flake8_gettext::Settings::functions_names` field to `function_names` to match the external configuration option. I guess this is technically breaking because it's exposed to users via `--show-settings`, but I don't think we consider that part of our stable API. I can definitely revert that if needed, though. The other changes are just like #22198, adding new `## Options` sections to rules to document the settings they use. I missed these in the previous PR because they were used outside the rule implementations themselves. Most of these settings are checked where the rules' implementation functions are called instead. Oh, the last commit also updates the removal date for `typing.ByteString`, which got pushed back in the 3.14 release. I snuck that in today since I never opened this PR last week. I also fixed one reference link in RUF041. Test Plan -- Docs checks in CI --- ...ires_python_extend_from_shared_config.snap | 2 +- .../cli__lint__requires_python_no_tool.snap | 2 +- ...quires_python_no_tool_preview_enabled.snap | 2 +- ...ython_no_tool_target_version_override.snap | 2 +- ..._requires_python_pyproject_toml_above.snap | 2 +- ...python_pyproject_toml_above_with_tool.snap | 2 +- ...nt__requires_python_ruff_toml_above-2.snap | 2 +- ...lint__requires_python_ruff_toml_above.snap | 2 +- ...s_python_ruff_toml_no_target_fallback.snap | 2 +- ...ow_settings__display_default_settings.snap | 2 +- .../src/checkers/ast/analyze/expression.rs | 2 +- .../rules/f_string_in_gettext_func_call.rs | 4 +++ .../rules/format_in_gettext_func_call.rs | 4 +++ .../rules/printf_in_gettext_func_call.rs | 4 +++ .../src/rules/flake8_gettext/settings.rs | 6 ++-- .../rules/explicit.rs | 7 ++++ .../flake8_pyi/rules/bytestring_usage.rs | 2 +- .../pep8_naming/rules/invalid_module_name.rs | 4 +++ .../rules/pydoclint/rules/check_docstring.rs | 36 +++++++++++++++++++ .../src/rules/pydocstyle/rules/backslashes.rs | 4 +++ .../pydocstyle/rules/blank_after_summary.rs | 4 +++ .../rules/blank_before_after_function.rs | 8 +++++ .../src/rules/pydocstyle/rules/capitalized.rs | 4 +++ .../src/rules/pydocstyle/rules/if_needed.rs | 4 +++ .../src/rules/pydocstyle/rules/indent.rs | 12 +++++++ .../rules/newline_after_last_paragraph.rs | 4 +++ .../rules/no_surrounding_whitespace.rs | 4 +++ .../src/rules/pydocstyle/rules/not_empty.rs | 4 +++ .../src/rules/pydocstyle/rules/not_missing.rs | 16 +++++++++ .../src/rules/pydocstyle/rules/one_liner.rs | 4 +++ .../src/rules/pydocstyle/rules/sections.rs | 8 +++++ .../rules/pydocstyle/rules/triple_quotes.rs | 4 +++ .../pyupgrade/rules/non_pep646_unpack.rs | 4 +++ .../rules/pep695/non_pep695_generic_class.rs | 4 +++ .../pep695/non_pep695_generic_function.rs | 4 +++ .../rules/pep695/non_pep695_type_alias.rs | 4 +++ .../rules/pyupgrade/rules/replace_str_enum.rs | 4 +++ .../ruff/rules/unnecessary_nested_literal.rs | 2 +- crates/ruff_workspace/src/options.rs | 2 +- 39 files changed, 176 insertions(+), 17 deletions(-) diff --git a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_extend_from_shared_config.snap b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_extend_from_shared_config.snap index ce6ae89c1a..18e47274f8 100644 --- a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_extend_from_shared_config.snap +++ b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_extend_from_shared_config.snap @@ -125,7 +125,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-| linter.flake8_copyright.author = none linter.flake8_copyright.min_file_size = 0 linter.flake8_errmsg.max_string_length = 0 -linter.flake8_gettext.functions_names = [ +linter.flake8_gettext.function_names = [ _, gettext, ngettext, diff --git a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool.snap b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool.snap index a1236947bd..c4c3502fb7 100644 --- a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool.snap +++ b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool.snap @@ -127,7 +127,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-| linter.flake8_copyright.author = none linter.flake8_copyright.min_file_size = 0 linter.flake8_errmsg.max_string_length = 0 -linter.flake8_gettext.functions_names = [ +linter.flake8_gettext.function_names = [ _, gettext, ngettext, diff --git a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool_preview_enabled.snap b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool_preview_enabled.snap index 5868ceb04f..cb18b61d4d 100644 --- a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool_preview_enabled.snap +++ b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool_preview_enabled.snap @@ -129,7 +129,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-| linter.flake8_copyright.author = none linter.flake8_copyright.min_file_size = 0 linter.flake8_errmsg.max_string_length = 0 -linter.flake8_gettext.functions_names = [ +linter.flake8_gettext.function_names = [ _, gettext, ngettext, diff --git a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool_target_version_override.snap b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool_target_version_override.snap index 726abc733e..fa5f26f762 100644 --- a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool_target_version_override.snap +++ b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_no_tool_target_version_override.snap @@ -129,7 +129,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-| linter.flake8_copyright.author = none linter.flake8_copyright.min_file_size = 0 linter.flake8_errmsg.max_string_length = 0 -linter.flake8_gettext.functions_names = [ +linter.flake8_gettext.function_names = [ _, gettext, ngettext, diff --git a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_pyproject_toml_above.snap b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_pyproject_toml_above.snap index db8a289004..8db9b7a64e 100644 --- a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_pyproject_toml_above.snap +++ b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_pyproject_toml_above.snap @@ -126,7 +126,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-| linter.flake8_copyright.author = none linter.flake8_copyright.min_file_size = 0 linter.flake8_errmsg.max_string_length = 0 -linter.flake8_gettext.functions_names = [ +linter.flake8_gettext.function_names = [ _, gettext, ngettext, diff --git a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_pyproject_toml_above_with_tool.snap b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_pyproject_toml_above_with_tool.snap index 193aac85f3..e5e110fab2 100644 --- a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_pyproject_toml_above_with_tool.snap +++ b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_pyproject_toml_above_with_tool.snap @@ -126,7 +126,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-| linter.flake8_copyright.author = none linter.flake8_copyright.min_file_size = 0 linter.flake8_errmsg.max_string_length = 0 -linter.flake8_gettext.functions_names = [ +linter.flake8_gettext.function_names = [ _, gettext, ngettext, diff --git a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_above-2.snap b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_above-2.snap index e7914052c3..4c3acae10d 100644 --- a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_above-2.snap +++ b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_above-2.snap @@ -125,7 +125,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-| linter.flake8_copyright.author = none linter.flake8_copyright.min_file_size = 0 linter.flake8_errmsg.max_string_length = 0 -linter.flake8_gettext.functions_names = [ +linter.flake8_gettext.function_names = [ _, gettext, ngettext, diff --git a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_above.snap b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_above.snap index 76a57bae28..0cfa48e35c 100644 --- a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_above.snap +++ b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_above.snap @@ -125,7 +125,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-| linter.flake8_copyright.author = none linter.flake8_copyright.min_file_size = 0 linter.flake8_errmsg.max_string_length = 0 -linter.flake8_gettext.functions_names = [ +linter.flake8_gettext.function_names = [ _, gettext, ngettext, diff --git a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_no_target_fallback.snap b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_no_target_fallback.snap index ecdc9bfc62..1d4b6171a7 100644 --- a/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_no_target_fallback.snap +++ b/crates/ruff/tests/cli/snapshots/cli__lint__requires_python_ruff_toml_no_target_fallback.snap @@ -125,7 +125,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-| linter.flake8_copyright.author = none linter.flake8_copyright.min_file_size = 0 linter.flake8_errmsg.max_string_length = 0 -linter.flake8_gettext.functions_names = [ +linter.flake8_gettext.function_names = [ _, gettext, ngettext, diff --git a/crates/ruff/tests/snapshots/show_settings__display_default_settings.snap b/crates/ruff/tests/snapshots/show_settings__display_default_settings.snap index 94d6cbc603..2a7779d137 100644 --- a/crates/ruff/tests/snapshots/show_settings__display_default_settings.snap +++ b/crates/ruff/tests/snapshots/show_settings__display_default_settings.snap @@ -238,7 +238,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-| linter.flake8_copyright.author = none linter.flake8_copyright.min_file_size = 0 linter.flake8_errmsg.max_string_length = 0 -linter.flake8_gettext.functions_names = [ +linter.flake8_gettext.function_names = [ _, gettext, ngettext, diff --git a/crates/ruff_linter/src/checkers/ast/analyze/expression.rs b/crates/ruff_linter/src/checkers/ast/analyze/expression.rs index 0957aee346..841eec0241 100644 --- a/crates/ruff_linter/src/checkers/ast/analyze/expression.rs +++ b/crates/ruff_linter/src/checkers/ast/analyze/expression.rs @@ -1043,7 +1043,7 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) { ]) && flake8_gettext::is_gettext_func_call( checker, func, - &checker.settings().flake8_gettext.functions_names, + &checker.settings().flake8_gettext.function_names, ) { if checker.is_rule_enabled(Rule::FStringInGetTextFuncCall) { flake8_gettext::rules::f_string_in_gettext_func_call(checker, args); diff --git a/crates/ruff_linter/src/rules/flake8_gettext/rules/f_string_in_gettext_func_call.rs b/crates/ruff_linter/src/rules/flake8_gettext/rules/f_string_in_gettext_func_call.rs index 2cc9ca51a1..1c99929f08 100644 --- a/crates/ruff_linter/src/rules/flake8_gettext/rules/f_string_in_gettext_func_call.rs +++ b/crates/ruff_linter/src/rules/flake8_gettext/rules/f_string_in_gettext_func_call.rs @@ -38,6 +38,10 @@ use crate::checkers::ast::Checker; /// _("Hello, %s!") % name # Looks for "Hello, %s!". /// ``` /// +/// ## Options +/// +/// - `lint.flake8-gettext.function-names` +/// /// ## References /// - [Python documentation: `gettext` — Multilingual internationalization services](https://docs.python.org/3/library/gettext.html) #[derive(ViolationMetadata)] diff --git a/crates/ruff_linter/src/rules/flake8_gettext/rules/format_in_gettext_func_call.rs b/crates/ruff_linter/src/rules/flake8_gettext/rules/format_in_gettext_func_call.rs index ad584804d0..59e9d1b3d7 100644 --- a/crates/ruff_linter/src/rules/flake8_gettext/rules/format_in_gettext_func_call.rs +++ b/crates/ruff_linter/src/rules/flake8_gettext/rules/format_in_gettext_func_call.rs @@ -38,6 +38,10 @@ use crate::checkers::ast::Checker; /// _("Hello, %s!") % name # Looks for "Hello, %s!". /// ``` /// +/// ## Options +/// +/// - `lint.flake8-gettext.function-names` +/// /// ## References /// - [Python documentation: `gettext` — Multilingual internationalization services](https://docs.python.org/3/library/gettext.html) #[derive(ViolationMetadata)] diff --git a/crates/ruff_linter/src/rules/flake8_gettext/rules/printf_in_gettext_func_call.rs b/crates/ruff_linter/src/rules/flake8_gettext/rules/printf_in_gettext_func_call.rs index 22172a8005..a965559814 100644 --- a/crates/ruff_linter/src/rules/flake8_gettext/rules/printf_in_gettext_func_call.rs +++ b/crates/ruff_linter/src/rules/flake8_gettext/rules/printf_in_gettext_func_call.rs @@ -37,6 +37,10 @@ use crate::checkers::ast::Checker; /// _("Hello, %s!") % name # Looks for "Hello, %s!". /// ``` /// +/// ## Options +/// +/// - `lint.flake8-gettext.function-names` +/// /// ## References /// - [Python documentation: `gettext` — Multilingual internationalization services](https://docs.python.org/3/library/gettext.html) #[derive(ViolationMetadata)] diff --git a/crates/ruff_linter/src/rules/flake8_gettext/settings.rs b/crates/ruff_linter/src/rules/flake8_gettext/settings.rs index 491868ab99..1b3b5869ed 100644 --- a/crates/ruff_linter/src/rules/flake8_gettext/settings.rs +++ b/crates/ruff_linter/src/rules/flake8_gettext/settings.rs @@ -5,7 +5,7 @@ use std::fmt::{Display, Formatter}; #[derive(Debug, Clone, CacheKey)] pub struct Settings { - pub functions_names: Vec, + pub function_names: Vec, } pub fn default_func_names() -> Vec { @@ -19,7 +19,7 @@ pub fn default_func_names() -> Vec { impl Default for Settings { fn default() -> Self { Self { - functions_names: default_func_names(), + function_names: default_func_names(), } } } @@ -30,7 +30,7 @@ impl Display for Settings { formatter = f, namespace = "linter.flake8_gettext", fields = [ - self.functions_names | array + self.function_names | array ] } Ok(()) diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/rules/explicit.rs b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/rules/explicit.rs index e742b8922d..95aaa1af82 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/rules/explicit.rs +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/rules/explicit.rs @@ -32,6 +32,13 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// "dog" /// ) /// ``` +/// +/// ## Options +/// +/// Setting `lint.flake8-implicit-str-concat.allow-multiline = false` will disable this rule because +/// it would leave no allowed way to write a multi-line string. +/// +/// - `lint.flake8-implicit-str-concat.allow-multiline` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.201")] pub(crate) struct ExplicitStringConcatenation; diff --git a/crates/ruff_linter/src/rules/flake8_pyi/rules/bytestring_usage.rs b/crates/ruff_linter/src/rules/flake8_pyi/rules/bytestring_usage.rs index c87c669ab7..417b34fb9e 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/rules/bytestring_usage.rs +++ b/crates/ruff_linter/src/rules/flake8_pyi/rules/bytestring_usage.rs @@ -11,7 +11,7 @@ use crate::{FixAvailability, Violation}; /// /// ## Why is this bad? /// `ByteString` has been deprecated since Python 3.9 and will be removed in -/// Python 3.14. The Python documentation recommends using either +/// Python 3.17. The Python documentation recommends using either /// `collections.abc.Buffer` (or the `typing_extensions` backport /// on Python <3.12) or a union like `bytes | bytearray | memoryview` instead. /// diff --git a/crates/ruff_linter/src/rules/pep8_naming/rules/invalid_module_name.rs b/crates/ruff_linter/src/rules/pep8_naming/rules/invalid_module_name.rs index cbc9b54ae2..f19d3ccfc5 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/rules/invalid_module_name.rs +++ b/crates/ruff_linter/src/rules/pep8_naming/rules/invalid_module_name.rs @@ -36,6 +36,10 @@ use crate::rules::pep8_naming::settings::IgnoreNames; /// - Instead of `example-module-name` or `example module name`, use `example_module_name`. /// - Instead of `ExampleModule`, use `example_module`. /// +/// ## Options +/// +/// - `lint.pep8-naming.ignore-names` +/// /// [PEP 8]: https://peps.python.org/pep-0008/#package-and-module-names #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.248")] diff --git a/crates/ruff_linter/src/rules/pydoclint/rules/check_docstring.rs b/crates/ruff_linter/src/rules/pydoclint/rules/check_docstring.rs index 2f84e8501d..7771474a59 100644 --- a/crates/ruff_linter/src/rules/pydoclint/rules/check_docstring.rs +++ b/crates/ruff_linter/src/rules/pydoclint/rules/check_docstring.rs @@ -58,6 +58,11 @@ use crate::rules::pydocstyle::settings::Convention; /// """ /// return distance / time /// ``` +/// +/// ## Options +/// +/// - `lint.pydoclint.ignore-one-line-docstrings` +/// - `lint.pydocstyle.convention` #[derive(ViolationMetadata)] #[violation_metadata(preview_since = "0.14.1")] pub(crate) struct DocstringExtraneousParameter { @@ -113,6 +118,12 @@ impl Violation for DocstringExtraneousParameter { /// """ /// return distance / time /// ``` +/// +/// ## Options +/// +/// - `lint.pydoclint.ignore-one-line-docstrings` +/// - `lint.pydocstyle.convention` +/// - `lint.pydocstyle.property-decorators` #[derive(ViolationMetadata)] #[violation_metadata(preview_since = "0.5.6")] pub(crate) struct DocstringMissingReturns; @@ -165,6 +176,11 @@ impl Violation for DocstringMissingReturns { /// for _ in range(n): /// print("Hello!") /// ``` +/// +/// ## Options +/// +/// - `lint.pydoclint.ignore-one-line-docstrings` +/// - `lint.pydocstyle.convention` #[derive(ViolationMetadata)] #[violation_metadata(preview_since = "0.5.6")] pub(crate) struct DocstringExtraneousReturns; @@ -218,6 +234,11 @@ impl Violation for DocstringExtraneousReturns { /// for i in range(1, n + 1): /// yield i /// ``` +/// +/// ## Options +/// +/// - `lint.pydoclint.ignore-one-line-docstrings` +/// - `lint.pydocstyle.convention` #[derive(ViolationMetadata)] #[violation_metadata(preview_since = "0.5.7")] pub(crate) struct DocstringMissingYields; @@ -270,6 +291,11 @@ impl Violation for DocstringMissingYields { /// for _ in range(n): /// print("Hello!") /// ``` +/// +/// ## Options +/// +/// - `lint.pydoclint.ignore-one-line-docstrings` +/// - `lint.pydocstyle.convention` #[derive(ViolationMetadata)] #[violation_metadata(preview_since = "0.5.7")] pub(crate) struct DocstringExtraneousYields; @@ -342,6 +368,11 @@ impl Violation for DocstringExtraneousYields { /// except ZeroDivisionError as exc: /// raise FasterThanLightError from exc /// ``` +/// +/// ## Options +/// +/// - `lint.pydoclint.ignore-one-line-docstrings` +/// - `lint.pydocstyle.convention` #[derive(ViolationMetadata)] #[violation_metadata(preview_since = "0.5.5")] pub(crate) struct DocstringMissingException { @@ -410,6 +441,11 @@ impl Violation for DocstringMissingException { /// It may often be desirable to document *all* exceptions that a function /// could possibly raise, even those which are not explicitly raised using /// `raise` statements in the function body. +/// +/// ## Options +/// +/// - `lint.pydoclint.ignore-one-line-docstrings` +/// - `lint.pydocstyle.convention` #[derive(ViolationMetadata)] #[violation_metadata(preview_since = "0.5.5")] pub(crate) struct DocstringExtraneousException { diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/backslashes.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/backslashes.rs index e7fdf4f37b..f54ffe86a4 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/backslashes.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/backslashes.rs @@ -38,6 +38,10 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// foobar.__doc__ # "Docstring for foo\bar." /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [Python documentation: String and Bytes literals](https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals) diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/blank_after_summary.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/blank_after_summary.rs index 52e0282b6e..7978bde342 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/blank_after_summary.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/blank_after_summary.rs @@ -34,6 +34,10 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// """ /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/blank_before_after_function.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/blank_before_after_function.rs index 83efa3adc6..acbbd38af0 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/blank_before_after_function.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/blank_before_after_function.rs @@ -33,6 +33,10 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// """Return the mean of the given values.""" /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) @@ -80,6 +84,10 @@ impl Violation for BlankLineBeforeFunction { /// return sum(values) / len(values) /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/capitalized.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/capitalized.rs index 23faabc2ec..05319d9f30 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/capitalized.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/capitalized.rs @@ -25,6 +25,10 @@ use crate::{AlwaysFixableViolation, Edit, Fix}; /// """Return the mean of the given values.""" /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/if_needed.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/if_needed.rs index 7fb88ffc34..a7833c35a8 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/if_needed.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/if_needed.rs @@ -63,6 +63,10 @@ use crate::docstrings::Docstring; /// factorial.__doc__ # "Return the factorial of n." /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [Python documentation: `typing.overload`](https://docs.python.org/3/library/typing.html#typing.overload) diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/indent.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/indent.rs index ebb1c72cc9..d550447e84 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/indent.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/indent.rs @@ -44,6 +44,10 @@ use crate::{Edit, Fix}; /// The rule is also incompatible with the [formatter] when using /// `format.indent-style="tab"`. /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) @@ -93,6 +97,10 @@ impl Violation for DocstringTabIndentation { /// We recommend against using this rule alongside the [formatter]. The /// formatter enforces consistent indentation, making the rule redundant. /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) @@ -146,6 +154,10 @@ impl AlwaysFixableViolation for UnderIndentation { /// We recommend against using this rule alongside the [formatter]. The /// formatter enforces consistent indentation, making the rule redundant. /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/newline_after_last_paragraph.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/newline_after_last_paragraph.rs index 43c32de6c1..97617ed631 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/newline_after_last_paragraph.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/newline_after_last_paragraph.rs @@ -37,6 +37,10 @@ use crate::{AlwaysFixableViolation, Edit, Fix}; /// """ /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/no_surrounding_whitespace.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/no_surrounding_whitespace.rs index 4233f596ed..df2e736965 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/no_surrounding_whitespace.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/no_surrounding_whitespace.rs @@ -27,6 +27,10 @@ use crate::rules::pydocstyle::helpers::ends_with_backslash; /// """Return the factorial of n.""" /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/not_empty.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/not_empty.rs index a16e0a191d..84f2b7e659 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/not_empty.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/not_empty.rs @@ -24,6 +24,10 @@ use crate::docstrings::Docstring; /// """Return the mean of the given values.""" /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/not_missing.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/not_missing.rs index 24ed1e4856..60fb7b4504 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/not_missing.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/not_missing.rs @@ -55,6 +55,10 @@ use crate::checkers::ast::Checker; /// ## Notebook behavior /// This rule is ignored for Jupyter Notebooks. /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 287 – reStructuredText Docstring Format](https://peps.python.org/pep-0287/) @@ -139,6 +143,10 @@ impl Violation for UndocumentedPublicModule { /// self.points += points /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 287 – reStructuredText Docstring Format](https://peps.python.org/pep-0287/) @@ -366,6 +374,10 @@ impl Violation for UndocumentedPublicFunction { /// __all__ = ["player", "game"] /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 287 – reStructuredText Docstring Format](https://peps.python.org/pep-0287/) @@ -480,6 +492,10 @@ impl Violation for UndocumentedMagicMethod { /// bar.__doc__ # "Class Bar." /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 287 – reStructuredText Docstring Format](https://peps.python.org/pep-0287/) diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/one_liner.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/one_liner.rs index 3fe7e92bae..a0fcde567c 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/one_liner.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/one_liner.rs @@ -32,6 +32,10 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// documentation generators, or custom introspection utilities that rely on /// specific docstring formatting. /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/sections.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/sections.rs index bf84ea85fc..379bb2bfda 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/sections.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/sections.rs @@ -1066,6 +1066,10 @@ impl AlwaysFixableViolation for MissingBlankLineAfterLastSection { /// raise FasterThanLightError from exc /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 287 – reStructuredText Docstring Format](https://peps.python.org/pep-0287/) @@ -1317,6 +1321,10 @@ impl Violation for UndocumentedParam { /// raise FasterThanLightError from exc /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [PEP 287 – reStructuredText Docstring Format](https://peps.python.org/pep-0287/) diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs index 17dc5eac92..098e7ffcdb 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs @@ -31,6 +31,10 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// We recommend against using this rule alongside the [formatter]. The /// formatter enforces consistent quotes, making the rule redundant. /// +/// ## Options +/// +/// - `lint.pydocstyle.ignore-decorators` +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/non_pep646_unpack.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/non_pep646_unpack.rs index 36487d7926..2a539bb278 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/non_pep646_unpack.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/non_pep646_unpack.rs @@ -34,6 +34,10 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// different values when introspecting types at runtime. However, in most cases, /// the fix should be safe to apply. /// +/// ## Options +/// +/// - `target-version` +/// /// [PEP 646]: https://peps.python.org/pep-0646/ #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "0.10.0")] diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_class.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_class.rs index 02f8cdd1e8..a06fd90095 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_class.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_class.rs @@ -78,6 +78,10 @@ use super::{ /// This rule only applies to generic classes and does not include generic functions. See /// [`non-pep695-generic-function`][UP047] for the function version. /// +/// ## Options +/// +/// - `target-version` +/// /// [PEP 695]: https://peps.python.org/pep-0695/ /// [PEP 696]: https://peps.python.org/pep-0696/ /// [PYI018]: https://docs.astral.sh/ruff/rules/unused-private-type-var/ diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_function.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_function.rs index e59b3905ce..6c1edd5f2b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_function.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_function.rs @@ -71,6 +71,10 @@ use super::{DisplayTypeVars, TypeVarReferenceVisitor, check_type_vars, in_nested /// This rule only applies to generic functions and does not include generic classes. See /// [`non-pep695-generic-class`][UP046] for the class version. /// +/// ## Options +/// +/// - `target-version` +/// /// [PEP 695]: https://peps.python.org/pep-0695/ /// [PEP 696]: https://peps.python.org/pep-0696/ /// [PYI018]: https://docs.astral.sh/ruff/rules/unused-private-type-var/ diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_type_alias.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_type_alias.rs index 6b10c3bc07..f8f18c213e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_type_alias.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_type_alias.rs @@ -78,6 +78,10 @@ use super::{ /// new type parameters are restricted in scope to their associated aliases. See /// [`private-type-parameter`][UP049] for a rule to update these names. /// +/// ## Options +/// +/// - `target-version` +/// /// [PEP 695]: https://peps.python.org/pep-0695/ /// [PYI018]: https://docs.astral.sh/ruff/rules/unused-private-type-var/ /// [UP046]: https://docs.astral.sh/ruff/rules/non-pep695-generic-class/ diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/replace_str_enum.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/replace_str_enum.rs index 1adab1d52d..1d27a9482b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/replace_str_enum.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/replace_str_enum.rs @@ -72,6 +72,10 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// As such, migrating to `enum.StrEnum` will introduce a behavior change for /// code that relies on the Python 3.11 behavior. /// +/// ## Options +/// +/// - `target-version` +/// /// ## References /// - [enum.StrEnum](https://docs.python.org/3/library/enum.html#enum.StrEnum) /// diff --git a/crates/ruff_linter/src/rules/ruff/rules/unnecessary_nested_literal.rs b/crates/ruff_linter/src/rules/ruff/rules/unnecessary_nested_literal.rs index d8d3dd7151..696c05ac3b 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/unnecessary_nested_literal.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/unnecessary_nested_literal.rs @@ -57,7 +57,7 @@ use crate::{Applicability, Edit, Fix, FixAvailability, Violation}; /// ## References /// - [Typing documentation: Legal parameters for `Literal` at type check time](https://typing.python.org/en/latest/spec/literal.html#legal-parameters-for-literal-at-type-check-time) /// -/// [PEP 586](https://peps.python.org/pep-0586/) +/// [PEP 586]: https://peps.python.org/pep-0586/ #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "0.10.0")] pub(crate) struct UnnecessaryNestedLiteral; diff --git a/crates/ruff_workspace/src/options.rs b/crates/ruff_workspace/src/options.rs index 472b0e66f4..eaf557469e 100644 --- a/crates/ruff_workspace/src/options.rs +++ b/crates/ruff_workspace/src/options.rs @@ -1479,7 +1479,7 @@ pub struct Flake8GetTextOptions { impl Flake8GetTextOptions { pub fn into_settings(self) -> flake8_gettext::settings::Settings { flake8_gettext::settings::Settings { - functions_names: self + function_names: self .function_names .unwrap_or_else(flake8_gettext::settings::default_func_names) .into_iter()