From c1ce8be31bb034e69b2d3f33666f36d2389434bc Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Tue, 9 Apr 2024 15:15:58 +0200 Subject: [PATCH] build: bump clang-format to version 18 --- .github/workflows/lint.yml | 8 ++++---- CONTRIBUTING.md | 2 +- src/game/console_cmd.c | 2 +- tools/update_gameflow | 7 ++++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9473ea12a..627085a07 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,12 +33,12 @@ jobs: - name: Install dependencies run: | wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - - echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main' | sudo tee -a /etc/apt/sources.list - echo 'deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main' | sudo tee -a /etc/apt/sources.list + echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' | sudo tee -a /etc/apt/sources.list + echo 'deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' | sudo tee -a /etc/apt/sources.list sudo apt update - sudo apt-get install -y clang-format-17 iwyu + sudo apt-get install -y clang-format-18 iwyu sudo snap install --edge --classic just - sudo ln -s /usr/bin/clang-format-17 /usr/local/bin/clang-format + sudo ln -s /usr/bin/clang-format-18 /usr/local/bin/clang-format sudo apt-get install -y python3-pip sudo python3 -m pip install pyjson5 pre-commit diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bb1ecb5b2..772d42b8b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -83,7 +83,7 @@ pre-commit install To install required external dependencies on Ubuntu: ``` -apt-get install -y iwyu clang-format-17 +apt-get install -y iwyu clang-format-18 ``` After this, each time you make a commit a hook should trigger to automatically diff --git a/src/game/console_cmd.c b/src/game/console_cmd.c index 67ac8bbd5..9865c52ee 100644 --- a/src/game/console_cmd.c +++ b/src/game/console_cmd.c @@ -30,7 +30,7 @@ #include #include -#define ENDS_WITH_ZERO(num) (fabsf((num)-roundf((num))) < 0.0001f) +#define ENDS_WITH_ZERO(num) (fabsf((num) - roundf((num))) < 0.0001f) typedef struct ITEM_NAME { const GAME_OBJECT_ID obj_id; diff --git a/tools/update_gameflow b/tools/update_gameflow index 3e4d42037..89164cb0c 100755 --- a/tools/update_gameflow +++ b/tools/update_gameflow @@ -36,9 +36,10 @@ def main() -> None: assert string_map for gameflow_path in SHIP_DIR.rglob("*gameflow*.json*"): - gameflow = gameflow_path.read_text() - gameflow = postprocess_gameflow(gameflow, string_map) - gameflow_path.write_text(gameflow) + old_gameflow = gameflow_path.read_text() + new_gameflow = postprocess_gameflow(old_gameflow, string_map) + if new_gameflow != old_gameflow: + gameflow_path.write_text(new_gameflow) if __name__ == "__main__":