From 702d2fa1eb93009a662d33f5805fc12ddac69b4f Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 8 May 2024 11:16:58 -0400 Subject: [PATCH] Make B024 and B027 documentation more nuanced (#11341) Closes https://github.com/astral-sh/ruff/issues/11334. --- .../rules/abstract_base_class.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/rules/abstract_base_class.rs b/crates/ruff_linter/src/rules/flake8_bugbear/rules/abstract_base_class.rs index edb47aa5aa..a927703d97 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/rules/abstract_base_class.rs +++ b/crates/ruff_linter/src/rules/flake8_bugbear/rules/abstract_base_class.rs @@ -14,12 +14,12 @@ use crate::registry::Rule; /// Checks for abstract classes without abstract methods. /// /// ## Why is this bad? -/// Abstract base classes are used to define interfaces. If they have no abstract -/// methods, they are not useful. +/// Abstract base classes are used to define interfaces. If an abstract base +/// class has no abstract methods, you may have forgotten to add an abstract +/// method to the class or omitted an `@abstractmethod` decorator. /// -/// If the class is not meant to be used as an interface, it should not be an -/// abstract base class. Remove the `ABC` base class from the class definition, -/// or add an abstract method to the class. +/// If the class is _not_ meant to be used as an interface, consider removing +/// the `ABC` base class from the class definition. /// /// ## Example /// ```python @@ -62,11 +62,9 @@ impl Violation for AbstractBaseClassWithoutAbstractMethod { /// decorator. /// /// ## Why is this bad? -/// Empty methods in abstract base classes without an abstract decorator are -/// indicative of unfinished code or a mistake. -/// -/// Instead, add an abstract method decorated to indicate that it is abstract, -/// or implement the method. +/// Empty methods in abstract base classes without an abstract decorator may be +/// be indicative of a mistake. If the method is meant to be abstract, add an +/// `@abstractmethod` decorator to the method. /// /// ## Example /// ```python