-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hi,
really love ruff, such a great tool! It also inspired me to learn Rust ;)
I found the following bug, which can be reproduced with this MWE:
def no_redef(value):
if value:
def fun(x, y):
return x
else:
def fun(x, y):
return y
return fun
def redef(value):
match value:
case True:
def fun(x, y):
return x
case False:
def fun(x, y):
return y
return funRunning ruff throws the following error which (IMO) is a bug:
> ruff redef.py --isolated
redef.py:24:17: F811 Redefinition of unused `fun` from line 19
Found 1 error.Why is this a bug?
In my understanding both the no_redef and redef function have the same behavior. Thus, F811 should behave the same for both functions, which is not the case.
This behavior is consistent with flake8/pyflakes, however, I think this is a bug in their code as well and I opened a ticket there too (PyCQA/pyflakes#771).
Ruff version
> ruff --version
ruff 0.0.261pyproject.toml
[tool.ruff]
select = ["F"]
target-version = "py38"Constantin
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working