mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #5394
5394: Tell what has to be changed in check_header_guards.py r=Jupeyy a=def- Example: Wrong header guard in src/game/bezier.h, is: #ifndef GAAME_BEZIER_H, should be: #ifndef GAME_BEZIER_H <!-- What is the motivation for the changes of this pull request --> ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
commit
e9610306e1
|
@ -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
|
||||
if line.startswith("#ifndef"):
|
||||
header_guard = "#ifndef " + ("_".join(filename.split(PATH)[1].split("/"))[:-2]).upper() + "_H"
|
||||
if line.startswith("#ifndef"):
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue