Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: PRESUBMIT.py

Issue 2522673002: Check include order on cpp files as well (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698