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

Unified Diff: presubmit_canned_checks.py

Issue 10199016: Add disabled_warnings arg to RunPylint() and use the default pylintrc file by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Add hashlib to the ignored symbols by pylint Created 8 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 | « PRESUBMIT.py ('k') | 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 be84cd726aa3c12014c2987808d7a7273ccbf381..e7b503e0af5cdd4007ba14cde0eef095d30ef78d 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -4,6 +4,9 @@
"""Generic presubmit checks that can be reused by other presubmit checks."""
+import os as _os
+_HERE = _os.path.dirname(_os.path.abspath(__file__))
+
### Description checks
@@ -615,7 +618,8 @@ def _FetchAllFiles(input_api, white_list, black_list):
return files
-def RunPylint(input_api, output_api, white_list=None, black_list=None):
+def RunPylint(input_api, output_api, white_list=None, black_list=None,
+ disabled_warnings=None):
"""Run pylint on python files.
The default white_list enforces looking only a *.py files.
@@ -632,6 +636,10 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None):
if not input_api.AffectedSourceFiles(src_filter):
return []
+ extra_args = ['--rcfile=%s' % input_api.os_path.join(_HERE, 'pylintrc')]
+ if disabled_warnings:
+ extra_args.extend(['-d', ','.join(disabled_warnings)])
+
# On certain pylint/python version combination, running pylint throws a lot of
# warning messages.
import warnings
@@ -661,7 +669,7 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None):
def run_lint(files):
try:
- lint.Run(files)
+ lint.Run(files + extra_args)
assert False
except SystemExit, e:
# pylint has the bad habit of calling sys.exit(), trap it here.
« no previous file with comments | « PRESUBMIT.py ('k') | pylintrc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698