blob: ec96af4480ac74a4889acd1d676587fe4f23c4d5 [file] [log] [blame]
[email protected]ee99b702014-02-18 03:54:111# Copyright 2014 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 app_list.
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
[email protected]5d723232014-03-04 22:19:4611CC_SOURCE_FILES=(r'^cc/.*\.(cc|h)$',)
12
13def CheckChangeLintsClean(input_api, output_api):
14 input_api.cpplint._cpplint_state.ResetErrorCounts() # reset global state
15 source_filter = lambda x: input_api.FilterSourceFile(
16 x, white_list=CC_SOURCE_FILES, black_list=None)
17 files = [f.AbsoluteLocalPath() for f in
18 input_api.AffectedSourceFiles(source_filter)]
19 level = 1 # strict, but just warn
20
21 for file_name in files:
22 input_api.cpplint.ProcessFile(file_name, level)
23
24 if not input_api.cpplint._cpplint_state.error_count:
25 return []
26
27 return [output_api.PresubmitPromptWarning(
28 'Changelist failed cpplint.py check.')]
29
[email protected]ee99b702014-02-18 03:54:1130def CheckChangeOnUpload(input_api, output_api):
31 results = []
[email protected]5d723232014-03-04 22:19:4632 results += CheckChangeLintsClean(input_api, output_api)
[email protected]ee99b702014-02-18 03:54:1133 results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api)
34 return results