Skip to content

Commit 702d2fa

Browse files
Make B024 and B027 documentation more nuanced (#11341)
Closes #11334.
1 parent caf0147 commit 702d2fa

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

crates/ruff_linter/src/rules/flake8_bugbear/rules/abstract_base_class.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ use crate::registry::Rule;
1414
/// Checks for abstract classes without abstract methods.
1515
///
1616
/// ## Why is this bad?
17-
/// Abstract base classes are used to define interfaces. If they have no abstract
18-
/// methods, they are not useful.
17+
/// Abstract base classes are used to define interfaces. If an abstract base
18+
/// class has no abstract methods, you may have forgotten to add an abstract
19+
/// method to the class or omitted an `@abstractmethod` decorator.
1920
///
20-
/// If the class is not meant to be used as an interface, it should not be an
21-
/// abstract base class. Remove the `ABC` base class from the class definition,
22-
/// or add an abstract method to the class.
21+
/// If the class is _not_ meant to be used as an interface, consider removing
22+
/// the `ABC` base class from the class definition.
2323
///
2424
/// ## Example
2525
/// ```python
@@ -62,11 +62,9 @@ impl Violation for AbstractBaseClassWithoutAbstractMethod {
6262
/// decorator.
6363
///
6464
/// ## Why is this bad?
65-
/// Empty methods in abstract base classes without an abstract decorator are
66-
/// indicative of unfinished code or a mistake.
67-
///
68-
/// Instead, add an abstract method decorated to indicate that it is abstract,
69-
/// or implement the method.
65+
/// Empty methods in abstract base classes without an abstract decorator may be
66+
/// be indicative of a mistake. If the method is meant to be abstract, add an
67+
/// `@abstractmethod` decorator to the method.
7068
///
7169
/// ## Example
7270
/// ```python

0 commit comments

Comments
 (0)