@ -805,9 +805,11 @@ def CheckLicense(input_api,
bad_files . append ( f . LocalPath ( ) )
bad_files . append ( f . LocalPath ( ) )
results = [ ]
results = [ ]
if bad_new_files :
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 :
if license_re_param :
error_message = ( ' License on new files must match: \n \n %s \n ' %
warning _message = ( ' License on new files must match: \n \n %s \n ' %
license_re_param )
license_re_param )
else :
else :
# Verbatim text that can be copy-pasted into new files (possibly
# Verbatim text that can be copy-pasted into new files (possibly
# adjusting the leading comment delimiter).
# adjusting the leading comment delimiter).
@ -819,14 +821,16 @@ def CheckLicense(input_api,
' project ' : project_name ,
' project ' : project_name ,
' key_line ' : key_line ,
' key_line ' : key_line ,
}
}
error _message = (
warning _message = (
' License on new files must be: \n \n %s \n ' % new_license_text +
' License on new files must be: \n \n %s \n ' % new_license_text +
' (adjusting the comment delimiter accordingly). \n \n ' +
' (adjusting the comment delimiter accordingly). \n \n ' +
' If this is a moved file, then update the license but do not ' +
' If this is a moved file, then update the license but do not ' +
' update the year. \n \n ' )
' update the year. \n \n ' +
error_message + = ' Found a bad license header in these new or moved files: '
' 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 (
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 :
if wrong_year_new_files :
# We can't distinguish between new and moved files, so this has to be a
# We can't distinguish between new and moved files, so this has to be a
# warning rather than an error.
# warning rather than an error.