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

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

Issue 293843002: checklicenses: Do not report unused suppressions when checking a sub-directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 7 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 # 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 that all files contain proper licensing information.""" 6 """Makes sure that all files contain proper licensing information."""
7 7
8 8
9 import optparse 9 import optparse
10 import os.path 10 import os.path
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 if matched_prefixes: 453 if matched_prefixes:
454 used_suppressions.update(set(matched_prefixes)) 454 used_suppressions.update(set(matched_prefixes))
455 continue 455 continue
456 456
457 print "'%s' has non-whitelisted license '%s'" % (filename, license) 457 print "'%s' has non-whitelisted license '%s'" % (filename, license)
458 success = False 458 success = False
459 459
460 if success: 460 if success:
461 print "\nSUCCESS\n" 461 print "\nSUCCESS\n"
462 462
463 unused_suppressions = set( 463 if not len(args):
464 PATH_SPECIFIC_WHITELISTED_LICENSES.keys()).difference(used_suppressions) 464 unused_suppressions = set(
465 if unused_suppressions: 465 PATH_SPECIFIC_WHITELISTED_LICENSES.keys()).difference(used_suppressions)
466 print "\nNOTE: unused suppressions detected:\n" 466 if unused_suppressions:
467 print '\n'.join(unused_suppressions) 467 print "\nNOTE: unused suppressions detected:\n"
468 print '\n'.join(unused_suppressions)
468 469
469 return 0 470 return 0
470 else: 471 else:
471 print "\nFAILED\n" 472 print "\nFAILED\n"
472 print "Please read", 473 print "Please read",
473 print "http://www.chromium.org/developers/adding-3rd-party-libraries" 474 print "http://www.chromium.org/developers/adding-3rd-party-libraries"
474 print "for more info how to handle the failure." 475 print "for more info how to handle the failure."
475 print 476 print
476 print "Please respect OWNERS of checklicenses.py. Changes violating" 477 print "Please respect OWNERS of checklicenses.py. Changes violating"
477 print "this requirement may be reverted." 478 print "this requirement may be reverted."
(...skipping 19 matching lines...) Expand all
497 option_parser.add_option('--ignore-suppressions', 498 option_parser.add_option('--ignore-suppressions',
498 action='store_true', 499 action='store_true',
499 default=False, 500 default=False,
500 help='Ignore path-specific license whitelist.') 501 help='Ignore path-specific license whitelist.')
501 options, args = option_parser.parse_args() 502 options, args = option_parser.parse_args()
502 return check_licenses(options, args) 503 return check_licenses(options, args)
503 504
504 505
505 if '__main__' == __name__: 506 if '__main__' == __name__:
506 sys.exit(main()) 507 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