From a72e4f7710c82bd4392658139e08cedd11ffeb86 Mon Sep 17 00:00:00 2001 From: warriorstar-orion Date: Sun, 10 Mar 2024 14:22:54 -0400 Subject: [PATCH] vsc: run check_grep2 before build (#24538) * vsc:run check_grep2 before build * whoops --- .vscode/tasks.json | 24 ++++++++++++++++++++++-- tools/ci/check_grep2.py | 7 ++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 47c848d2400..8d166c159da 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,6 +1,24 @@ { "version": "2.0.0", "tasks": [ + { + "type": "shell", + "command": "paracode/linters/check_grep2", + "windows": { + "command": ".\\tools\\bootstrap\\python.bat .\\tools\\ci\\check_grep2.py ${relativeFile}", + }, + "problemMatcher": { + "owner": "dm", + "fileLocation": "relative", + "pattern": { + "regexp": "^(.*):(\\d+):\\s+(.*)$", + "file": 1, + "line": 2, + "message": 3, + } + }, + "label": "linters: run check_grep2" + }, { "type": "dreammaker", "dme": "paradise.dme", @@ -8,7 +26,10 @@ "$dreammaker" ], "group": "build", - "label": "dm: build - paradise.dme" + "label": "dm: build - paradise.dme", + "dependsOn": [ + "linters: run check_grep2", + ] }, { "type": "shell", @@ -36,6 +57,5 @@ "group": "build", "label": "tgui: run dev server" } - , ] } diff --git a/tools/ci/check_grep2.py b/tools/ci/check_grep2.py index f8152ffbf4e..973c48da4be 100644 --- a/tools/ci/check_grep2.py +++ b/tools/ci/check_grep2.py @@ -167,7 +167,12 @@ if __name__ == "__main__": exit_code = 0 start = time.time() - for code_filepath in glob.glob("**/*.dm", recursive=True): + dm_files = glob.glob("**/*.dm", recursive=True) + + if len(sys.argv) > 1: + dm_files = [sys.argv[1]] + + for code_filepath in dm_files: with open(code_filepath, encoding="UTF-8") as code: filename = code_filepath.split(os.path.sep)[-1] # 515 proc syntax check is unique in running on all files but one,