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

Side by Side Diff: tools/checkperms/checkperms.py

Issue 1395493002: Improve error messages from checkperms PRESUBMIT check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « third_party/WebKit/PRESUBMIT.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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Makes sure files have the right permissions. 6 """Makes sure files have the right permissions.
7 7
8 Some developers have broken SCM configurations that flip the executable 8 Some developers have broken SCM configurations that flip the executable
9 permission on for no good reason. Unix developers who run ls --color will then 9 permission on for no good reason. Unix developers who run ls --color will then
10 see .cc files in green and get confused. 10 see .cc files in green and get confused.
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 levels = [logging.ERROR, logging.INFO, logging.DEBUG] 436 levels = [logging.ERROR, logging.INFO, logging.DEBUG]
437 logging.basicConfig(level=levels[min(len(levels) - 1, options.verbose)]) 437 logging.basicConfig(level=levels[min(len(levels) - 1, options.verbose)])
438 438
439 if len(args) > 1: 439 if len(args) > 1:
440 parser.error('Too many arguments used') 440 parser.error('Too many arguments used')
441 441
442 if options.root: 442 if options.root:
443 options.root = os.path.abspath(options.root) 443 options.root = os.path.abspath(options.root)
444 444
445 if options.files: 445 if options.files:
446 # --file implies --bare (for PRESUBMIT.py).
447 options.bare = True
448
449 errors = check_files(options.root, options.files) 446 errors = check_files(options.root, options.files)
450 else: 447 else:
451 api = get_scm(options.root, options.bare) 448 api = get_scm(options.root, options.bare)
452 start_dir = args[0] if args else api.root_dir 449 start_dir = args[0] if args else api.root_dir
453 errors = api.check(start_dir) 450 errors = api.check(start_dir)
454 451
455 if not options.bare: 452 if not options.bare:
456 print('Processed %s files, %d files where tested for shebang/ELF ' 453 print('Processed %s files, %d files where tested for shebang/ELF '
457 'header' % (api.count, api.count_read_header)) 454 'header' % (api.count, api.count_read_header))
458 455
459 if options.json: 456 if options.json:
460 with open(options.json, 'w') as f: 457 with open(options.json, 'w') as f:
461 json.dump(errors, f) 458 json.dump(errors, f)
462 459
463 if errors: 460 if errors:
464 if options.bare: 461 if options.bare:
465 print '\n'.join(e['full_path'] for e in errors) 462 print '\n'.join(e['full_path'] for e in errors)
466 else: 463 else:
467 print '\nFAILED\n' 464 print '\nFAILED\n'
468 print '\n'.join('%s: %s' % (e['full_path'], e['error']) for e in errors) 465 print '\n'.join('%s: %s' % (e['full_path'], e['error']) for e in errors)
469 return 1 466 return 1
470 if not options.bare: 467 if not options.bare:
471 print '\nSUCCESS\n' 468 print '\nSUCCESS\n'
472 return 0 469 return 0
473 470
474 471
475 if '__main__' == __name__: 472 if '__main__' == __name__:
476 sys.exit(main()) 473 sys.exit(main())
OLDNEW
« no previous file with comments | « third_party/WebKit/PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698