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

Unified Diff: PRESUBMIT.py

Issue 2353393004: Use a whitelist for depot_tools pylint instead (Closed)
Patch Set: Skip cpplint.py, since it should be in third_party Created 4 years, 3 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 | cpplint.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index ce1aea69c8aab776d6f77667e694e1c4c925edfa..f082fb010603da8962327f7f7096ca8a13bfba2d 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -12,22 +12,15 @@ import fnmatch
import os
-def CommonChecks(input_api, output_api, tests_to_black_list):
- results = []
- results.extend(input_api.canned_checks.CheckOwners(input_api, output_api))
- black_list = list(input_api.DEFAULT_BLACK_LIST) + [
- r'^\.recipe_deps[\/\\].*',
- r'^infra[\/\\]\.recipe_deps[\/\\].*',
- r'^cpplint\.py$',
- r'^cpplint_chromium\.py$',
- r'^external_bin[\/\\].+',
- r'^python[0-9]*_bin[\/\\].+',
- r'^recipes\.py$',
- r'^site-packages-py[0-9]\.[0-9][\/\\].+',
- r'^svn_bin[\/\\].+',
- r'^testing_support[\/\\]_rietveld[\/\\].+',
- r'^testing_support[\/\\]_infra[\/\\].+',
+def DepotToolsPylint(input_api, output_api):
+ """Gather all the pylint logic into one place to make it self-contained."""
+ white_list = [
+ r'^[^/]*\.py$',
+ r'^testing_support/[^/]*\.py$',
+ r'^tests/[^/]*\.py$',
+ r'^recipe_modules/.*\.py$', # Allow recursive search in recipe modules.
]
+ black_list = list(input_api.DEFAULT_BLACK_LIST)
if os.path.exists('.gitignore'):
with open('.gitignore') as fh:
lines = [l.strip() for l in fh.readlines()]
@@ -42,21 +35,26 @@ def CommonChecks(input_api, output_api, tests_to_black_list):
'R0401', # Cyclic import
'W0613', # Unused argument
]
- pylint = input_api.canned_checks.GetPylint(
+ return input_api.canned_checks.GetPylint(
input_api,
output_api,
- white_list=[r'.*\.py$'],
+ white_list=white_list,
black_list=black_list,
disabled_warnings=disabled_warnings)
+
+
+def CommonChecks(input_api, output_api, tests_to_black_list):
+ results = []
+ results.extend(input_api.canned_checks.CheckOwners(input_api, output_api))
# TODO(maruel): Make sure at least one file is modified first.
# TODO(maruel): If only tests are modified, only run them.
+ tests = DepotToolsPylint(input_api, output_api)
unit_tests = input_api.canned_checks.GetUnitTestsInDirectory(
input_api,
output_api,
'tests',
whitelist=[r'.*test\.py$'],
blacklist=tests_to_black_list)
- tests = pylint
if not input_api.platform.startswith(('cygwin', 'win32')):
tests.extend(unit_tests)
else:
« no previous file with comments | « no previous file | cpplint.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698