Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: presubmit_canned_checks.py

Issue 8363030: Improve pylint error message with an old version is used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Better Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pylintrc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_canned_checks.py
diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py
index 607ce8c76507427c7eeb72275a1db334403cc0e8..6d6de09d8c34ba484d92ebbde353b82c93858b52 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -634,6 +634,7 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None):
# were listed, try to run pylint.
try:
from pylint import lint
+ from pylint.utils import UnknownMessage
input_api.logging.debug(
'Using pylint v%s from %s' % (lint.version, lint.__file__))
except ImportError:
@@ -655,6 +656,8 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None):
except SystemExit, e:
# pylint has the bad habit of calling sys.exit(), trap it here.
return e.code
+ except UnknownMessage, e:
+ return 'Please upgrade pylint: %s' % e
result = None
if not input_api.verbose:
@@ -662,10 +665,10 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None):
else:
for filename in sorted(files):
print('Running pylint on %s' % filename)
- out = run_lint([filename])
- if out:
- result = out
- if result:
+ result = run_lint([filename]) or result
+ if isinstance(result, basestring):
+ return [error_type(result)]
+ elif result:
return [error_type('Fix pylint errors first.')]
return []
finally:
« no previous file with comments | « no previous file | pylintrc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698