diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index 5f0621341..9ca63391c 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -805,9 +805,11 @@ def CheckLicense(input_api, bad_files.append(f.LocalPath()) results = [] if bad_new_files: + # We can't distinguish between Google and thirty-party files, so this has to be a + # warning rather than an error. if license_re_param: - error_message = ('License on new files must match:\n\n%s\n' % - license_re_param) + warning_message = ('License on new files must match:\n\n%s\n' % + license_re_param) else: # Verbatim text that can be copy-pasted into new files (possibly # adjusting the leading comment delimiter). @@ -819,14 +821,16 @@ def CheckLicense(input_api, 'project': project_name, 'key_line': key_line, } - error_message = ( + warning_message = ( 'License on new files must be:\n\n%s\n' % new_license_text + '(adjusting the comment delimiter accordingly).\n\n' + 'If this is a moved file, then update the license but do not ' + - 'update the year.\n\n') - error_message += 'Found a bad license header in these new or moved files:' + 'update the year.\n\n' + + 'If this is a third-party file then ignore this warning.\n\n') + warning_message += 'Found a bad license header in these new or moved files:' results.append( - output_api.PresubmitError(error_message, items=bad_new_files)) + output_api.PresubmitPromptWarning(warning_message, + items=bad_new_files)) if wrong_year_new_files: # We can't distinguish between new and moved files, so this has to be a # warning rather than an error. diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index ec2dc8891..2388b9c9e 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -2555,7 +2555,7 @@ the current line as well! self._LicenseCheck(text, license_text, False, - presubmit.OutputApi.PresubmitError, + presubmit.OutputApi.PresubmitPromptWarning, new_file=True) def _GetLicenseText(self, current_year):