-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mateusz Mazur <[email protected]>
- Loading branch information
Showing
3 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Clang formatting checker | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
DRY: "TRUE" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
# Dependecies needed only for Linux - Modbus Communication | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y clang-format | ||
- name: Build | ||
run: DRY=TRUE bash reformat-all.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
#!/bin/sh | ||
|
||
find . -name '*.cpp' -o -name '*.hpp' | xargs clang-format -i -style=file | ||
ALL_FORMATABLE_FILES=$(find src include tests example -name '*.cpp' -o -name '*.hpp') | ||
CLANG_FORMAT_ARGS="-i -style=file" | ||
|
||
echo "*** Modbus Clang Format Wrapper **" | ||
echo "DRY RUN: $DRY" | ||
|
||
if [[ "$DRY" = "TRUE" ]]; then | ||
exec clang-format --dry-run $CLANG_FORMAT_ARGS $ALL_FORMATABLE_FILES | ||
else | ||
exec clang-format $CLANG_FORMAT_ARGS $ALL_FORMATABLE_FILES | ||
fi |