diff options
author | Corey Farwell <coreyf@rwell.org> | 2015-08-05 10:13:22 -0400 |
---|---|---|
committer | Corey Farwell <coreyf@rwell.org> | 2015-08-05 10:23:16 -0400 |
commit | 5eeb53413e077de78b92e06b75850b93d77790a4 (patch) | |
tree | 18fcd6b1438827a8ae6e23024670e43723197e7c /python/tidy.py | |
parent | 11acfbc29fd3412c18b6bf62e51faef5c2435fd3 (diff) | |
download | servo-5eeb53413e077de78b92e06b75850b93d77790a4.tar.gz servo-5eeb53413e077de78b92e06b75850b93d77790a4.zip |
Prevent flake8 from crashing tidy
If someone were to write:
def hello() :
print "hello world"
flake8 would warn:
stdin:54:45: E203 whitespace before ':'
Normally there are only three colons in a flake8 error message, but this
one has four, which causes issue with this line:
_, line_num, _, message = error.split(":")
...causing this error:
ValueError: too many values to unpack
This commit updates the `str.split` call to utilize the `maxsplit`
parameter to prevent this error from occurring.
Diffstat (limited to 'python/tidy.py')
-rw-r--r-- | python/tidy.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/python/tidy.py b/python/tidy.py index 21b7c74e36c..625c3111465 100644 --- a/python/tidy.py +++ b/python/tidy.py @@ -153,7 +153,7 @@ def check_flake8(file_name, contents): with stdout_redirect(output): check_code(contents, ignore=ignore) for error in output.getvalue().splitlines(): - _, line_num, _, message = error.split(":") + _, line_num, _, message = error.split(":", 3) yield line_num, message.strip() |