From c27b5cb65feb9b4f3c1689392297fb3bffd55c65 Mon Sep 17 00:00:00 2001 From: Brent Yi Date: Fri, 19 Jan 2024 01:29:50 -0800 Subject: [PATCH] Use github output format for ruff in CI (#2786) * Use github output format for ruff in CI * Fix --------- Co-authored-by: Justin Kerr --- .github/workflows/core_code_checks.yml | 4 ++-- nerfstudio/scripts/github/run_actions.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/core_code_checks.yml b/.github/workflows/core_code_checks.yml index 0f1fcf0ca..556432bfc 100644 --- a/.github/workflows/core_code_checks.yml +++ b/.github/workflows/core_code_checks.yml @@ -33,9 +33,9 @@ jobs: run: | python ./nerfstudio/scripts/docs/add_nb_tags.py --check - name: Run Ruff Linter - run: ruff check docs/ nerfstudio/ tests/ + run: ruff check docs/ nerfstudio/ tests/ --output-format=github - name: Run Ruff Formatter - run: ruff format docs/ nerfstudio/ tests/ --check + run: ruff format docs/ nerfstudio/ tests/ --diff - name: Run Pyright run: | pyright diff --git a/nerfstudio/scripts/github/run_actions.py b/nerfstudio/scripts/github/run_actions.py index 5a966338c..c758d23b6 100644 --- a/nerfstudio/scripts/github/run_actions.py +++ b/nerfstudio/scripts/github/run_actions.py @@ -56,11 +56,14 @@ def run_github_actions_file(filename: str, continue_on_fail: bool = False): for step in steps: if "name" in step and step["name"] in LOCAL_TESTS: - compressed = step["run"].replace("\n", ";").replace("\\", "") - if "ruff check" in compressed: - curr_command = f"{compressed} --fix" - else: - curr_command = compressed.replace("--check", "") + curr_command = step["run"].replace("\n", ";").replace("\\", "") + if curr_command.startswith("ruff"): + if "ruff check" in curr_command: + curr_command = f"{curr_command} --fix" + + curr_command = curr_command.replace(" --check", "") + curr_command = curr_command.replace(" --diff", "") + curr_command = curr_command.replace(" --output-format=github", "") CONSOLE.line() CONSOLE.rule(f"[bold green]Running: {curr_command}")