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