summaryrefslogtreecommitdiff
path: root/pep8.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2012-03-26 03:12:36 +0200
committerFlorent Xicluna <florent.xicluna@gmail.com>2012-03-26 03:12:36 +0200
commit855240f5e58584453bc53be3deeb3112cfe51d72 (patch)
tree384cf8ba3a57849da95a6316ed3bab8de31bcc36 /pep8.py
parent5fd3056cab62dbc51767676b0ed9bc285e43f228 (diff)
parent1c28dc0c0ca4eb9d41730833d486d2eab5e07e61 (diff)
downloadpep8-855240f5e58584453bc53be3deeb3112cfe51d72.tar.gz
Merge branch 'topic/max-line-length' of git://github.com/treyhunner/pep8
Diffstat (limited to 'pep8.py')
-rwxr-xr-xpep8.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/pep8.py b/pep8.py
index 88d2f7d..1c09695 100755
--- a/pep8.py
+++ b/pep8.py
@@ -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)