Merge pull request #10556 from AffectedArc07/lf-ci

CI to check for wrong line ending
This commit is contained in:
Ghom
2020-01-13 13:14:42 +01:00
committed by GitHub
3 changed files with 3245 additions and 3197 deletions
+1
View File
@@ -26,6 +26,7 @@ matrix:
- find . -name "*.json" -not -path "./tgui/node_modules/*" -print0 | xargs -0 python3 ./tools/json_verifier.py
- tools/travis/build_tgui.sh
- tools/travis/check_grep.sh
- python3 tools/travis/check_line_endings.py
- ~/dreamchecker
- name: "Compile All Maps"
+3197 -3197
View File
File diff suppressed because it is too large Load Diff
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env python
import os
import sys
import glob
WINDOWS_NEWLINE = b'\r\n'
FILES_TO_READ = []
FILES_TO_READ.extend(glob.glob(r"**\*.dm", recursive=True))
FILES_TO_READ.extend(glob.glob(r"**\*.dmm", recursive=True))
FILES_TO_READ.extend(glob.glob(r"*.dme"))
#for i in FILES_TO_READ:
# if os.path.isdir(i):
# FILES_TO_READ.remove(i)
def _reader(filepath):
data = open(filepath, "rb")
return data
def main():
filelist = []
foundfiles = False
for file in FILES_TO_READ:
data = _reader(file)
lines = data.readlines()
for line in lines:
if line.endswith(WINDOWS_NEWLINE):
filelist.append(file)
foundfiles = True
break
data.close()
if not foundfiles:
print("No CRLF files found.")
sys.exit(0)
else:
print("Found files with suspected CRLF type.")
for i in filelist:
print(i)
sys.exit(1)
if __name__ == "__main__":
main()