Skip to content

False positive on R504 #3

@nijel

Description

@nijel
  • Date you used flake8-return: 2019-05-16
  • flake8-return version used, if any: 1.0.0
  • Python version, if any: 3.7.1
  • Operating System: Debian

Description

The R504 doesn't detect that the variable is conditionally modified prior to return.

What I Did

$ flake8 test.py 
test.py:5:12: R504 you shouldn`t assign value to variable if it will be use only as return value
$ cat test.py
def foo(bar):
    value = []
    if bar:
        value = value[:1]
    return value

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions