Skip to content

False positive for simplifiable-if-statement when the boolean values are not the same #1984

@PCManticore

Description

@PCManticore

Steps to reproduce

  1. Save the following in a file and run pylint over it
A = True
B = 1
C = [1]
D = False
E = False

if A and B in C:
    D = True
else:
    E = True

print(D, E)

Current behavior

pylint emits a simplifiable-if-statement.

Expected behavior

pylint shouldn't emit simplifiable-if-statement since we assign to two different values in the if statement.

pylint --version output

master & 1.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions