mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 01:24:18 +00:00
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:
parent
47b9bccd38
commit
23af9ef448
|
@ -23,14 +23,14 @@ def check_file(filename):
|
||||||
break
|
break
|
||||||
if line[0] == "/" or line[0] == "*" or line[0] == "\r" or line[0] == "\n" or line[0] == "\t":
|
if line[0] == "/" or line[0] == "*" or line[0] == "\r" or line[0] == "\n" or line[0] == "\t":
|
||||||
continue
|
continue
|
||||||
|
header_guard = "#ifndef " + ("_".join(filename.split(PATH)[1].split("/"))[:-2]).upper() + "_H"
|
||||||
if line.startswith("#ifndef"):
|
if line.startswith("#ifndef"):
|
||||||
header_guard = "#ifndef " + ("_".join(filename.split(PATH)[1].split("/"))[:-2]).upper() + "_H"
|
|
||||||
if line[:-1] != header_guard:
|
if line[:-1] != header_guard:
|
||||||
error = True
|
error = True
|
||||||
print("Wrong header guard in {}".format(filename))
|
print("Wrong header guard in {}, is: {}, should be: {}".format(filename, line[:-1], header_guard))
|
||||||
else:
|
else:
|
||||||
error = True
|
error = True
|
||||||
print("Missing header guard in {}".format(filename))
|
print("Missing header guard in {}, should be: {}".format(filename, header_guard))
|
||||||
break
|
break
|
||||||
return error
|
return error
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue