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

Side by Side Diff: tools/web_dev_style/presubmit_support.py

Issue 2889113002: web_dev_style: Fix errors in new directories and enable PRESUBMIT (Closed)
Patch Set: merge+fix 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
OLDNEW
1 # Copyright 2017 The Chromium Authors. All rights reserved. 1 # Copyright 2017 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 5
6 import css_checker 6 import css_checker
7 import html_checker 7 import html_checker
8 import js_checker 8 import js_checker
9 import resource_checker 9 import resource_checker
10 10
11 11
12 def CheckStyle(input_api, output_api): 12 def CheckStyle(input_api, output_api, file_filter=lambda f: True):
13 apis = input_api, output_api 13 apis = input_api, output_api
14 is_resource = lambda f: f.LocalPath().endswith(('.html', '.css', '.js')) 14 is_resource = lambda f: f.LocalPath().endswith(('.html', '.css', '.js'))
15 wrapped_filter = lambda f: file_filter(f) and is_resource(f)
15 checkers = [ 16 checkers = [
16 css_checker.CSSChecker(*apis, file_filter=is_resource), 17 css_checker.CSSChecker(*apis, file_filter=wrapped_filter),
17 html_checker.HtmlChecker(*apis, file_filter=is_resource), 18 html_checker.HtmlChecker(*apis, file_filter=wrapped_filter),
18 js_checker.JSChecker(*apis, file_filter=is_resource), 19 js_checker.JSChecker(*apis, file_filter=wrapped_filter),
19 resource_checker.ResourceChecker(*apis, file_filter=is_resource), 20 resource_checker.ResourceChecker(*apis, file_filter=wrapped_filter),
20 ] 21 ]
21 results = [] 22 results = []
22 for checker in checkers: 23 for checker in checkers:
23 results.extend(checker.RunChecks()) 24 results.extend(checker.RunChecks())
24 return results 25 return results
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698