Skip to content

Commit

Permalink
fix static checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitalita committed Dec 27, 2024
1 parent eb0a17a commit d1674dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ jobs:
echo $(git branch --all)
- name: Install Linux deps
run: |
sudo apt-get install clang-format-19
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-19 100
sudo apt-get update
sudo apt-get install clang-format-18
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-18 100
- name: check clang_format
run: bash ./.scripts/clang_format.sh
8 changes: 4 additions & 4 deletions .scripts/clang_format.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#!/bin/sh

CLANG_FORMAT_MAJOR="19"
DEFAULT_CLANG_FORMAT=clang-format-19
CLANG_FORMAT_MAJOR="18"
DEFAULT_CLANG_FORMAT=clang-format-18
CLANG_FORMAT=${CLANG_FORMAT:-$DEFAULT_CLANG_FORMAT}
# check if $CLANG_FORMAT is available, use --version
if ! command -v "$CLANG_FORMAT" &> /dev/null; then
# try `clang-format`
CLANG_FORMAT=clang-format
if ! command -v "$CLANG_FORMAT" &> /dev/null; then
echo "Error: $CLANG_FORMAT not found. Please install clang-format-19."
echo "Error: $CLANG_FORMAT not found. Please install $DEFAULT_CLANG_FORMAT."
exit 1
fi
# get the output of clang-format --version
CLANG_FORMAT_VERSION=$("$CLANG_FORMAT" --version)
# check if the version is 19
if ! echo "$CLANG_FORMAT_VERSION" | grep -q "version $CLANG_FORMAT_MAJOR"; then
echo "WARNING: $CLANG_FORMAT is not version 19; Using $CLANG_FORMAT_VERSION"
echo "WARNING: $CLANG_FORMAT is not version $CLANG_FORMAT_MAJOR; Using $CLANG_FORMAT_VERSION"
fi
fi

Expand Down

0 comments on commit d1674dc

Please sign in to comment.