[pylint] - implement R0202 and R0203 with autofixes#8335
[pylint] - implement R0202 and R0203 with autofixes#8335zanieb merged 2 commits intoastral-sh:mainfrom
Conversation
603e274 to
33803fa
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
|
||
| let mut diagnostic = Diagnostic::new( | ||
| diagnostic_type.clone(), | ||
| TextRange::new(stmt.range().start(), stmt.range().start()), |
There was a problem hiding this comment.
I don't really know what range we should highlight with the diagnostic, please advise!
| use crate::checkers::ast::Checker; | ||
|
|
||
| /// ## What it does | ||
| /// Checks for the use of a classmethod being made without the decorator. |
There was a problem hiding this comment.
It would be nice to add some examples here. Personally I don't even know how you define a classmethod without a decorator. 😊
(just a random observer here who's interested in new Pylint rules, thanks for working on this!)
There was a problem hiding this comment.
Ah, my mistake!
|
I've also had the idea that this could very easily work for And making it a new RUF rule would mean moving some code around to make this reusable between rules, all ears for ideas there. |
|
Thanks for the contribution! I wonder if people are actually writing class/staticmethods like this still? Would you mind updating with |
7755784 to
41c13a3
Compare
41c13a3 to
f16096e
Compare
|
Summary
Implements
no-classmethod-decorator/R0202andno-staticmethod-decorator/R0203with autofixes.They're similar enough that all code is reusable for both.
See: #970
Test Plan
cargo test