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. |