diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2015-10-26 16:42:57 +0000 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-10-26 16:42:57 +0000 |
commit | 486091452ad54d6bac7cc0100c62652e858aa8c8 (patch) | |
tree | a060738db080de85677538f50d8401d8976f9f8a /pylint/checkers/base.py | |
parent | 5ec61312c563df13c29e67dc5cb3e003f8f492f6 (diff) | |
download | pylint-486091452ad54d6bac7cc0100c62652e858aa8c8.tar.gz |
Simplify visit_compare, by moving the verifications for misplaced constants into their own if statement.
Diffstat (limited to 'pylint/checkers/base.py')
-rw-r--r-- | pylint/checkers/base.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py index cd4a81e..c9e8b75 100644 --- a/pylint/checkers/base.py +++ b/pylint/checkers/base.py @@ -1506,15 +1506,15 @@ class ComparisonChecker(_BasicChecker): return left = node.left operator, right = node.ops[0] + if (operator in ('<', '<=', '>', '>=', '!=', '==') + and isinstance(left, astroid.Const)): + self._check_misplaced_constant(node, left, right, operator) + if operator == '==': if isinstance(left, astroid.Const): - self._check_misplaced_constant(node, left, right, operator) self._check_singleton_comparison(left, node) elif isinstance(right, astroid.Const): self._check_singleton_comparison(right, node) - elif (operator in ('<', '<=', '>', '>=', '!=') - and isinstance(left, astroid.Const)): - self._check_misplaced_constant(node, left, right, operator) def register(linter): |