def setUp(self): SuperMoxTestBase.setUp(self) input_api = self.mox.CreateMockAnything() input_api.re = re output_api = self.mox.CreateMockAnything() self.checker = resource_checker.ResourceChecker(input_api, output_api)
def CheckStyle(input_api, output_api): apis = input_api, output_api is_resource = lambda f: f.LocalPath().endswith(('.html', '.css', '.js')) checkers = [ css_checker.CSSChecker(*apis, file_filter=is_resource), html_checker.HtmlChecker(*apis, file_filter=is_resource), js_checker.JSChecker(*apis, file_filter=is_resource), resource_checker.ResourceChecker(*apis, file_filter=is_resource), ] results = [] for checker in checkers: results.extend(checker.RunChecks()) return results
def CheckStyle(input_api, output_api, file_filter=lambda f: True): apis = input_api, output_api wrapped_filter = lambda f: file_filter(f) and IsResource(f) checkers = [ css_checker.CSSChecker(*apis, file_filter=wrapped_filter), html_checker.HtmlChecker(*apis, file_filter=wrapped_filter), js_checker.JSChecker(*apis, file_filter=wrapped_filter), resource_checker.ResourceChecker(*apis, file_filter=wrapped_filter), ] results = [] for checker in checkers: results.extend(checker.RunChecks()) return results
def DisallowIncludes(input_api, output_api, msg): return resource_checker.ResourceChecker( input_api, output_api, file_filter=IsResource).DisallowIncludes(msg)
def setUp(self): super(ResourceCheckerTest, self).setUp() self.checker = resource_checker.ResourceChecker( MockInputApi(), MockOutputApi())