forked from arntanguy/gram_savitzky_golay
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang-format] Setup and run clang-format
- Loading branch information
Showing
12 changed files
with
293 additions
and
151 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 |
---|---|---|
@@ -1,5 +1,106 @@ | ||
--- | ||
BasedOnStyle: Google | ||
Language: Cpp | ||
AccessModifierOffset: -2 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlinesLeft: true | ||
AlignOperands: true | ||
AlignTrailingComments: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortIfStatementsOnASingleLine: true | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackArguments: true | ||
BinPackParameters: false | ||
BreakBeforeBinaryOperators: NonAssignment | ||
BreakBeforeBraces: Allman | ||
ColumnLimit: 0 | ||
BreakBeforeInheritanceComma: false | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakConstructorInitializers: BeforeColon | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: true | ||
ColumnLimit: 120 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
ConstructorInitializerIndentWidth: 0 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: true | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
IncludeBlocks: Preserve | ||
IncludeCategories: | ||
- Regex: '^(<mc_[a-z]*/)' | ||
Priority: 1 | ||
- Regex: '^(<Tasks/)' | ||
Priority: 2 | ||
- Regex: '^(<mc_rbdyn_urdf/)' | ||
Priority: 3 | ||
- Regex: '^(<RBDyn/)' | ||
Priority: 4 | ||
- Regex: '^(<SpaceVecAlg/)' | ||
Priority: 5 | ||
- Regex: '^(<sch-core/)' | ||
Priority: 6 | ||
- Regex: '^(<boost/)' | ||
Priority: 7 | ||
- Regex: '^(<(nanomsg|geos|.*_msgs|ros|tf2.*)/)' | ||
Priority: 8 | ||
- Regex: '.*' | ||
Priority: 9 | ||
IncludeIsMainRegex: '(Test)?$' | ||
IndentCaseLabels: true | ||
IndentPPDirectives: AfterHash | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: true | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBlockIndentWidth: 2 | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 150 | ||
PenaltyReturnTypeOnItsOwnLine: 300 | ||
PointerAlignment: Middle | ||
ReflowComments: true | ||
SortIncludes: true | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterTemplateKeyword: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: Never | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp11 | ||
TabWidth: 2 | ||
UseTab: Never | ||
... | ||
|
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,20 @@ | ||
#!/bin/bash | ||
|
||
readonly this_dir=`cd $(dirname $0); pwd` | ||
cd $this_dir | ||
source .clang-format-common.sh | ||
|
||
out=0 | ||
tmpfile=$(mktemp /tmp/clang-format-check.XXXXXX) | ||
for f in ${src_files}; do | ||
$clang_format -style=file $f > $tmpfile | ||
if ! [[ -z `diff $tmpfile $f` ]]; then | ||
echo "Wrong formatting in $f" | ||
out=1 | ||
fi | ||
done | ||
rm -f $tmpfile | ||
if [[ $out -eq 1 ]]; then | ||
echo "You can run ./.clang-format-fix.sh to fix the issues locally, then commit/push again" | ||
fi | ||
exit $out |
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,14 @@ | ||
# This script is meant to be sourced from other scripts | ||
|
||
# Check for clang-format, prefer 6.0 if available | ||
if [[ -x "$(command -v clang-format-6.0)" ]]; then | ||
clang_format=clang-format-6.0 | ||
elif [[ -x "$(command -v clang-format)" ]]; then | ||
clang_format=clang-format | ||
else | ||
echo "clang-format or clang-format-6.0 must be installed" | ||
exit 1 | ||
fi | ||
|
||
# Find all source files in the project minus those that are auto-generated or we do not maintain | ||
src_files=`find include include src tests -name '*.cpp' -or -name '*.h' -or -name '*.hpp'` |
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 @@ | ||
#!/bin/bash | ||
|
||
readonly this_dir=`cd $(dirname $0); pwd` | ||
cd $this_dir | ||
source .clang-format-common.sh | ||
|
||
for f in ${src_files}; do | ||
$clang_format -style=file -i $f | ||
done |
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
Oops, something went wrong.