Skip to content

SIM103 should detect implicit else #10402

@charliermarsh

Description

@charliermarsh

See: https://github.com/sbdchd/flake8-pie#pie801-prefer-simple-return.

In that example:

# error
def main():
    if foo > 5:
        return True
    return False

# error
def main():
    if foo > 5:
        return True
    else:
        return False

# ok
def main():
    return foo > 5

We catch the second case, but not the first.

Metadata

Metadata

Labels

good first issueGood for newcomersruleImplementing or modifying a lint rule

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions