OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """Utilities for scanning source files to determine code authorship. | 5 """Utilities for scanning source files to determine code authorship. |
6 """ | 6 """ |
7 | 7 |
8 import itertools | 8 import itertools |
9 | 9 |
10 def ForwardSlashesToOsPathSeps(input_api, path): | 10 def ForwardSlashesToOsPathSeps(input_api, path): |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 # deleted, the scanner will not complain. | 369 # deleted, the scanner will not complain. |
370 files_to_check |= whitelisted_files | deleted_files | 370 files_to_check |= whitelisted_files | deleted_files |
371 | 371 |
372 (unknown_files, missing_files, stale_files) = _DoScanAtPresubmit( | 372 (unknown_files, missing_files, stale_files) = _DoScanAtPresubmit( |
373 input_api, list(whitelisted_files), list(files_to_check)) | 373 input_api, list(whitelisted_files), list(files_to_check)) |
374 results = [] | 374 results = [] |
375 if unknown_files: | 375 if unknown_files: |
376 results.append(output_api.PresubmitError( | 376 results.append(output_api.PresubmitError( |
377 'The following files contain a third-party license but are not in ' \ | 377 'The following files contain a third-party license but are not in ' \ |
378 'a listed third-party directory and are not whitelisted. You must ' \ | 378 'a listed third-party directory and are not whitelisted. You must ' \ |
379 'add the following files to the whitelist file ' \ | 379 'add the following files to the whitelist file %s\n' \ |
380 '%s:' % _GetWhitelistFileName(input_api), | 380 '(Note that if the code you are adding does not actually contain ' \ |
| 381 'any third-party code, it may contain the word "copyright", which ' \ |
| 382 'should be masked out, e.g. by writing it as "copy-right"):' \ |
| 383 '' % _GetWhitelistFileName(input_api), |
381 sorted(unknown_files))) | 384 sorted(unknown_files))) |
382 if missing_files: | 385 if missing_files: |
383 results.append(output_api.PresubmitPromptWarning( | 386 results.append(output_api.PresubmitPromptWarning( |
384 'The following files are whitelisted in %s, ' \ | 387 'The following files are whitelisted in %s, ' \ |
385 'but do not exist or not files:' % _GetWhitelistFileName(input_api), | 388 'but do not exist or not files:' % _GetWhitelistFileName(input_api), |
386 sorted(missing_files))) | 389 sorted(missing_files))) |
387 if stale_files: | 390 if stale_files: |
388 results.append(output_api.PresubmitPromptWarning( | 391 results.append(output_api.PresubmitPromptWarning( |
389 'The following files are whitelisted unnecessarily. You must ' \ | 392 'The following files are whitelisted unnecessarily. You must ' \ |
390 'remove the following files from the whitelist file ' \ | 393 'remove the following files from the whitelist file ' \ |
391 '%s:' % _GetWhitelistFileName(input_api), | 394 '%s:' % _GetWhitelistFileName(input_api), |
392 sorted(stale_files))) | 395 sorted(stale_files))) |
393 return results | 396 return results |
OLD | NEW |