Rule for missing PEP 698 @override
decorators?
#6844
Labels
python312
Related to Python 3.12
rule
Implementing or modifying a lint rule
type-inference
Requires more advanced type inference.
An idea for a new rule: checking that methods in subclasses that override methods from the parent are decorated with
@override
.This decorator is defined in PEP 698 and is meant to help both linters and developpers to recognize methods that are overriding methods from a parent class.
Example:
A rule would detect that the
@override
decorator is missing onB.foo()
since it overridesA.foo()
.Note that until python 3.12,
override
is only available fromtyping-extensions
.The text was updated successfully, but these errors were encountered: