Skip to content

Commit 9aac3c0

Browse files
committed
Fix misleading error message for E251
1 parent c276214 commit 9aac3c0

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

pep8.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -751,12 +751,12 @@ def whitespace_around_named_parameter_equals(logical_line, tokens):
751751
parens = 0
752752
no_space = False
753753
prev_end = None
754+
message = "E251 unexpected spaces around keyword / parameter equals"
754755
for token_type, text, start, end, line in tokens:
755756
if no_space:
756757
no_space = False
757758
if start != prev_end:
758-
yield (prev_end,
759-
"E251 no spaces around keyword / parameter equals")
759+
yield (prev_end, message)
760760
elif token_type == tokenize.OP:
761761
if text == '(':
762762
parens += 1
@@ -765,8 +765,7 @@ def whitespace_around_named_parameter_equals(logical_line, tokens):
765765
elif parens and text == '=':
766766
no_space = True
767767
if start != prev_end:
768-
yield (prev_end,
769-
"E251 no spaces around keyword / parameter equals")
768+
yield (prev_end, message)
770769
prev_end = end
771770

772771

0 commit comments

Comments
 (0)