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

Side by Side Diff: chrome/browser/resources/PRESUBMIT.py

Issue 2890513003: Move chrome/browser/web_dev_style/ to tools/ to use from more places (Closed)
Patch Set: tsergeant@ review Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/PRESUBMIT.py ('k') | chrome/browser/ui/webui/PRESUBMIT.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """Presubmit script for files in chrome/browser/resources. 5 """Presubmit script for files in chrome/browser/resources.
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 depot_tools. 8 for more details about the presubmit API built into depot_tools.
9 """ 9 """
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return input_api.canned_checks.CheckLongLines( 95 return input_api.canned_checks.CheckLongLines(
96 input_api, output_api, 80, lambda x: x.LocalPath().endswith('.html')) 96 input_api, output_api, 80, lambda x: x.LocalPath().endswith('.html'))
97 97
98 98
99 def RunVulcanizeTests(input_api, output_api): 99 def RunVulcanizeTests(input_api, output_api):
100 presubmit_path = input_api.PresubmitLocalPath() 100 presubmit_path = input_api.PresubmitLocalPath()
101 tests = [input_api.os_path.join(presubmit_path, 'vulcanize_gn_test.py')] 101 tests = [input_api.os_path.join(presubmit_path, 'vulcanize_gn_test.py')]
102 return input_api.canned_checks.RunUnitTests(input_api, output_api, tests) 102 return input_api.canned_checks.RunUnitTests(input_api, output_api, tests)
103 103
104 104
105 def _CheckWebDevStyle(input_api, output_api):
106 results = []
107
108 try:
109 import sys
110 old_sys_path = sys.path
111 cwd = input_api.PresubmitLocalPath()
112 sys.path += [input_api.os_path.join(cwd, '..', '..', '..', 'tools')]
113 import web_dev_style.presubmit_support
114 results += web_dev_style.presubmit_support.CheckStyle(input_api, output_api)
115 finally:
116 sys.path = old_sys_path
117
118 return results
119
120
105 def _CheckChangeOnUploadOrCommit(input_api, output_api): 121 def _CheckChangeOnUploadOrCommit(input_api, output_api):
106 results = CheckUserActionUpdate(input_api, output_api, ACTION_XML_PATH) 122 results = CheckUserActionUpdate(input_api, output_api, ACTION_XML_PATH)
107 affected = input_api.AffectedFiles() 123 affected = input_api.AffectedFiles()
108 if any(f for f in affected if f.LocalPath().endswith('.html')): 124 if any(f for f in affected if f.LocalPath().endswith('.html')):
109 results += CheckHtml(input_api, output_api) 125 results += CheckHtml(input_api, output_api)
110 if any(f for f in affected if f.LocalPath().endswith('vulcanize_gn.py')): 126 if any(f for f in affected if f.LocalPath().endswith('vulcanize_gn.py')):
111 results += RunVulcanizeTests(input_api, output_api) 127 results += RunVulcanizeTests(input_api, output_api)
128 results += _CheckWebDevStyle(input_api, output_api)
112 return results 129 return results
113 130
114 131
115 def CheckChangeOnUpload(input_api, output_api): 132 def CheckChangeOnUpload(input_api, output_api):
116 return _CheckChangeOnUploadOrCommit(input_api, output_api) 133 return _CheckChangeOnUploadOrCommit(input_api, output_api)
117 134
118 135
119 def CheckChangeOnCommit(input_api, output_api): 136 def CheckChangeOnCommit(input_api, output_api):
120 return _CheckChangeOnUploadOrCommit(input_api, output_api) 137 return _CheckChangeOnUploadOrCommit(input_api, output_api)
121 138
122 139
123 def PostUploadHook(cl, change, output_api): 140 def PostUploadHook(cl, change, output_api):
124 return output_api.EnsureCQIncludeTrybotsAreAdded( 141 return output_api.EnsureCQIncludeTrybotsAreAdded(
125 cl, 142 cl,
126 [ 143 [
127 'master.tryserver.chromium.linux:closure_compilation', 144 'master.tryserver.chromium.linux:closure_compilation',
128 ], 145 ],
129 'Automatically added optional Closure bots to run on CQ.') 146 'Automatically added optional Closure bots to run on CQ.')
OLDNEW
« no previous file with comments | « chrome/browser/PRESUBMIT.py ('k') | chrome/browser/ui/webui/PRESUBMIT.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698