Skip to content
Snippets Groups Projects
Commit 9f225ac8 authored by Jimi Cullen's avatar Jimi Cullen Committed by Ian Stapleton Cordasco
Browse files

Ignore length of shebang line (#736)

* Add special case to maximum_line_length to ignore long shebang lines.

* Add test for ignoring long shebang lines.

* Clean up shebang line check.
parent 368e62cb
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -260,7 +260,8 @@ def trailing_blank_lines(physical_line, lines, line_number, total_lines):
 
 
@register_check
def maximum_line_length(physical_line, max_line_length, multiline, noqa):
def maximum_line_length(physical_line, max_line_length, multiline,
line_number, noqa):
r"""Limit all lines to a maximum of 79 characters.
 
There are still many devices around that are limited to 80 character
Loading
Loading
@@ -275,6 +276,9 @@ def maximum_line_length(physical_line, max_line_length, multiline, noqa):
line = physical_line.rstrip()
length = len(line)
if length > max_line_length and not noqa:
# Special case: ignore long shebang lines.
if line_number == 1 and line.startswith('#!'):
return
# Special case for long URLs in multi-line docstrings or comments,
# but still report the error when the 72 first chars are whitespaces.
chunks = line.split()
Loading
Loading
Loading
Loading
@@ -121,3 +121,7 @@ import this
#: E501
# This
# almost_empty_line
#
#: Okay
#!/reallylongpath/toexecutable --maybe --with --some ARGUMENTS TO DO WITH WHAT EXECUTABLE TO RUN
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment