-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #508 from akheron/clang-format
Format code with clang-format
- Loading branch information
Showing
47 changed files
with
2,441 additions
and
2,832 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,5 @@ | ||
BasedOnStyle: LLVM | ||
AlignConsecutiveMacros: true | ||
ColumnLimit: 90 | ||
IndentCaseLabels: true | ||
IndentWidth: 4 |
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 |
---|---|---|
|
@@ -33,3 +33,5 @@ stamp-h1 | |
*.exe | ||
.idea | ||
cmake-build-debug/ | ||
*.log | ||
*.trs |
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 |
---|---|---|
|
@@ -8,3 +8,5 @@ dvi: | |
|
||
pkgconfigdir = $(libdir)/pkgconfig | ||
pkgconfig_DATA = jansson.pc | ||
|
||
TESTS = scripts/clang-format-check |
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
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,3 @@ | ||
#!/bin/bash | ||
|
||
find . -type f -a '(' -name '*.c' -o -name '*.h' ')' | xargs clang-format -i |
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 @@ | ||
#!/bin/bash | ||
|
||
CLANG_FORMAT=${CLANG_FORMAT:-clang-format} | ||
CLANG_FORMAT_VERSION=${CLANG_FORMAT_VERSION:-} | ||
|
||
if ! type $CLANG_FORMAT >/dev/null || \ | ||
! $CLANG_FORMAT --version | grep -q "version ${CLANG_FORMAT_VERSION}"; then | ||
# If running tests, mark this test as skipped. | ||
exit 77 | ||
fi | ||
|
||
errors=0 | ||
paths=$(git ls-files | grep '\.[ch]$') | ||
for path in $paths; do | ||
in=$(cat $path) | ||
out=$($CLANG_FORMAT $path) | ||
|
||
if [ "$in" != "$out" ]; then | ||
diff -u -L $path -L "$path.formatted" $path - <<<$out | ||
errors=1 | ||
fi | ||
done | ||
|
||
if [ $errors -ne 0 ]; then | ||
echo "Formatting errors detected, run ./scripts/clang-format to fix!" | ||
exit 1 | ||
fi |
Oops, something went wrong.