summaryrefslogtreecommitdiff
path: root/pylint/checkers/refactoring.py
diff options
context:
space:
mode:
authorYang Yang <y4n9squared@gmail.com>2020-04-11 16:50:22 -0400
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2020-04-19 14:49:19 +0200
commit555004be6f9fbd026a273034771b36b51ee65d17 (patch)
treea0cfcc4598007e37f55fe0a832b2514fa030ba10 /pylint/checkers/refactoring.py
parent22fe050a610d0cdb24bd6790d7a6f46da9b5ed8f (diff)
downloadpylint-git-555004be6f9fbd026a273034771b36b51ee65d17.tar.gz
Fix false-negative cases for trailing-comma-tuple
The current logic for detecting trailing-comma-tuple violations fails to detect positive cases that span multiple lines because its look-back mechanism stops at the last NL or NEWLINE token when it should in fact stop at the last NEWLINE token only.
Diffstat (limited to 'pylint/checkers/refactoring.py')
-rw-r--r--pylint/checkers/refactoring.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/pylint/checkers/refactoring.py b/pylint/checkers/refactoring.py
index 75a31c7e6..5293097eb 100644
--- a/pylint/checkers/refactoring.py
+++ b/pylint/checkers/refactoring.py
@@ -95,7 +95,7 @@ def _is_trailing_comma(tokens, index):
"""Get the index denoting the start of the current line"""
for subindex, token in enumerate(reversed(tokens[:index])):
# See Lib/tokenize.py and Lib/token.py in cpython for more info
- if token.type in (tokenize.NEWLINE, tokenize.NL):
+ if token.type == tokenize.NEWLINE:
return index - subindex
return 0