ruff/crates/ruff_linter/resources/test/fixtures/pep8_naming/N803.py
InSync 82cb8675dd
[pep8-naming] Ignore @override methods (N803) (#15954)
## Summary

Resolves #15925.

`N803` now checks for functions instead of parameters. In preview mode,
if a method is decorated with `@override` and the current scope is that
of a class, it will be ignored.

## Test Plan

`cargo nextest run` and `cargo insta test`.
2025-02-05 09:35:57 +01:00

29 lines
428 B
Python

def func(_, a, A):
return _, a, A
class Class:
def method(self, _, a, A):
return _, a, A
def func(_, setUp):
return _, setUp
from typing import override
class Extended(Class):
@override
def method(self, _, a, A): ...
@override # Incorrect usage
def func(_, a, A): ...
func = lambda _, a, A: ...
class Extended(Class):
method = override(lambda self, _, a, A: ...) # Incorrect usage