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

Side by Side Diff: tools/presubmit.py

Issue 2490783004: [serializer] small fixes for blink snapshot. (Closed)
Patch Set: rebase and fix 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 | « tools/external-reference-check.py ('k') | 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 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 handle = open(file) 389 handle = open(file)
390 contents = handle.read() 390 contents = handle.read()
391 if not self.ProcessContents(file, contents): 391 if not self.ProcessContents(file, contents):
392 success = False 392 success = False
393 violations += 1 393 violations += 1
394 finally: 394 finally:
395 handle.close() 395 handle.close()
396 print "Total violating files: %s" % violations 396 print "Total violating files: %s" % violations
397 return success 397 return success
398 398
399
400 def CheckExternalReferenceRegistration(workspace):
401 code = subprocess.call(
402 [sys.executable, join(workspace, "tools", "external-reference-check.py")])
403 return code == 0
404
405
406 def _CheckStatusFileForDuplicateKeys(filepath): 399 def _CheckStatusFileForDuplicateKeys(filepath):
407 comma_space_bracket = re.compile(", *]") 400 comma_space_bracket = re.compile(", *]")
408 lines = [] 401 lines = []
409 with open(filepath) as f: 402 with open(filepath) as f:
410 for line in f.readlines(): 403 for line in f.readlines():
411 # Skip all-comment lines. 404 # Skip all-comment lines.
412 if line.lstrip().startswith("#"): continue 405 if line.lstrip().startswith("#"): continue
413 # Strip away comments at the end of the line. 406 # Strip away comments at the end of the line.
414 comment_start = line.find("#") 407 comment_start = line.find("#")
415 if comment_start != -1: 408 if comment_start != -1:
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 workspace = abspath(join(dirname(sys.argv[0]), '..')) 489 workspace = abspath(join(dirname(sys.argv[0]), '..'))
497 parser = GetOptions() 490 parser = GetOptions()
498 (options, args) = parser.parse_args() 491 (options, args) = parser.parse_args()
499 success = True 492 success = True
500 print "Running C++ lint check..." 493 print "Running C++ lint check..."
501 if not options.no_lint: 494 if not options.no_lint:
502 success &= CppLintProcessor().Run(workspace) 495 success &= CppLintProcessor().Run(workspace)
503 print "Running copyright header, trailing whitespaces and " \ 496 print "Running copyright header, trailing whitespaces and " \
504 "two empty lines between declarations check..." 497 "two empty lines between declarations check..."
505 success &= SourceProcessor().Run(workspace) 498 success &= SourceProcessor().Run(workspace)
506 success &= CheckExternalReferenceRegistration(workspace)
507 success &= CheckStatusFiles(workspace) 499 success &= CheckStatusFiles(workspace)
508 if success: 500 if success:
509 return 0 501 return 0
510 else: 502 else:
511 return 1 503 return 1
512 504
513 505
514 if __name__ == '__main__': 506 if __name__ == '__main__':
515 sys.exit(Main()) 507 sys.exit(Main())
OLDNEW
« no previous file with comments | « tools/external-reference-check.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698