Fix issues with check_format.py (#667)

* Made format_check use os.sep when checking if it should ignore a folder

* Made format_check specify utf-8 encoding when loading files.

* Fixed documentation using wrong filename for format_check.py
This commit is contained in:
Mikael Klages 2024-09-04 20:53:02 +02:00 committed by GitHub
parent 830db8185e
commit 2950c152bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -50,7 +50,7 @@ sudo apt install libgl-dev libasound2-dev libx11-dev libxcursor-dev libxrandr-de
# Contributing
### Code
Try to follow the style of the existing code. The `check_format.py` file can be used to find violations of indentation and line endings. `// TODO: Add a full style guide` <br>
Try to follow the style of the existing code. The `format_check.py` file can be used to find violations of indentation and line endings. `// TODO: Add a full style guide` <br>
If you have any more questions, you can ask them over on [Discord](https://discord.gg/XtqCRRG).
### Textures
If you want to add new textures, make sure they fit the style of the game. It's recommended that you have baseline skills in pixel art before attempting to make textures. A great collection of tutorials can be found [here](https://lospec.com/pixel-art-tutorials)

View File

@ -10,14 +10,14 @@ for subdir, dirs, files in os.walk("."):
for file in files:
#print os.path.join(subdir, file)
filepath = subdir + os.sep + file
if filepath.startswith("./compiler"): continue
if filepath.startswith("./saves"): continue
if filepath.startswith("./serverAssets"): continue
if filepath.startswith("./zig-cache"): continue
if filepath.startswith("./.zig-cache"): continue
if filepath.startswith(f".{os.sep}compiler"): continue
if filepath.startswith(f".{os.sep}saves"): continue
if filepath.startswith(f".{os.sep}serverAssets"): continue
if filepath.startswith(f".{os.sep}zig-cache"): continue
if filepath.startswith(f".{os.sep}.zig-cache"): continue
if filepath.endswith(".json") or filepath.endswith(".zig") or filepath.endswith(".py") or filepath.endswith(".zon") or filepath.endswith(".vs") or filepath.endswith(".fs") or filepath.endswith(".glsl"):
with open(filepath, "r", newline = '') as f:
with open(filepath, "r", newline = '', encoding="utf-8") as f:
string = f.read()
line = 1
lineStart = True