mirror of https://github.com/astral-sh/ruff
[`refurb`] Ignore decorated functions for `FURB118` (#19339)
## Summary Fixes #19305
This commit is contained in:
parent
53e9e4421c
commit
3e366fdf13
|
|
@ -143,3 +143,23 @@ class NotAMethodButHardToDetect:
|
|||
# without risking false positives elsewhere or introducing complex heuristics
|
||||
# that users would find surprising and confusing
|
||||
FOO = sorted([x for x in BAR], key=lambda x: x.baz)
|
||||
|
||||
# https://github.com/astral-sh/ruff/issues/19305
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def my_fixture_with_param(request):
|
||||
return request.param
|
||||
|
||||
@pytest.fixture()
|
||||
def my_fixture_with_param2(request):
|
||||
return request.param
|
||||
|
||||
|
||||
# Decorated function (should be ignored)
|
||||
def custom_decorator(func):
|
||||
return func
|
||||
|
||||
@custom_decorator
|
||||
def add(x, y):
|
||||
return x + y
|
||||
|
|
|
|||
|
|
@ -104,6 +104,13 @@ pub(crate) fn reimplemented_operator(checker: &Checker, target: &FunctionLike) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Skip decorated functions
|
||||
if let FunctionLike::Function(func) = target {
|
||||
if !func.decorator_list.is_empty() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let Some(params) = target.parameters() else {
|
||||
return;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue