blob: d072c723a890d99075f26fec8d1bfdbbe2b95076 [file] [log] [blame]
skym0a8b6622016-10-27 23:34:231# Copyright 2016 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Presubmit script for browser_sync component.
6
7See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8for more details about the presubmit API built into depot_tools.
9"""
10
11import re
12
13BROWSER_SYNC_SOURCE_FILES = (r'^components[\\/]browser_sync[\\/].*\.(cc|h)$',)
14
skym95716a6042017-01-31 23:23:4415# The wrapper around lint that is called below disables a set of filters if the
16# passed filter evaluates to false. Pass a junk filter to avoid this behavior.
17LINT_FILTERS = ['+fake/filter']
18
skym0a8b6622016-10-27 23:34:2319def CheckChangeLintsClean(input_api, output_api):
20 source_filter = lambda x: input_api.FilterSourceFile(
21 x, white_list=BROWSER_SYNC_SOURCE_FILES, black_list=None)
22 return input_api.canned_checks.CheckChangeLintsClean(
skym95716a6042017-01-31 23:23:4423 input_api, output_api, source_filter, lint_filters=LINT_FILTERS,
24 verbose_level=1)
skym0a8b6622016-10-27 23:34:2325
26def CheckChanges(input_api, output_api):
27 results = []
28 results += CheckChangeLintsClean(input_api, output_api)
skym0a8b6622016-10-27 23:34:2329 return results
30
31def CheckChangeOnUpload(input_api, output_api):
32 return CheckChanges(input_api, output_api)
33
34def CheckChangeOnCommit(input_api, output_api):
35 return CheckChanges(input_api, output_api)