1 # 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.
5 """Presubmit script for app_list.
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into depot_tools.
11 CC_SOURCE_FILES
=(r
'^cc/.*\.(cc|h)$',)
13 def 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
21 for file_name
in files
:
22 input_api
.cpplint
.ProcessFile(file_name
, level
)
24 if not input_api
.cpplint
._cpplint
_state
.error_count
:
27 return [output_api
.PresubmitPromptWarning(
28 'Changelist failed cpplint.py check.')]
30 def CheckChangeOnUpload(input_api
, output_api
):
32 results
+= CheckChangeLintsClean(input_api
, output_api
)
33 results
+= input_api
.canned_checks
.CheckPatchFormatted(input_api
, output_api
)