| OLD | NEW |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Presubmit script for changes affecting chrome/browser/android/vr_shell | 5 """Presubmit script for changes affecting chrome/browser/android/vr_shell |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 for more details about the presubmit API built into depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import re | 11 import re |
| 12 | 12 |
| 13 # chrome/PRESUBMIT.py blocks several linters due to the infeasibility of | 13 # chrome/PRESUBMIT.py blocks several linters due to the infeasibility of |
| 14 # enforcing them on a large codebase. Here we'll start by enforcing all | 14 # enforcing them on a large codebase. Here we'll start by enforcing all |
| 15 # linters, and add exclusions if necessary. | 15 # linters, and add exclusions if necessary. |
| 16 # | 16 # |
| 17 # Note that this list must be non-empty, or cpplint will use its default set of | 17 # Note that this list must be non-empty, or cpplint will use its default set of |
| 18 # filters. Therefore, explicitly enable a single dummy linter. | 18 # filters. |
| 19 LINT_FILTERS = [ | 19 LINT_FILTERS = [ |
| 20 '+build/include', | 20 '-build/include', |
| 21 ] | 21 ] |
| 22 | 22 |
| 23 VERBOSITY_LEVEL = 4 | 23 VERBOSITY_LEVEL = 4 |
| 24 | 24 |
| 25 INCLUDE_CPP_FILES_ONLY = (r'.*\.(cc|h)$',) | 25 INCLUDE_CPP_FILES_ONLY = (r'.*\.(cc|h)$',) |
| 26 | 26 |
| 27 def _CheckChangeLintsClean(input_api, output_api): | 27 def _CheckChangeLintsClean(input_api, output_api): |
| 28 sources = lambda x: input_api.FilterSourceFile( | 28 sources = lambda x: input_api.FilterSourceFile( |
| 29 x, white_list=INCLUDE_CPP_FILES_ONLY) | 29 x, white_list=INCLUDE_CPP_FILES_ONLY) |
| 30 return input_api.canned_checks.CheckChangeLintsClean( | 30 return input_api.canned_checks.CheckChangeLintsClean( |
| 31 input_api, output_api, sources, LINT_FILTERS, VERBOSITY_LEVEL) | 31 input_api, output_api, sources, LINT_FILTERS, VERBOSITY_LEVEL) |
| 32 | 32 |
| 33 def CheckChangeOnUpload(input_api, output_api): | 33 def CheckChangeOnUpload(input_api, output_api): |
| 34 results = [] | 34 results = [] |
| 35 results.extend(_CheckChangeLintsClean(input_api, output_api)) | 35 results.extend(_CheckChangeLintsClean(input_api, output_api)) |
| 36 return results | 36 return results |
| 37 | 37 |
| 38 def CheckChangeOnCommit(input_api, output_api): | 38 def CheckChangeOnCommit(input_api, output_api): |
| 39 results = [] | 39 results = [] |
| 40 results.extend(_CheckChangeLintsClean(input_api, output_api)) | 40 results.extend(_CheckChangeLintsClean(input_api, output_api)) |
| 41 return results | 41 return results |
| OLD | NEW |