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

Unified Diff: tools/web_dev_style/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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/web_dev_style/OWNERS ('k') | tools/web_dev_style/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/web_dev_style/PRESUBMIT.py
diff --git a/tools/web_dev_style/PRESUBMIT.py b/tools/web_dev_style/PRESUBMIT.py
new file mode 100644
index 0000000000000000000000000000000000000000..d808f851dd1c9f89cf2989b77a4f1c07764f9c95
--- /dev/null
+++ b/tools/web_dev_style/PRESUBMIT.py
@@ -0,0 +1,34 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+def CheckChangeOnUpload(*args):
+ return _CommonChecks(*args)
+
+
+def CheckChangeOnCommit(*args):
+ return _CommonChecks(*args)
+
+
+def _CommonChecks(input_api, output_api):
+ cwd = input_api.PresubmitLocalPath()
+ path = input_api.os_path
+ files = [path.basename(f.LocalPath()) for f in input_api.AffectedFiles()]
+ tests = []
+
+ if 'css_checker.py' in files:
+ tests.append(path.join(cwd, 'css_checker_test.py'))
+
+ utils_changed = 'regex_check.py' in files or 'test_util.py' in files
+
+ if utils_changed or any(f for f in files if f.startswith('html_checker')):
+ tests.append(path.join(cwd, 'html_checker_test.py'))
+
+ if utils_changed or any(f for f in files if f.startswith('js_checker')):
+ tests.append(path.join(cwd, 'js_checker_test.py'))
+
+ if utils_changed or any(f for f in files if f.startswith('resource_checker')):
+ tests.append(path.join(cwd, 'resource_checker_test.py'))
+
+ return input_api.canned_checks.RunUnitTests(input_api, output_api, tests)
« no previous file with comments | « tools/web_dev_style/OWNERS ('k') | tools/web_dev_style/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698