ruff
b6b4ad99 - [red-knot] @override lint rule (#11282)

Commit
1 year ago
[red-knot] @override lint rule (#11282) ## Summary Lots of TODOs and things to clean up here, but it demonstrates the working lint rule. ## Test Plan ``` ➜ cat main.py from typing import override from base import B class C(B): @override def method(self): pass ➜ cat base.py class B: pass ➜ cat typing.py def override(func): return func ``` (We provide our own `typing.py` since we don't have typeshed vendored or type stub support yet.) ``` ➜ ./target/debug/red_knot main.py ... 1 0.012086s TRACE red_knot Main Loop: Tick [crates/red_knot/src/main.rs:157:21] diagnostics = [ "Method C.method is decorated with `typing.override` but does not override any base class method", ] ``` If we add `def method(self): pass` to class `B` in `base.py` and run red_knot again, there is no lint error. --------- Co-authored-by: Micha Reiser <micha@reiser.io>
Author
Parents
Loading