Tell what has to be changed in check_header_guards.py

Example:

Wrong header guard in src/game/bezier.h, is: #ifndef GAAME_BEZIER_H, should be: #ifndef GAME_BEZIER_H
This commit is contained in:
def 2022-06-12 12:34:20 +02:00
parent 47b9bccd38
commit 23af9ef448

View file

@ -23,14 +23,14 @@ def check_file(filename):
break
if line[0] == "/" or line[0] == "*" or line[0] == "\r" or line[0] == "\n" or line[0] == "\t":
continue
header_guard = "#ifndef " + ("_".join(filename.split(PATH)[1].split("/"))[:-2]).upper() + "_H"
if line.startswith("#ifndef"):
header_guard = "#ifndef " + ("_".join(filename.split(PATH)[1].split("/"))[:-2]).upper() + "_H"
if line[:-1] != header_guard:
error = True
print("Wrong header guard in {}".format(filename))
print("Wrong header guard in {}, is: {}, should be: {}".format(filename, line[:-1], header_guard))
else:
error = True
print("Missing header guard in {}".format(filename))
print("Missing header guard in {}, should be: {}".format(filename, header_guard))
break
return error