blob: e4ed67530db836b0d1e9cb7f6e66a3cbb320027b [file] [log] [blame]
skymd101f272015-10-12 21:52:181# Copyright 2015 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
skym0a8b6622016-10-27 23:34:235"""Presubmit script for sync_sessions component.
skymd101f272015-10-12 21:52:186
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
skym0a8b6622016-10-27 23:34:2313SYNC_SESSIONS_SOURCE_FILES = (r'^components[\\/]sync_sessions[\\/].*\.(cc|h)$',)
skymd101f272015-10-12 21:52:1814
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
skymd101f272015-10-12 21:52:1819def CheckChangeLintsClean(input_api, output_api):
20 source_filter = lambda x: input_api.FilterSourceFile(
21 x, white_list=SYNC_SESSIONS_SOURCE_FILES, black_list=None)
skymd101f272015-10-12 21:52:1822 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)
skymd101f272015-10-12 21:52:1825
skym0a8b6622016-10-27 23:34:2326def CheckChanges(input_api, output_api):
skymd101f272015-10-12 21:52:1827 results = []
28 results += CheckChangeLintsClean(input_api, output_api)
29 return results
skym0a8b6622016-10-27 23:34:2330
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)