Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support of E241 ignore by noqa comment inline #997

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ def missing_whitespace_around_operator(logical_line, tokens):


@register_check
def whitespace_around_comma(logical_line):
def whitespace_around_comma(logical_line, noqa):
r"""Avoid extraneous whitespace after a comma or a colon.

Note: these checks are disabled by default
Expand All @@ -993,6 +993,8 @@ def whitespace_around_comma(logical_line):
E241: a = (1, 2)
E242: a = (1,\t2)
"""
if noqa:
return
line = logical_line
for m in WHITESPACE_AFTER_COMMA_REGEX.finditer(line):
found = m.start() + 1
Expand Down
16 changes: 16 additions & 0 deletions testsuite/noqa.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,19 @@
if a == None: # noqa
pass
#:


#: Okay
a = [
1, 2, 3, # noqa: E241
10, 20, 30 # noqa: E241
]
#:

# Still reported as error by default if noqa not added
#: E126 E131 E241 E241
b = [
1, 2, 3,
10, 20, 30
]
#: