diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2012-03-26 03:12:36 +0200 |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2012-03-26 03:12:36 +0200 |
commit | 855240f5e58584453bc53be3deeb3112cfe51d72 (patch) | |
tree | 384cf8ba3a57849da95a6316ed3bab8de31bcc36 /pep8.py | |
parent | 5fd3056cab62dbc51767676b0ed9bc285e43f228 (diff) | |
parent | 1c28dc0c0ca4eb9d41730833d486d2eab5e07e61 (diff) | |
download | pep8-855240f5e58584453bc53be3deeb3112cfe51d72.tar.gz |
Merge branch 'topic/max-line-length' of git://github.com/treyhunner/pep8
Diffstat (limited to 'pep8.py')
-rwxr-xr-x | pep8.py | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -242,7 +242,7 @@ def maximum_line_length(physical_line): """ line = physical_line.rstrip() length = len(line) - if length > MAX_LINE_LENGTH: + if length > options.max_line_length: try: # The line could contain multi-byte characters if not hasattr(line, 'decode'): # Python 3 @@ -250,8 +250,9 @@ def maximum_line_length(physical_line): length = len(line.decode('utf-8')) except UnicodeError: pass - if length > MAX_LINE_LENGTH: - return MAX_LINE_LENGTH, "E501 line too long (%d characters)" % length + if length > options.max_line_length: + return options.max_line_length, \ + "E501 line too long (%d characters)" % length ############################################################################## @@ -1288,6 +1289,10 @@ def process_options(arglist=None): help="measure processing speed") parser.add_option('--testsuite', metavar='dir', help="run regression tests from dir") + parser.add_option('--max-line-length', type='int', metavar='n', + default=MAX_LINE_LENGTH, + help="set to a higher value to relax pep8 " + "line length restictions") parser.add_option('--doctest', action='store_true', help="run doctest on myself") options, args = parser.parse_args(arglist) |