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

Side by Side Diff: presubmit_canned_checks.py

Issue 10005029: Ensure .mk files aren't included in the tab character check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 8 years, 8 months 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 | Annotate | Revision Log
« 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 (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Generic presubmit checks that can be reused by other presubmit checks.""" 5 """Generic presubmit checks that can be reused by other presubmit checks."""
6 6
7 7
8 ### Description checks 8 ### Description checks
9 9
10 def CheckChangeHasTestField(input_api, output_api): 10 def CheckChangeHasTestField(input_api, output_api):
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 def CheckChangeHasNoTabs(input_api, output_api, source_file_filter=None): 265 def CheckChangeHasNoTabs(input_api, output_api, source_file_filter=None):
266 """Checks that there are no tab characters in any of the text files to be 266 """Checks that there are no tab characters in any of the text files to be
267 submitted. 267 submitted.
268 """ 268 """
269 # In addition to the filter, make sure that makefiles are blacklisted. 269 # In addition to the filter, make sure that makefiles are blacklisted.
270 if not source_file_filter: 270 if not source_file_filter:
271 # It's the default filter. 271 # It's the default filter.
272 source_file_filter = input_api.FilterSourceFile 272 source_file_filter = input_api.FilterSourceFile
273 def filter_more(affected_file): 273 def filter_more(affected_file):
274 return (not input_api.os_path.basename(affected_file.LocalPath()) in 274 basename = input_api.os_path.basename(affected_file.LocalPath())
275 ('Makefile', 'makefile') and 275 return (not (basename in ('Makefile', 'makefile') or
276 basename.endswith('.mk')) and
276 source_file_filter(affected_file)) 277 source_file_filter(affected_file))
277 278
278 tabs = _FindNewViolationsOfRule(lambda _, line : '\t' not in line, 279 tabs = _FindNewViolationsOfRule(lambda _, line : '\t' not in line,
279 input_api, filter_more) 280 input_api, filter_more)
280 281
281 if tabs: 282 if tabs:
282 return [output_api.PresubmitPromptWarning('Found a tab character in:', 283 return [output_api.PresubmitPromptWarning('Found a tab character in:',
283 long_text='\n'.join(tabs))] 284 long_text='\n'.join(tabs))]
284 return [] 285 return []
285 286
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( 938 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes(
938 input_api, output_api)) 939 input_api, output_api))
939 snapshot("checking license") 940 snapshot("checking license")
940 results.extend(input_api.canned_checks.CheckLicense( 941 results.extend(input_api.canned_checks.CheckLicense(
941 input_api, output_api, license_header, source_file_filter=sources)) 942 input_api, output_api, license_header, source_file_filter=sources))
942 snapshot("checking was uploaded") 943 snapshot("checking was uploaded")
943 results.extend(input_api.canned_checks.CheckChangeWasUploaded( 944 results.extend(input_api.canned_checks.CheckChangeWasUploaded(
944 input_api, output_api)) 945 input_api, output_api))
945 snapshot("done") 946 snapshot("done")
946 return results 947 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