Index: tools/web_dev_style/presubmit_support.py |
diff --git a/tools/web_dev_style/presubmit_support.py b/tools/web_dev_style/presubmit_support.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d7bf1b3da5aaa0baa16ea968bd0fa8a71cfd9f14 |
--- /dev/null |
+++ b/tools/web_dev_style/presubmit_support.py |
@@ -0,0 +1,30 @@ |
+# 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. |
+ |
+ |
+import css_checker |
+import html_checker |
+import js_checker |
+import resource_checker |
+ |
+ |
+def CheckStyle(input_api, output_api): |
+ is_resource = lambda f: f.LocalPath().endswith(('.html', '.css', '.js')) |
+ is_vulcanized = lambda f: not f.endswith(('vulcanized.html', 'crisper.js')) |
tsergeant
2017/05/17 03:37:13
I don't think this is necessary any more, right? W
Dan Beam
2017/05/17 17:33:21
Done. (thanks!)
|
+ file_filter = lambda f: is_resource(f) and not is_vulcanized(f.LocalPath()) |
+ |
+ apis = input_api, output_api |
+ |
+ checkers = [ |
+ css_checker.CSSChecker(*apis, file_filter=file_filter), |
+ html_checker.HtmlChecker(*apis, file_filter=file_filter), |
+ js_checker.JSChecker(*apis, file_filter=file_filter), |
+ resource_checker.ResourceChecker(*apis, file_filter=file_filter), |
+ ] |
+ results = [] |
+ |
+ for checker in checkers: |
+ results.extend(checker.RunChecks()) |
+ |
+ return results |