This repository has been archived by the owner on May 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added clang-format binaries & helper scripts
- Loading branch information
1 parent
04d5ff3
commit 24c82d5
Showing
9 changed files
with
544 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
BasedOnStyle: Google | ||
BreakBeforeBraces: Mozilla | ||
|
||
AllowShortLoopsOnASingleLine: false | ||
AccessModifierOffset: -4 | ||
BreakConstructorInitializersBeforeComma: true | ||
ColumnLimit: 100 | ||
IndentWidth: 4 | ||
PointerAlignment: Left | ||
TabWidth: 4 | ||
|
||
ReflowComments: false # protect ASCII art in comments | ||
KeepEmptyLinesAtTheStartOfBlocks: true |
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
Binary file not shown.
Binary file not shown.
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,34 @@ | ||
#!/usr/bin/env bash | ||
|
||
PLATFORM=$(uname) | ||
TOOLSPATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" | ||
CLANGFORMAT="${TOOLSPATH}/${PLATFORM}/clang-format -style=file" | ||
|
||
if [ "$1" == "--all" ] | ||
then | ||
find include src tests/src tests/unit \( -name *.cpp -or -name *.h \) -print0 \ | ||
| xargs -n1 -0 ${CLANGFORMAT} -output-replacements-xml \ | ||
| grep -c "<replacement " > /dev/null | ||
grepCode=$? | ||
elif [ "$1" == "--staged" ] | ||
then | ||
git diff --cached --name-only --diff-filter=ACMRT | grep -e '.*\.h$' -e '.*\.cpp' -v '**third-party/*' \ | ||
| xargs -n1 ${CLANGFORMAT} -output-replacements-xml \ | ||
| grep -c "<replacement " >/dev/null | ||
grepCode=$? | ||
else | ||
echo "Please specify --all or --staged" | ||
exit 1 | ||
fi | ||
|
||
# grep exits 0 => found needed formatting changes | ||
if [ $grepCode -ne 0 ] | ||
then | ||
echo "Formatting looks good!" | ||
exit 0 | ||
else | ||
echo "****************************************************" | ||
echo "Code needs formatting! Please use 'tools/format-all'" | ||
echo "****************************************************" | ||
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,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This command can be run by the user to clang-format everything. | ||
|
||
PLATFORM=$(uname) | ||
TOOLSPATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" | ||
CLANGFORMAT="${TOOLSPATH}/${PLATFORM}/clang-format -style=file" | ||
|
||
find include src tests/src tests/unit \( -name *.cpp -or -name *.h \) -print0 | xargs -n1 -0 ${CLANGFORMAT} -i |
Oops, something went wrong.