-
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.
Showing
10 changed files
with
306 additions
and
297 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Style Checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
container: | ||
- 'px4io/px4-dev-simulation-focal:2020-09-14' | ||
container: ${{ matrix.container }} | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: submodule update | ||
run: git submodule update --init --recursive | ||
- name: Install clang-format | ||
run: apt update && apt install -y clang-format-6.0 | ||
- name: Check Code format | ||
working-directory: Tools | ||
run: | | ||
./check_code_format.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
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,10 @@ | ||
#!/bin/bash | ||
|
||
# Fix style recursively in all the repository | ||
sh fix_code_style.sh .. | ||
|
||
# Print the diff with the remote branch (empty if no diff) | ||
git --no-pager diff -U0 --color | ||
|
||
# Check if there are changes, and failed | ||
if ! git diff-index --quiet HEAD --; then echo "Code style check failed, please run clang-format (e.g. with scripts/fix_code_style.sh)"; exit 1; fi |
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,21 @@ | ||
#!/bin/bash | ||
|
||
STYLE="google" | ||
|
||
if [ "$#" -eq 0 ]; then | ||
echo "Usage: $0 <src_file | dir>" | ||
echo "" | ||
echo "ERROR: At least one source file or one directory must be provided!" | ||
|
||
exit 1 | ||
fi | ||
|
||
for arg in "$@" | ||
do | ||
if [ -f $arg ]; then | ||
clang-format-6.0 -i -style='{BasedOnStyle: google, ColumnLimit: 120}' $arg | ||
elif [ -d $arg ]; then | ||
find $arg -iname '*.h' -o -iname '*.cpp' -o -iname '*.hpp' | xargs clang-format-6.0 -i -style='{BasedOnStyle: google, ColumnLimit: 120}' | ||
find $arg -iname '*.h' -o -iname '*.cpp' -o -iname '*.hpp' | xargs chmod 644 | ||
fi | ||
done |
Oops, something went wrong.