mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
[flake8-bugbear
] Implement class-as-data-structure
(B903
) (#9601)
## Summary Adds `class-as-data-structure` rule (`B903`). Also compare pylint's `too-few-public-methods` (`PLR0903`). Took some creative liberty with this by allowing the class to have any decorators or base classes. There are years-old issues on pylint that don't approve of the strictness when it comes to these things. Especially considering that dataclass is a decorator and namedtuple _can be_ a base class. I feel ignoring those explicitly is redundant all things considered, but it's not a hill I'm willing to die on! See: #970 ## Test Plan `cargo test` --------- Co-authored-by: Micha Reiser <micha@reiser.io> Co-authored-by: dylwil3 <dylwil3@gmail.com>
This commit is contained in:
parent
e7248ee43e
commit
78e26cec02
9 changed files with 305 additions and 1 deletions
|
@ -1571,7 +1571,7 @@ mod tests {
|
|||
const PREVIEW_RULES: &[Rule] = &[
|
||||
Rule::ReimplementedStarmap,
|
||||
Rule::SliceCopy,
|
||||
Rule::TooManyPublicMethods,
|
||||
Rule::ClassAsDataStructure,
|
||||
Rule::TooManyPublicMethods,
|
||||
Rule::UnnecessaryEnumerate,
|
||||
Rule::MathConstant,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue