-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 #2908 from ZMQers/clang-format
Problem: inconsistent formatting
- Loading branch information
Showing
337 changed files
with
13,412 additions
and
13,763 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,53 @@ | ||
BasedOnStyle: LLVM | ||
IndentWidth: 4 | ||
UseTab: Never | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterClass: true | ||
AfterControlStatement: false | ||
AfterEnum: true | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterObjCDeclaration: true | ||
AfterStruct: true | ||
AfterUnion: true | ||
BeforeCatch: true | ||
BeforeElse: false | ||
IndentBraces: false | ||
|
||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AllowShortIfStatementsOnASingleLine: false | ||
IndentCaseLabels: true | ||
BinPackArguments: true | ||
BinPackParameters: false | ||
AlignTrailingComments: true | ||
AllowShortBlocksOnASingleLine: false | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortFunctionsOnASingleLine: InlineOnly | ||
AlwaysBreakTemplateDeclarations: false | ||
ColumnLimit: 80 | ||
MaxEmptyLinesToKeep: 2 | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
ContinuationIndentWidth: 2 | ||
PointerAlignment: Right | ||
ReflowComments: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: Always | ||
SpaceInEmptyParentheses: false | ||
SpacesInAngles: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp11 | ||
|
||
SortIncludes: false | ||
|
||
FixNamespaceComments: false | ||
BreakBeforeBinaryOperators: NonAssignment | ||
SpaceAfterTemplateKeyword: true | ||
AlignAfterOpenBracket: Align | ||
AlignOperands: true | ||
BreakConstructorInitializers: AfterColon | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
SpaceAfterCStyleCast: true | ||
BreakBeforeTernaryOperators: 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
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,41 @@ | ||
# additional target to perform clang-format run, requires clang-format | ||
|
||
# get all project files | ||
file(GLOB_RECURSE ALL_SOURCE_FILES | ||
RELATIVE ${CMAKE_CURRENT_BINARY_DIR} | ||
${CMAKE_SOURCE_DIR}/src/*.cpp ${CMAKE_SOURCE_DIR}/src/*.h ${CMAKE_SOURCE_DIR}/src/*.hpp | ||
${CMAKE_SOURCE_DIR}/tests/*.cpp ${CMAKE_SOURCE_DIR}/tests/*.h ${CMAKE_SOURCE_DIR}/tests/*.hpp | ||
${CMAKE_SOURCE_DIR}/perf/*.cpp ${CMAKE_SOURCE_DIR}/perf/*.h ${CMAKE_SOURCE_DIR}/perf/*.hpp | ||
${CMAKE_SOURCE_DIR}/tools/*.cpp ${CMAKE_SOURCE_DIR}/tools/*.h ${CMAKE_SOURCE_DIR}/tools/*.hpp | ||
${CMAKE_SOURCE_DIR}/include/*.h | ||
) | ||
|
||
if("${CLANG_FORMAT}" STREQUAL "") | ||
set(CLANG_FORMAT "clang-format") | ||
endif() | ||
|
||
add_custom_target( | ||
clang-format | ||
COMMAND ${CLANG_FORMAT} -style=file -i ${ALL_SOURCE_FILES} | ||
) | ||
|
||
function(JOIN VALUES GLUE OUTPUT) | ||
string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}") | ||
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE) | ||
endfunction() | ||
|
||
configure_file(builds/cmake/clang-format-check.sh.in clang-format-check.sh @ONLY) | ||
|
||
add_custom_target( | ||
clang-format-check | ||
COMMAND chmod +x clang-format-check.sh | ||
COMMAND ./clang-format-check.sh | ||
COMMENT "Checking correct formatting according to .clang-format file using ${CLANG_FORMAT}" | ||
) | ||
|
||
add_custom_target( | ||
clang-format-diff | ||
COMMAND ${CLANG_FORMAT} -style=file -i ${ALL_SOURCE_FILES} | ||
COMMAND git diff ${ALL_SOURCE_FILES} | ||
COMMENT "Formatting with clang-format (using ${CLANG_FORMAT}) and showing differences with latest commit" | ||
) |
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,14 @@ | ||
#!/bin/sh | ||
FAILED=0 | ||
IFS=";" | ||
FILES="@ALL_SOURCE_FILES@" | ||
IDS=$(echo -en "\n\b") | ||
for FILE in $FILES | ||
do | ||
@CLANG_FORMAT@ -style=file -output-replacements-xml "$FILE" | grep "<replacement " >/dev/null && | ||
{ | ||
echo "$FILE is not correctly formatted" | ||
FAILED=1 | ||
} | ||
done | ||
if [ "$FAILED" -eq "1" ] ; then exit 1 ; fi |
Oops, something went wrong.