diff options
author | Jimi Cullen <jimifhcullen@gmail.com> | 2018-04-03 12:24:38 +0100 |
---|---|---|
committer | Ian Stapleton Cordasco <graffatcolmingov@gmail.com> | 2018-04-03 06:24:38 -0500 |
commit | 9f225ac876b6340825770c9c665060dfc28300c6 (patch) | |
tree | 2daa8c08e95b50b9156c297a44d876ddc56c6ba7 /pycodestyle.py | |
parent | 368e62cb6c57ff386b5a08659a5a9d2866b80a2f (diff) | |
download | pep8-9f225ac876b6340825770c9c665060dfc28300c6.tar.gz |
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.
Diffstat (limited to 'pycodestyle.py')
-rwxr-xr-x | pycodestyle.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pycodestyle.py b/pycodestyle.py index 3e574c8..5371a67 100755 --- a/pycodestyle.py +++ b/pycodestyle.py @@ -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 @@ -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() |