Skip to content

False positive for 'chained-comparison' #5800

@skirpichev

Description

@skirpichev

Bug description

$ cat -n a.py 
     1  a = 1
     2  b = 2
     3  c = 3
     4  d = 4
     5  if a < 0 and b > 1 and c < 1 and d > 2:
     6      print(1)

Configuration

None

Command used

pylint a.py

Pylint output

************* Module a
a.py:1:0: C0114: Missing module docstring (missing-module-docstring)
a.py:1:0: C0103: Constant name "a" doesn't conform to UPPER_CASE naming style (invalid-name)
a.py:2:0: C0103: Constant name "b" doesn't conform to UPPER_CASE naming style (invalid-name)
a.py:3:0: C0103: Constant name "c" doesn't conform to UPPER_CASE naming style (invalid-name)
a.py:4:0: C0103: Constant name "d" doesn't conform to UPPER_CASE naming style (invalid-name)
a.py:5:3: R1716: Simplify chained comparison between the operands (chained-comparison)

Expected behavior

No R1716.

Pylint version

pylint 2.12.2
astroid 2.9.3
Python 3.10.0+ (heads/3.10:045f205ba4, Nov  8 2021, 05:21:54) [GCC 10.2.1 20210110]

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions