Browse Source

Better adapt clang-format to current stack formatting and ignore deps in clang-format

Stefan Profanter 5 years ago
parent
commit
54ab94e860
2 changed files with 13 additions and 3 deletions
  1. 10 3
      .clang-format
  2. 3 0
      tools/travis/travis_linux_script.sh

+ 10 - 3
.clang-format

@@ -2,9 +2,16 @@
 Language:        Cpp
 BasedOnStyle:    llvm
 IndentWidth:     4
-ColumnLimit:     120
+ColumnLimit:     90
 SpacesBeforeTrailingComments: 2
-#SpaceBeforeRangeBasedForLoopColon: false
-#ForEachMacros:   [ foreach, LIST_FOREACH, LIST_FOREACH_SAFE ]
+ForEachMacros:   [ foreach, LIST_FOREACH, LIST_FOREACH_SAFE ]
 DisableFormat:   false
 
+# No space between if and parentheses
+SpaceBeforeParens: Never
+
+# Format function declarations
+BinPackParameters: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AlignAfterOpenBracket: Align
+AlwaysBreakAfterReturnType: All

+ 3 - 0
tools/travis/travis_linux_script.sh

@@ -109,6 +109,9 @@ if ! [ -z ${CLANG_FORMAT+x} ]; then
     # We want to get colored diff output into the variable
     git config color.diff always
 
+    # Ignore files in the deps directory diff by resetting them to master
+    git diff --name-only $TRAVIS_BRANCH | grep 'deps/*' | xargs git checkout $TRAVIS_BRANCH --
+
     # clang-format the diff to the target branch of the PR
     difference="$($LOCAL_PKG/bin/git-clang-format --style=file --diff $TRAVIS_BRANCH)"