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

Unified Diff: presubmit_canned_checks.py

Issue 6811020: Revert r80770 "Switch from xml.dom.minidom to xml.etree" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 8 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 | « gclient_utils.py ('k') | rietveld.py » ('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 890b72cd18076f5d5a5ba6e36845a3f0474ef8da..e421bd750ef1a96b3b3fe505c9209bd8661447bd 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -544,13 +544,8 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None):
The default white_list enforces looking only a *.py files.
"""
- verbose = False
white_list = white_list or ['.*\.py$']
black_list = black_list or input_api.DEFAULT_BLACK_LIST
- if input_api.is_committing:
- error_type = output_api.PresubmitError
- else:
- error_type = output_api.PresubmitPromptWarning
# Only trigger if there is at least one python file affected.
src_filter = lambda x: input_api.FilterSourceFile(x, white_list, black_list)
@@ -569,6 +564,10 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None):
# were listed, try to run pylint.
try:
from pylint import lint
+ result = lint.Run(sorted(files))
+ except SystemExit, e:
+ # pylint has the bad habit of calling sys.exit(), trap it here.
+ result = e.code
except ImportError:
if input_api.platform == 'win32':
return [output_api.PresubmitNotifyResult(
@@ -580,31 +579,16 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None):
'sudo easy_install pylint"\n'
'or visit http://pypi.python.org/pypi/setuptools.\n'
'Cannot do static analysis of python files.')]
-
- def run_lint(files):
- try:
- lint.Run(files)
- assert False
- except SystemExit, e:
- # pylint has the bad habit of calling sys.exit(), trap it here.
- return e.code
-
- result = None
- if not verbose:
- result = run_lint(sorted(files))
- else:
- for filename in sorted(files):
- print('Running pylint on %s' % filename)
- out = run_lint([filename])
- if out:
- result = out
if result:
+ if input_api.is_committing:
+ error_type = output_api.PresubmitError
+ else:
+ error_type = output_api.PresubmitPromptWarning
return [error_type('Fix pylint errors first.')]
return []
finally:
warnings.filterwarnings('default', category=DeprecationWarning)
-
# TODO(dpranke): Get the host_url from the input_api instead
def CheckRietveldTryJobExecution(input_api, output_api, host_url, platforms,
owner):
« no previous file with comments | « gclient_utils.py ('k') | rietveld.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698