| 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 pdfium. | 5 """Presubmit script for pdfium. |
| 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 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 Each region separated by #if, #elif, #else, #endif, #define and #undef follows | 233 Each region separated by #if, #elif, #else, #endif, #define and #undef follows |
| 234 these rules separately. | 234 these rules separately. |
| 235 """ | 235 """ |
| 236 def FileFilterIncludeOrder(affected_file): | 236 def FileFilterIncludeOrder(affected_file): |
| 237 black_list = (input_api.DEFAULT_BLACK_LIST) | 237 black_list = (input_api.DEFAULT_BLACK_LIST) |
| 238 return input_api.FilterSourceFile(affected_file, black_list=black_list) | 238 return input_api.FilterSourceFile(affected_file, black_list=black_list) |
| 239 | 239 |
| 240 warnings = [] | 240 warnings = [] |
| 241 for f in input_api.AffectedFiles(file_filter=FileFilterIncludeOrder): | 241 for f in input_api.AffectedFiles(file_filter=FileFilterIncludeOrder): |
| 242 if f.LocalPath().endswith(('.cc', '.h', '.mm')): | 242 if f.LocalPath().endswith(('.cc', '.cpp', '.h', '.mm')): |
| 243 changed_linenums = set(line_num for line_num, _ in f.ChangedContents()) | 243 changed_linenums = set(line_num for line_num, _ in f.ChangedContents()) |
| 244 warnings.extend(_CheckIncludeOrderInFile(input_api, f, changed_linenums)) | 244 warnings.extend(_CheckIncludeOrderInFile(input_api, f, changed_linenums)) |
| 245 | 245 |
| 246 results = [] | 246 results = [] |
| 247 if warnings: | 247 if warnings: |
| 248 results.append(output_api.PresubmitPromptOrNotify(_INCLUDE_ORDER_WARNING, | 248 results.append(output_api.PresubmitPromptOrNotify(_INCLUDE_ORDER_WARNING, |
| 249 warnings)) | 249 warnings)) |
| 250 return results | 250 return results |
| 251 | 251 |
| 252 | 252 |
| 253 def CheckChangeOnUpload(input_api, output_api): | 253 def CheckChangeOnUpload(input_api, output_api): |
| 254 results = [] | 254 results = [] |
| 255 results += _CheckUnwantedDependencies(input_api, output_api) | 255 results += _CheckUnwantedDependencies(input_api, output_api) |
| 256 results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) | 256 results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) |
| 257 results += input_api.canned_checks.CheckChangeLintsClean( | 257 results += input_api.canned_checks.CheckChangeLintsClean( |
| 258 input_api, output_api, None, LINT_FILTERS) | 258 input_api, output_api, None, LINT_FILTERS) |
| 259 results += _CheckIncludeOrder(input_api, output_api) | 259 results += _CheckIncludeOrder(input_api, output_api) |
| 260 | 260 |
| 261 return results | 261 return results |
| OLD | NEW |