summaryrefslogtreecommitdiff
path: root/pylint/checkers/refactoring.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2018-07-31 09:08:22 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2018-07-31 09:08:22 +0200
commit0102cbdca4588405ecdf9fbd82c4b606b69dc3b7 (patch)
tree069534204d5146fcd27c999bf4943e3f9ed64f3c /pylint/checkers/refactoring.py
parent36dbb9e82ef4d9395362572c2e788e0cb746af07 (diff)
downloadpylint-git-0102cbdca4588405ecdf9fbd82c4b606b69dc3b7.tar.gz
`trailing-comma-tuple` gets emitted for ``yield`` statements as well.
Close #2363
Diffstat (limited to 'pylint/checkers/refactoring.py')
-rw-r--r--pylint/checkers/refactoring.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/pylint/checkers/refactoring.py b/pylint/checkers/refactoring.py
index 684355fab..92fa85e52 100644
--- a/pylint/checkers/refactoring.py
+++ b/pylint/checkers/refactoring.py
@@ -1240,9 +1240,11 @@ def is_trailing_comma(tokens, index):
if token.type in (tokenize.NEWLINE, tokenize.NL):
return index - subindex
return 0
+
curline_start = get_curline_index_start()
+ expected_tokens = {'return', 'yield'}
for prevtoken in tokens[curline_start:index]:
- if '=' in prevtoken.string or prevtoken.string == 'return':
+ if '=' in prevtoken.string or prevtoken.string in expected_tokens:
return True
return False