aboutsummaryrefslogtreecommitdiffhomepage
path: root/PRESUBMIT.py
diff options
context:
space:
mode:
authorGravatar Eric Boren <borenet@google.com>2018-06-22 10:13:52 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-22 14:38:28 +0000
commit5e0909776e81803dd140255fb89fa19e3b8d158f (patch)
treed848f174fa2744b328d8980a8ed04960e6445f1c /PRESUBMIT.py
parent5741a5ba7f369a85cb1f93466cb710bcb0bb49d5 (diff)
Fix pylint check in presubmit
This fixes the unexpected behavior where we only run pylint over the affected Python files *unless* there are affected Python files which we have explicitly blacklisted, in which case we run pylint over ALL Python files in every subdirectory of the Skia checkout, including repos in DEPS. - Added buildtools and common to the blacklist. - Changed to run pylint over all Python files in Skia, like presubmit_support expects. - Fix existing pylint problems. Bug: skia: Change-Id: Ife1321f5ae5eaff2a28cc14c99a82a0716c12677 Reviewed-on: https://skia-review.googlesource.com/137126 Reviewed-by: Eric Boren <borenet@google.com> Commit-Queue: Eric Boren <borenet@google.com>
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r--PRESUBMIT.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index f9747fa1f6..2a3b61f7c3 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -78,9 +78,16 @@ def _CheckChangeHasEol(input_api, output_api, source_file_filter=None):
def _PythonChecks(input_api, output_api):
"""Run checks on any modified Python files."""
- pylint_disabled_files = (
- 'infra/bots/recipes.py',
- )
+ blacklist = [
+ r'infra[\\\/]bots[\\\/]recipes.py',
+
+ # Blacklist DEPS. Those under third_party are already covered by
+ # input_api.DEFAULT_BLACK_LIST.
+ r'common[\\\/].*',
+ r'buildtools[\\\/].*',
+ ]
+ blacklist.extend(input_api.DEFAULT_BLACK_LIST)
+
pylint_disabled_warnings = (
'F0401', # Unable to import.
'E0611', # No name in module.
@@ -92,18 +99,10 @@ def _PythonChecks(input_api, output_api):
'W0613', # Unused argument.
'W0105', # String statement has no effect.
)
- # Run Pylint on only the modified python files. Unfortunately it still runs
- # Pylint on the whole file instead of just the modified lines.
- affected_python_files = []
- for affected_file in input_api.AffectedSourceFiles(None):
- affected_file_path = affected_file.LocalPath()
- if affected_file_path.endswith('.py'):
- if affected_file_path not in pylint_disabled_files:
- affected_python_files.append(affected_file_path)
return input_api.canned_checks.RunPylint(
input_api, output_api,
disabled_warnings=pylint_disabled_warnings,
- white_list=affected_python_files)
+ black_list=blacklist)
def _JsonChecks(input_api, output_api):