From fe1211ae6e9f53172e57d7e7a22d8f193c93d0d3 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Sat, 28 May 2011 18:54:17 +0000 Subject: [PATCH] Improve the sources regexp to be more correct. R=dpranke@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/7030023 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@87185 0039d316-1c4b-4281-b951-d872f2087c98 --- presubmit_canned_checks.py | 9 ++++----- presubmit_support.py | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index 11cdeb1570..1e64211657 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -886,8 +886,8 @@ def PanProjectChecks(input_api, output_api, """ excluded_paths = excluded_paths or tuple() text_files = text_files or ( - r'.*\.txt', - r'.*\.json', + r'.+\.txt$', + r'.+\.json$', ) project_name = project_name or 'Chromium' license_header = license_header or ( @@ -909,9 +909,8 @@ def PanProjectChecks(input_api, output_api, black_list = input_api.DEFAULT_BLACK_LIST + excluded_paths white_list = input_api.DEFAULT_WHITE_LIST + text_files sources = lambda x: input_api.FilterSourceFile(x, black_list=black_list) - text_files = lambda x: input_api.FilterSourceFile(x, black_list=black_list, - white_list=white_list) - + text_files = lambda x: input_api.FilterSourceFile( + x, black_list=black_list, white_list=white_list) snapshot_memory = [] def snapshot(msg): diff --git a/presubmit_support.py b/presubmit_support.py index 8937d75019..9c93ab85ae 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -187,15 +187,15 @@ class InputApi(object): # perspective. Don't modify this list from a presubmit script! DEFAULT_WHITE_LIST = ( # C++ and friends - r".*\.c$", r".*\.cc$", r".*\.cpp$", r".*\.h$", r".*\.m$", r".*\.mm$", - r".*\.inl$", r".*\.asm$", r".*\.hxx$", r".*\.hpp$", r".*\.s$", r".*\.S$", + r".+\.c$", r".+\.cc$", r".+\.cpp$", r".+\.h$", r".+\.m$", r".+\.mm$", + r".+\.inl$", r".+\.asm$", r".+\.hxx$", r".+\.hpp$", r".+\.s$", r".+\.S$", # Scripts - r".*\.js$", r".*\.py$", r".*\.sh$", r".*\.rb$", r".*\.pl$", r".*\.pm$", + r".+\.js$", r".+\.py$", r".+\.sh$", r".+\.rb$", r".+\.pl$", r".+\.pm$", # No extension at all, note that ALL CAPS files are black listed in # DEFAULT_BLACK_LIST below. r"(^|.*?[\\\/])[^.]+$", # Other - r".*\.java$", r".*\.mk$", r".*\.am$", + r".+\.java$", r".+\.mk$", r".+\.am$", ) # Path regexp that should be excluded from being considered containing source