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

Side by Side Diff: PRESUBMIT.py

Issue 719463003: Presubmit checks for user actions intorduced in HTML files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Top-level presubmit script for Chromium. 5 """Top-level presubmit script for Chromium.
6 6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into gcl. 8 for more details about the presubmit API built into gcl.
9 """ 9 """
10 10
11
Alexei Svitkine (slow) 2014/11/11 20:36:41 Nit: Revert changes to this file.
gayane -on leave until 09-2017 2014/11/12 22:00:23 Done.
12 _EXCLUDED_PATHS = ( 11 _EXCLUDED_PATHS = (
13 r"^breakpad[\\\/].*", 12 r"^breakpad[\\\/].*",
14 r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_rules.py", 13 r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_rules.py",
15 r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_simple.py", 14 r"^native_client_sdk[\\\/]src[\\\/]build_tools[\\\/]make_simple.py",
16 r"^native_client_sdk[\\\/]src[\\\/]tools[\\\/].*.mk", 15 r"^native_client_sdk[\\\/]src[\\\/]tools[\\\/].*.mk",
17 r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*", 16 r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*",
18 r"^skia[\\\/].*", 17 r"^skia[\\\/].*",
19 r"^v8[\\\/].*", 18 r"^v8[\\\/].*",
20 r".*MakeFile$", 19 r".*MakeFile$",
21 r".+_autogen\.h$", 20 r".+_autogen\.h$",
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 1065
1067 1066
1068 def _CheckUserActionUpdate(input_api, output_api): 1067 def _CheckUserActionUpdate(input_api, output_api):
1069 """Checks if any new user action has been added.""" 1068 """Checks if any new user action has been added."""
1070 if any('actions.xml' == input_api.os_path.basename(f) for f in 1069 if any('actions.xml' == input_api.os_path.basename(f) for f in
1071 input_api.LocalPaths()): 1070 input_api.LocalPaths()):
1072 # If actions.xml is already included in the changelist, the PRESUBMIT 1071 # If actions.xml is already included in the changelist, the PRESUBMIT
1073 # for actions.xml will do a more complete presubmit check. 1072 # for actions.xml will do a more complete presubmit check.
1074 return [] 1073 return []
1075 1074
1076 file_filter = lambda f: f.LocalPath().endswith(('.cc', '.mm')) 1075 file_filter = lambda f: f.LocalPath().endswith(('.cc', '.mm', '.c', '.m'))
1077 action_re = r'[^a-zA-Z]UserMetricsAction\("([^"]*)' 1076 action_re = r'[^a-zA-Z]UserMetricsAction\("([^"]*)'
1078 current_actions = None 1077 current_actions = None
1079 for f in input_api.AffectedFiles(file_filter=file_filter): 1078 for f in input_api.AffectedFiles(file_filter=file_filter):
1080 for line_num, line in f.ChangedContents(): 1079 for line_num, line in f.ChangedContents():
1081 match = input_api.re.search(action_re, line) 1080 match = input_api.re.search(action_re, line)
1082 if match: 1081 if match:
1083 # Loads contents in tools/metrics/actions/actions.xml to memory. It's 1082 # Loads contents in tools/metrics/actions/actions.xml to memory. It's
1084 # loaded only once. 1083 # loaded only once.
1085 if not current_actions: 1084 if not current_actions:
1086 with open('tools/metrics/actions/actions.xml') as actions_f: 1085 with open('tools/metrics/actions/actions.xml') as actions_f:
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 builders.extend(['cros_x86']) 1744 builders.extend(['cros_x86'])
1746 1745
1747 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it 1746 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it
1748 # unless they're .gyp(i) files as changes to those files can break the gyp 1747 # unless they're .gyp(i) files as changes to those files can break the gyp
1749 # step on that bot. 1748 # step on that bot.
1750 if (not all(re.search('^chrome', f) for f in files) or 1749 if (not all(re.search('^chrome', f) for f in files) or
1751 any(re.search('\.gypi?$', f) for f in files)): 1750 any(re.search('\.gypi?$', f) for f in files)):
1752 builders.extend(['android_aosp']) 1751 builders.extend(['android_aosp'])
1753 1752
1754 return GetDefaultTryConfigs(builders) 1753 return GetDefaultTryConfigs(builders)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/PRESUBMIT.py » ('j') | chrome/browser/resources/PRESUBMIT.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698