-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6144e1
commit 60f6242
Showing
2 changed files
with
42 additions
and
0 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,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ -z $CLANG_FORMAT ]] ; then | ||
CLANG_FORMAT=clang-format | ||
fi | ||
|
||
if NOT type $CLANG_FORMAT 2> /dev/null ; then | ||
echo "No appropriate clang-format found." | ||
exit 1 | ||
fi | ||
|
||
FAIL=0 | ||
SOURCE_FILES=`find src samples tst -type f \( -name '*.h' -o -name '*.c' \) -not -path "*/external/*"` | ||
echo "Performing clang format compliance check...." | ||
for i in $SOURCE_FILES | ||
do | ||
$CLANG_FORMAT -output-replacements-xml $i | grep -c "<replacement " > /dev/null | ||
if [ $? -ne 1 ] | ||
then | ||
echo "$i failed clang-format check." | ||
FAIL=1 | ||
fi | ||
done | ||
|
||
if [ $FAIL -ne 1 ]; then | ||
echo "Clang check passed for the project" | ||
fi | ||
|
||
exit $FAIL |