diff --git a/crates/ruff_linter/src/rules/flake8_annotations/rules/definition.rs b/crates/ruff_linter/src/rules/flake8_annotations/rules/definition.rs index d111bbf525..b798c3ff80 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/rules/definition.rs +++ b/crates/ruff_linter/src/rules/flake8_annotations/rules/definition.rs @@ -351,6 +351,10 @@ impl Violation for MissingReturnTypePrivateFunction { /// def __init__(self, x: int) -> None: /// self.x = x /// ``` +/// +/// ## Options +/// +/// - `lint.flake8-annotations.mypy-init-return` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.105")] pub(crate) struct MissingReturnTypeSpecialMethod { @@ -399,6 +403,10 @@ impl Violation for MissingReturnTypeSpecialMethod { /// def bar() -> int: /// return 1 /// ``` +/// +/// ## Options +/// +/// - `lint.flake8-annotations.suppress-none-returning` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.105")] pub(crate) struct MissingReturnTypeStaticMethod { @@ -447,6 +455,10 @@ impl Violation for MissingReturnTypeStaticMethod { /// def bar(cls) -> int: /// return 1 /// ``` +/// +/// ## Options +/// +/// - `lint.flake8-annotations.suppress-none-returning` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.105")] pub(crate) struct MissingReturnTypeClassMethod { diff --git a/crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs b/crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs index 704b628abf..8e0992f0aa 100644 --- a/crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs +++ b/crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs @@ -58,6 +58,10 @@ use crate::checkers::ast::Checker; /// logging.exception("Something went wrong") /// ``` /// +/// ## Options +/// +/// - `lint.logger-objects` +/// /// ## References /// - [Python documentation: The `try` statement](https://docs.python.org/3/reference/compound_stmts.html#the-try-statement) /// - [Python documentation: Exception hierarchy](https://docs.python.org/3/library/exceptions.html#exception-hierarchy) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/rules/cached_instance_method.rs b/crates/ruff_linter/src/rules/flake8_bugbear/rules/cached_instance_method.rs index c059d9b5b9..024bafeb72 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/rules/cached_instance_method.rs +++ b/crates/ruff_linter/src/rules/flake8_bugbear/rules/cached_instance_method.rs @@ -58,6 +58,14 @@ use crate::checkers::ast::Checker; /// return square(self.value) /// ``` /// +/// ## Options +/// +/// This rule only applies to regular methods, not static or class methods. You can customize how +/// Ruff categorizes methods with the following options: +/// +/// - `lint.pep8-naming.classmethod-decorators` +/// - `lint.pep8-naming.staticmethod-decorators` +/// /// ## References /// - [Python documentation: `functools.lru_cache`](https://docs.python.org/3/library/functools.html#functools.lru_cache) /// - [Python documentation: `functools.cache`](https://docs.python.org/3/library/functools.html#functools.cache) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/rules/unused_loop_control_variable.rs b/crates/ruff_linter/src/rules/flake8_bugbear/rules/unused_loop_control_variable.rs index e530b5d794..e171879fa0 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/rules/unused_loop_control_variable.rs +++ b/crates/ruff_linter/src/rules/flake8_bugbear/rules/unused_loop_control_variable.rs @@ -32,6 +32,10 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// bar(i) /// ``` /// +/// ## Options +/// +/// - `lint.dummy-variable-rgx` +/// /// ## References /// - [PEP 8: Naming Conventions](https://peps.python.org/pep-0008/#naming-conventions) #[derive(ViolationMetadata)] diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/rules/string_in_exception.rs b/crates/ruff_linter/src/rules/flake8_errmsg/rules/string_in_exception.rs index 474ff585ea..000e3c256b 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/rules/string_in_exception.rs +++ b/crates/ruff_linter/src/rules/flake8_errmsg/rules/string_in_exception.rs @@ -47,6 +47,10 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// raise RuntimeError(msg) /// RuntimeError: 'Some value' is incorrect /// ``` +/// +/// ## Options +/// +/// - `lint.flake8-errmsg.max-string-length` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.183")] pub(crate) struct RawStringInException; diff --git a/crates/ruff_linter/src/rules/flake8_logging/rules/exc_info_outside_except_handler.rs b/crates/ruff_linter/src/rules/flake8_logging/rules/exc_info_outside_except_handler.rs index 7d18897708..37ef9786c8 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/rules/exc_info_outside_except_handler.rs +++ b/crates/ruff_linter/src/rules/flake8_logging/rules/exc_info_outside_except_handler.rs @@ -43,6 +43,10 @@ use crate::{Fix, FixAvailability, Violation}; /// /// ## Fix safety /// The fix is always marked as unsafe, as it changes runtime behavior. +/// +/// ## Options +/// +/// - `lint.logger-objects` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "0.12.0")] pub(crate) struct ExcInfoOutsideExceptHandler; diff --git a/crates/ruff_linter/src/rules/flake8_logging/rules/exception_without_exc_info.rs b/crates/ruff_linter/src/rules/flake8_logging/rules/exception_without_exc_info.rs index 8d5c954277..425c1040bb 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/rules/exception_without_exc_info.rs +++ b/crates/ruff_linter/src/rules/flake8_logging/rules/exception_without_exc_info.rs @@ -30,6 +30,10 @@ use crate::checkers::ast::Checker; /// ```python /// logging.error("...") /// ``` +/// +/// ## Options +/// +/// - `lint.logger-objects` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.2.0")] pub(crate) struct ExceptionWithoutExcInfo; diff --git a/crates/ruff_linter/src/rules/flake8_logging/rules/log_exception_outside_except_handler.rs b/crates/ruff_linter/src/rules/flake8_logging/rules/log_exception_outside_except_handler.rs index 4f2b852a2b..cc91834aa3 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/rules/log_exception_outside_except_handler.rs +++ b/crates/ruff_linter/src/rules/flake8_logging/rules/log_exception_outside_except_handler.rs @@ -42,6 +42,10 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// ## Fix safety /// The fix, if available, will always be marked as unsafe, as it changes runtime behavior. /// +/// ## Options +/// +/// - `lint.logger-objects` +/// /// [The documentation]: https://docs.python.org/3/library/logging.html#logging.exception #[derive(ViolationMetadata)] #[violation_metadata(preview_since = "0.9.5")] diff --git a/crates/ruff_linter/src/rules/flake8_quotes/rules/avoidable_escaped_quote.rs b/crates/ruff_linter/src/rules/flake8_quotes/rules/avoidable_escaped_quote.rs index 59dfdf857e..07e47c1f83 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/rules/avoidable_escaped_quote.rs +++ b/crates/ruff_linter/src/rules/flake8_quotes/rules/avoidable_escaped_quote.rs @@ -32,6 +32,10 @@ use crate::{AlwaysFixableViolation, Edit, Fix}; /// formatter automatically removes unnecessary escapes, making the rule /// redundant. /// +/// ## Options +/// +/// - `lint.flake8-quotes.inline-quotes` +/// /// [formatter]: https://docs.astral.sh/ruff/formatter #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.88")] diff --git a/crates/ruff_linter/src/rules/flake8_return/rules/function.rs b/crates/ruff_linter/src/rules/flake8_return/rules/function.rs index 448cbd51a7..9db7dc3a4e 100644 --- a/crates/ruff_linter/src/rules/flake8_return/rules/function.rs +++ b/crates/ruff_linter/src/rules/flake8_return/rules/function.rs @@ -55,6 +55,12 @@ use crate::rules::flake8_return::visitor::{ReturnVisitor, Stack}; /// ## Fix safety /// This rule's fix is marked as unsafe for cases in which comments would be /// dropped from the `return` statement. +/// +/// ## Options +/// +/// This rule ignores functions marked as properties. +/// +/// - `lint.pydocstyle.property-decorators` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.154")] pub(crate) struct UnnecessaryReturnNone; diff --git a/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_with.rs b/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_with.rs index c115122453..0acb66b45e 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_with.rs +++ b/crates/ruff_linter/src/rules/flake8_simplify/rules/ast_with.rs @@ -44,6 +44,15 @@ use crate::{FixAvailability, Violation}; /// pass /// ``` /// +/// ## Options +/// +/// The rule will consult these two settings when deciding if a fix can be provided: +/// +/// - `lint.pycodestyle.max-line-length` +/// - `indent-width` +/// +/// Lines that would exceed the configured line length will not be fixed automatically. +/// /// ## References /// - [Python documentation: The `with` statement](https://docs.python.org/3/reference/compound_stmts.html#the-with-statement) #[derive(ViolationMetadata)] diff --git a/crates/ruff_linter/src/rules/flake8_simplify/rules/collapsible_if.rs b/crates/ruff_linter/src/rules/flake8_simplify/rules/collapsible_if.rs index f0d726cc52..89971175eb 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/rules/collapsible_if.rs +++ b/crates/ruff_linter/src/rules/flake8_simplify/rules/collapsible_if.rs @@ -42,6 +42,15 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// ... /// ``` /// +/// ## Options +/// +/// The rule will consult these two settings when deciding if a fix can be provided: +/// +/// - `lint.pycodestyle.max-line-length` +/// - `indent-width` +/// +/// Lines that would exceed the configured line length will not be fixed automatically. +/// /// ## References /// - [Python documentation: The `if` statement](https://docs.python.org/3/reference/compound_stmts.html#the-if-statement) /// - [Python documentation: Boolean operations](https://docs.python.org/3/reference/expressions.html#boolean-operations) diff --git a/crates/ruff_linter/src/rules/flake8_simplify/rules/if_else_block_instead_of_dict_get.rs b/crates/ruff_linter/src/rules/flake8_simplify/rules/if_else_block_instead_of_dict_get.rs index 91f837647f..424f53b075 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/rules/if_else_block_instead_of_dict_get.rs +++ b/crates/ruff_linter/src/rules/flake8_simplify/rules/if_else_block_instead_of_dict_get.rs @@ -50,6 +50,14 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// value = foo.get("bar", 0) /// ``` /// +/// ## Options +/// +/// The rule will avoid flagging cases where using the resulting `dict.get` call would exceed the +/// configured line length, as determined by these options: +/// +/// - `lint.pycodestyle.max-line-length` +/// - `indent-width` +/// /// ## References /// - [Python documentation: Mapping Types](https://docs.python.org/3/library/stdtypes.html#mapping-types-dict) #[derive(ViolationMetadata)] diff --git a/crates/ruff_linter/src/rules/flake8_simplify/rules/if_else_block_instead_of_if_exp.rs b/crates/ruff_linter/src/rules/flake8_simplify/rules/if_else_block_instead_of_if_exp.rs index f69098f697..adbc9b4055 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/rules/if_else_block_instead_of_if_exp.rs +++ b/crates/ruff_linter/src/rules/flake8_simplify/rules/if_else_block_instead_of_if_exp.rs @@ -55,6 +55,11 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// Ternary operators can also make it harder to measure [code coverage] /// with tools that use line profiling. /// +/// ## Options +/// +/// - `lint.pycodestyle.max-line-length` +/// - `indent-width` +/// /// ## References /// - [Python documentation: Conditional expressions](https://docs.python.org/3/reference/expressions.html#conditional-expressions) /// diff --git a/crates/ruff_linter/src/rules/flake8_simplify/rules/reimplemented_builtin.rs b/crates/ruff_linter/src/rules/flake8_simplify/rules/reimplemented_builtin.rs index 4c858fb799..581c8772f1 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/rules/reimplemented_builtin.rs +++ b/crates/ruff_linter/src/rules/flake8_simplify/rules/reimplemented_builtin.rs @@ -40,6 +40,14 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// /// This fix is always marked as unsafe because it might remove comments. /// +/// ## Options +/// +/// The rule will avoid flagging cases where using the builtin function would exceed the configured +/// line length, as determined by these options: +/// +/// - `lint.pycodestyle.max-line-length` +/// - `indent-width` +/// /// ## References /// - [Python documentation: `any`](https://docs.python.org/3/library/functions.html#any) /// - [Python documentation: `all`](https://docs.python.org/3/library/functions.html#all) diff --git a/crates/ruff_linter/src/rules/pyflakes/rules/redefined_while_unused.rs b/crates/ruff_linter/src/rules/pyflakes/rules/redefined_while_unused.rs index 01439bc764..09dd2d460e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/rules/redefined_while_unused.rs +++ b/crates/ruff_linter/src/rules/pyflakes/rules/redefined_while_unused.rs @@ -30,6 +30,12 @@ use rustc_hash::FxHashMap; /// import foo /// import bar /// ``` +/// +/// ## Options +/// +/// This rule ignores dummy variables, as determined by: +/// +/// - `lint.dummy-variable-rgx` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.171")] pub(crate) struct RedefinedWhileUnused { diff --git a/crates/ruff_linter/src/rules/pyflakes/rules/unused_annotation.rs b/crates/ruff_linter/src/rules/pyflakes/rules/unused_annotation.rs index 98692373bf..f432a01ba4 100644 --- a/crates/ruff_linter/src/rules/pyflakes/rules/unused_annotation.rs +++ b/crates/ruff_linter/src/rules/pyflakes/rules/unused_annotation.rs @@ -18,6 +18,12 @@ use crate::checkers::ast::Checker; /// bar: int /// ``` /// +/// ## Options +/// +/// This rule ignores dummy variables, as determined by: +/// +/// - `lint.dummy-variable-rgx` +/// /// ## References /// - [PEP 484 – Type Hints](https://peps.python.org/pep-0484/) #[derive(ViolationMetadata)] diff --git a/crates/ruff_linter/src/rules/pylint/rules/bad_staticmethod_argument.rs b/crates/ruff_linter/src/rules/pylint/rules/bad_staticmethod_argument.rs index bc488411fd..917203db0d 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/bad_staticmethod_argument.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/bad_staticmethod_argument.rs @@ -35,6 +35,11 @@ use crate::checkers::ast::Checker; /// pass /// ``` /// +/// ## Options +/// +/// - `lint.pep8-naming.classmethod-decorators` +/// - `lint.pep8-naming.staticmethod-decorators` +/// /// [PEP 8]: https://peps.python.org/pep-0008/#function-and-method-arguments #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "0.6.0")] diff --git a/crates/ruff_linter/src/rules/pylint/rules/logging.rs b/crates/ruff_linter/src/rules/pylint/rules/logging.rs index b126b85f77..12f6ed6f4b 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/logging.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/logging.rs @@ -36,6 +36,10 @@ use crate::rules::pyflakes::cformat::CFormatSummary; /// logging.error("%s error occurred: %s", type(e), e) /// raise /// ``` +/// +/// ## Options +/// +/// - `lint.logger-objects` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.252")] pub(crate) struct LoggingTooFewArgs; @@ -74,6 +78,10 @@ impl Violation for LoggingTooFewArgs { /// logging.error("%s error occurred: %s", type(e), e) /// raise /// ``` +/// +/// ## Options +/// +/// - `lint.logger-objects` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.252")] pub(crate) struct LoggingTooManyArgs; diff --git a/crates/ruff_linter/src/rules/pylint/rules/manual_import_from.rs b/crates/ruff_linter/src/rules/pylint/rules/manual_import_from.rs index c0aab3657b..4a4af16837 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/manual_import_from.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/manual_import_from.rs @@ -24,6 +24,12 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// from concurrent import futures /// ``` /// +/// ## Options +/// +/// This rule will not trigger on imports required by the `isort` configuration. +/// +/// - `lint.isort.required-imports` +/// /// ## References /// - [Python documentation: Submodules](https://docs.python.org/3/reference/import.html#submodules) #[derive(ViolationMetadata)] diff --git a/crates/ruff_linter/src/rules/pylint/rules/no_self_use.rs b/crates/ruff_linter/src/rules/pylint/rules/no_self_use.rs index c6a2fe9d0d..e814fb502c 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/no_self_use.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/no_self_use.rs @@ -49,6 +49,13 @@ use crate::rules::flake8_unused_arguments::rules::is_not_implemented_stub_with_v /// print("Greetings friend!") /// ``` /// +/// ## Options +/// +/// The rule will not trigger on methods that are already marked as static or class methods. +/// +/// - `lint.pep8-naming.classmethod-decorators` +/// - `lint.pep8-naming.staticmethod-decorators` +/// /// [override]: https://docs.python.org/3/library/typing.html#typing.override #[derive(ViolationMetadata)] #[violation_metadata(preview_since = "v0.0.286")] diff --git a/crates/ruff_linter/src/rules/pylint/rules/property_with_parameters.rs b/crates/ruff_linter/src/rules/pylint/rules/property_with_parameters.rs index 9c77508943..07058b56c0 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/property_with_parameters.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/property_with_parameters.rs @@ -32,6 +32,10 @@ use crate::checkers::ast::Checker; /// def purr_volume(self, volume): ... /// ``` /// +/// ## Options +/// +/// - `lint.pydocstyle.property-decorators` +/// /// ## References /// - [Python documentation: `property`](https://docs.python.org/3/library/functions.html#property) #[derive(ViolationMetadata)] diff --git a/crates/ruff_linter/src/rules/pylint/rules/redeclared_assigned_name.rs b/crates/ruff_linter/src/rules/pylint/rules/redeclared_assigned_name.rs index aeac5463d3..dc42cc1b4d 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/redeclared_assigned_name.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/redeclared_assigned_name.rs @@ -27,6 +27,12 @@ use crate::checkers::ast::Checker; /// _, b, a = (1, 2, 3) /// print(a) # 3 /// ``` +/// +/// ## Options +/// +/// The rule ignores assignments to dummy variables, as specified by: +/// +/// - `lint.dummy-variable-rgx` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "0.5.0")] pub(crate) struct RedeclaredAssignedName { diff --git a/crates/ruff_linter/src/rules/pylint/rules/redefined_loop_name.rs b/crates/ruff_linter/src/rules/pylint/rules/redefined_loop_name.rs index 3abd675316..b77f07f2a2 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/redefined_loop_name.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/redefined_loop_name.rs @@ -48,6 +48,12 @@ use crate::checkers::ast::Checker; /// f = path2.open() /// print(f.readline()) # prints a line from path2 /// ``` +/// +/// ## Options +/// +/// The rule ignores assignments to dummy variables, as specified by: +/// +/// - `lint.dummy-variable-rgx` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.252")] pub(crate) struct RedefinedLoopName { diff --git a/crates/ruff_linter/src/rules/pylint/rules/self_or_cls_assignment.rs b/crates/ruff_linter/src/rules/pylint/rules/self_or_cls_assignment.rs index e5c90407e1..81e11d408b 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/self_or_cls_assignment.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/self_or_cls_assignment.rs @@ -45,6 +45,11 @@ use crate::checkers::ast::Checker; /// supercls = cls.__mro__[-1] /// return supercls /// ``` +/// +/// ## Options +/// +/// - `lint.pep8-naming.classmethod-decorators` +/// - `lint.pep8-naming.staticmethod-decorators` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "0.6.0")] pub(crate) struct SelfOrClsAssignment { diff --git a/crates/ruff_linter/src/rules/pylint/rules/singledispatch_method.rs b/crates/ruff_linter/src/rules/pylint/rules/singledispatch_method.rs index 9096a22dc8..d1562c89b5 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/singledispatch_method.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/singledispatch_method.rs @@ -42,6 +42,14 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// ## Fix safety /// This rule's fix is marked as unsafe, as migrating from `@singledispatch` to /// `@singledispatchmethod` may change the behavior of the code. +/// +/// ## Options +/// +/// This rule applies to regular, static, and class methods. You can customize how Ruff categorizes +/// methods with the following options: +/// +/// - `lint.pep8-naming.classmethod-decorators` +/// - `lint.pep8-naming.staticmethod-decorators` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "0.6.0")] pub(crate) struct SingledispatchMethod; diff --git a/crates/ruff_linter/src/rules/pylint/rules/super_without_brackets.rs b/crates/ruff_linter/src/rules/pylint/rules/super_without_brackets.rs index 5791ee77ff..4c319b149a 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/super_without_brackets.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/super_without_brackets.rs @@ -46,6 +46,14 @@ use crate::{AlwaysFixableViolation, Edit, Fix}; /// original_speak = super().speak() # Correct: `super().speak()` /// return f"{original_speak} But as a dog, it barks!" /// ``` +/// +/// ## Options +/// +/// This rule applies to regular, static, and class methods. You can customize how Ruff categorizes +/// methods with the following options: +/// +/// - `lint.pep8-naming.classmethod-decorators` +/// - `lint.pep8-naming.staticmethod-decorators` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "0.5.0")] pub(crate) struct SuperWithoutBrackets; diff --git a/crates/ruff_linter/src/rules/pylint/rules/useless_import_alias.rs b/crates/ruff_linter/src/rules/pylint/rules/useless_import_alias.rs index 63f53fe8fb..118dbb880e 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/useless_import_alias.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/useless_import_alias.rs @@ -33,6 +33,13 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// ```python /// import numpy /// ``` +/// +/// ## Options +/// +/// The rule will emit a diagnostic but not a fix if the import is required by the `isort` +/// configuration option: +/// +/// - `lint.isort.required-imports` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.156")] pub(crate) struct UselessImportAlias { diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_mock_import.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_mock_import.rs index 5c13bbd07f..262a825eed 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_mock_import.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_mock_import.rs @@ -45,6 +45,12 @@ pub(crate) enum MockReference { /// from unittest import mock /// ``` /// +/// ## Options +/// +/// This rule will not trigger if the `mock` import is required by the `isort` configuration. +/// +/// - `lint.isort.required-imports` +/// /// ## References /// - [Python documentation: `unittest.mock`](https://docs.python.org/3/library/unittest.mock.html) /// - [PyPI: `mock`](https://pypi.org/project/mock/) diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_builtin_import.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_builtin_import.rs index f15b2dfeb3..213f15d3dc 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_builtin_import.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_builtin_import.rs @@ -43,6 +43,12 @@ use crate::{AlwaysFixableViolation, Fix}; /// str(1) # `"1"` with the import, `1` without /// ``` /// +/// ## Options +/// +/// This rule will not trigger on imports required by the `isort` configuration. +/// +/// - `lint.isort.required-imports` +/// /// ## References /// - [Python documentation: The Python Standard Library](https://docs.python.org/3/library/index.html) #[derive(ViolationMetadata)] diff --git a/crates/ruff_linter/src/rules/ruff/rules/missing_fstring_syntax.rs b/crates/ruff_linter/src/rules/ruff/rules/missing_fstring_syntax.rs index 229abff0d7..07d0dff8f2 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/missing_fstring_syntax.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/missing_fstring_syntax.rs @@ -58,6 +58,10 @@ use crate::{AlwaysFixableViolation, Edit, Fix}; /// This fix will always change the behavior of the program and, despite the precautions detailed /// above, this may be undesired. As such the fix is always marked as unsafe. /// +/// ## Options +/// +/// - `lint.logger-objects` +/// /// [logging]: https://docs.python.org/3/howto/logging-cookbook.html#using-particular-formatting-styles-throughout-your-application /// [gettext]: https://docs.python.org/3/library/gettext.html /// [FastAPI path]: https://fastapi.tiangolo.com/tutorial/path-params/ diff --git a/crates/ruff_linter/src/rules/tryceratops/rules/error_instead_of_exception.rs b/crates/ruff_linter/src/rules/tryceratops/rules/error_instead_of_exception.rs index 289c318fd6..891bcb342c 100644 --- a/crates/ruff_linter/src/rules/tryceratops/rules/error_instead_of_exception.rs +++ b/crates/ruff_linter/src/rules/tryceratops/rules/error_instead_of_exception.rs @@ -49,6 +49,10 @@ use crate::{Applicability, Edit, Fix, FixAvailability, Violation}; /// `logger.error`), since the rule is prone to false positives when detecting /// logger-like calls outside of the `logging` module. /// +/// ## Options +/// +/// - `lint.logger-objects` +/// /// ## References /// - [Python documentation: `logging.exception`](https://docs.python.org/3/library/logging.html#logging.exception) #[derive(ViolationMetadata)] diff --git a/crates/ruff_linter/src/rules/tryceratops/rules/verbose_log_message.rs b/crates/ruff_linter/src/rules/tryceratops/rules/verbose_log_message.rs index 1c107065f4..56011d3812 100644 --- a/crates/ruff_linter/src/rules/tryceratops/rules/verbose_log_message.rs +++ b/crates/ruff_linter/src/rules/tryceratops/rules/verbose_log_message.rs @@ -33,6 +33,10 @@ use crate::rules::tryceratops::helpers::LoggerCandidateVisitor; /// except ValueError: /// logger.exception("Found an error") /// ``` +/// +/// ## Options +/// +/// - `lint.logger-objects` #[derive(ViolationMetadata)] #[violation_metadata(stable_since = "v0.0.250")] pub(crate) struct VerboseLogMessage;