diff --git a/tools/StyleChecks/check_copyright.py b/tools/StyleChecks/check_copyright.py index 97da8c35814..721542ea9ae 100644 --- a/tools/StyleChecks/check_copyright.py +++ b/tools/StyleChecks/check_copyright.py @@ -48,13 +48,17 @@ pattern = '^.{1,5}%s$' % line regexes.append(re.compile(pattern)) -def report_incorrect(file_name, pairs): +def report_incorrect(file_name, pairs, fail_line): # found a problem so report the problem to the caller and exit print(file_name, "... does not contain a correct copyright notice.\n") # print the relevant lines to help the reader find the problem for (_, line) in pairs: print(" ", line, end="") print() + if (fail_line != ""): + print("Match failed at line:") + print(" ", fail_line, end="") + print() linecount = 0 pairs = [] @@ -69,12 +73,12 @@ def report_incorrect(file_name, pairs): line = line.rstrip() matches = regex.match(line) if not matches: - report_incorrect(file_name, pairs) + report_incorrect(file_name, pairs, line) exit(1) if linecount == 0: # the file was empty (e.g. dummy.js) so no problem exit(0) elif linecount != len(regexes): - report_incorrect(file_name, pairs) + report_incorrect(file_name, pairs, "") exit(1)