| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 sync_bookmarks component. | 5 """Presubmit script for sync_bookmarks component. |
| 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 SYNC_BOOKMARKS_SOURCE_FILES = ( | 13 SYNC_BOOKMARKS_SOURCE_FILES = ( |
| 14 r'^components[\\/]sync_bookmarks[\\/].*\.(cc|h)$',) | 14 r'^components[\\/]sync_bookmarks[\\/].*\.(cc|h)$',) |
| 15 | 15 |
| 16 # The wrapper around lint that is called below disables a set of filters if the | 16 # The wrapper around lint that is called below disables a set of filters if the |
| 17 # passed filter evaluates to false. Pass a junk filter to avoid this behavior. | 17 # passed filter evaluates to false. Pass a junk filter to avoid this behavior. |
| 18 LINT_FILTERS = ['+fake/filter'] | 18 LINT_FILTERS = ['+fake/filter'] |
| 19 | 19 |
| 20 def CheckChangeLintsClean(input_api, output_api): | 20 def CheckChangeLintsClean(input_api, output_api): |
| 21 source_filter = lambda x: input_api.FilterSourceFile( | 21 source_filter = lambda x: input_api.FilterSourceFile( |
| 22 x, white_list=SYNC_BOOKMARKS_SOURCE_FILES, black_list=None) | 22 x, white_list=SYNC_BOOKMARKS_SOURCE_FILES, black_list=None) |
| 23 return input_api.canned_checks.CheckChangeLintsClean( | 23 return input_api.canned_checks.CheckChangeLintsClean( |
| 24 input_api, output_api, source_filter, lint_filters=LINT_FILTERS, | 24 input_api, output_api, source_filter, lint_filters=LINT_FILTERS, |
| 25 verbose_level=1) | 25 verbose_level=1) |
| 26 | 26 |
| 27 def CheckChanges(input_api, output_api): | 27 def CheckChanges(input_api, output_api): |
| 28 results = [] | 28 results = [] |
| 29 results += CheckChangeLintsClean(input_api, output_api) | 29 results += CheckChangeLintsClean(input_api, output_api) |
| 30 results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) | |
| 31 return results | 30 return results |
| 32 | 31 |
| 33 def CheckChangeOnUpload(input_api, output_api): | 32 def CheckChangeOnUpload(input_api, output_api): |
| 34 return CheckChanges(input_api, output_api) | 33 return CheckChanges(input_api, output_api) |
| 35 | 34 |
| 36 def CheckChangeOnCommit(input_api, output_api): | 35 def CheckChangeOnCommit(input_api, output_api): |
| 37 return CheckChanges(input_api, output_api) | 36 return CheckChanges(input_api, output_api) |
| OLD | NEW |