Add untick file check to CI. (#19618)

* Add untick file check to CI.

* Time for some caveman debugging

* Software's real neat
This commit is contained in:
warriorstar-orion
2022-11-06 07:24:47 -05:00
committed by GitHub
parent 332fc9193a
commit eb54090eeb
2 changed files with 11 additions and 2 deletions
+1
View File
@@ -28,6 +28,7 @@ jobs:
tools/ci/build_tgui.sh
tools/ci/check_grep.sh
python3 tools/ci/check_line_endings.py
python3 tools/ci/unticked_files.py ${GITHUB_WORKSPACE}
~/dreamchecker > ${GITHUB_WORKSPACE}/output-annotations.txt 2>&1
- name: Annotate Lints
uses: yogstation13/DreamAnnotate@v2
+10 -2
View File
@@ -6,7 +6,15 @@
#
# Returns 0 if all existing files are considered ticked, 1 otherwise.
from pathlib import Path
# When running in POSIX environments, the include paths in the codebase need to
# be munged into PureWindowsPaths before being spit back out. Otherwise, the
# checker will attempt to find files named e.g. /workspace/code\\foo.dm, which
# translates to the (completely legitimate) filename "code\foo.dm" in the
# /workspace directory.
#
# For more information, see the discussion of pure paths in the pathlib
# documentation.
from pathlib import Path, PureWindowsPath
import argparse
import sys
@@ -28,7 +36,7 @@ def get_unticked_files(root:Path):
lines = [line for line in f.readlines() if line.startswith('#include')]
included = [line.replace('#include ', '').rstrip('\r\n').strip('"') for line in lines]
print(f'Found {len(included)} includes in {root / includer}')
ticked_files.update([root / Path(includer).parent / i for i in included])
ticked_files.update([root / Path(includer).parent / Path(PureWindowsPath(i)) for i in included])
all_dm_files = {f for f in root.glob('**/*.dm')}
return all_dm_files - ticked_files - {root / f for f in IGNORE_FILES}