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

Side by Side Diff: tools/presubmit.py

Issue 7795050: Presubmit output to distinguish check phases. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2011 the V8 project authors. All rights reserved. 3 # Copyright 2011 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 linenumbers = ', '.join(lines) 304 linenumbers = ', '.join(lines)
305 if len(lines) > 1: 305 if len(lines) > 1:
306 print "%s has trailing whitespaces in lines %s." % (name, linenumbers) 306 print "%s has trailing whitespaces in lines %s." % (name, linenumbers)
307 else: 307 else:
308 print "%s has trailing whitespaces in line %s." % (name, linenumbers) 308 print "%s has trailing whitespaces in line %s." % (name, linenumbers)
309 result = False 309 result = False
310 return result 310 return result
311 311
312 def ProcessFiles(self, files, path): 312 def ProcessFiles(self, files, path):
313 success = True 313 success = True
314 violations = 0
314 for file in files: 315 for file in files:
315 try: 316 try:
316 handle = open(file) 317 handle = open(file)
317 contents = handle.read() 318 contents = handle.read()
318 success = self.ProcessContents(file, contents) and success 319 if not self.ProcessContents(file, contents):
320 success = False
321 violations += 1
319 finally: 322 finally:
320 handle.close() 323 handle.close()
324 print "Total violating files: %s" % violations
321 return success 325 return success
322 326
323 327
324 def GetOptions(): 328 def GetOptions():
325 result = optparse.OptionParser() 329 result = optparse.OptionParser()
326 result.add_option('--no-lint', help="Do not run cpplint", default=False, 330 result.add_option('--no-lint', help="Do not run cpplint", default=False,
327 action="store_true") 331 action="store_true")
328 return result 332 return result
329 333
330 334
331 def Main(): 335 def Main():
332 workspace = abspath(join(dirname(sys.argv[0]), '..')) 336 workspace = abspath(join(dirname(sys.argv[0]), '..'))
333 parser = GetOptions() 337 parser = GetOptions()
334 (options, args) = parser.parse_args() 338 (options, args) = parser.parse_args()
335 success = True 339 success = True
340 print "Running C++ lint check..."
336 if not options.no_lint: 341 if not options.no_lint:
337 success = CppLintProcessor().Run(workspace) and success 342 success = CppLintProcessor().Run(workspace) and success
343 print "Running copyright header and trailing whitespaces check..."
338 success = SourceProcessor().Run(workspace) and success 344 success = SourceProcessor().Run(workspace) and success
339 if success: 345 if success:
340 return 0 346 return 0
341 else: 347 else:
342 return 1 348 return 1
343 349
344 350
345 if __name__ == '__main__': 351 if __name__ == '__main__':
346 sys.exit(Main()) 352 sys.exit(Main())
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