Skip to content

Commit

Permalink
Using clang-format instead of astyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Valloric committed Jan 9, 2016
1 parent 7c9be69 commit 8f2c91d
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 26 deletions.
50 changes: 50 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
AccessModifierOffset: -2
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BasedOnStyle: Google
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: false
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
IndentCaseLabels: true
IndentFunctionDeclarationAfterType: true
IndentWidth: 2
Language: Cpp
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 60
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerBindsToType: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: true
SpacesInCStyleCastParentheses: true
SpacesInParentheses: true
Standard: Auto
TabWidth: 2
UseTab: Never
33 changes: 7 additions & 26 deletions style_format.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
#!/bin/bash
astyle \
--style=attach \
--indent=spaces=2 \
--indent-switches \
--indent-col1-comments \
--indent-preprocessor \
--max-instatement-indent=80 \
--break-blocks \
--pad-oper \
--pad-paren-in \
--pad-header \
--keep-one-line-blocks \
--convert-tabs \
--align-pointer=name \
--align-reference=name \
--suffix=none \
--lineend=linux \
--recursive \
--exclude=gmock \
--exclude=testdata \
--exclude=ycm_client_support.cpp \
--exclude=ycm_core.cpp \
--exclude=CustomAssert.h \
--exclude=CustomAssert.cpp \
"cpp/ycm/*.cpp" \
"cpp/ycm/*.h"

files=$(find cpp/ycm -type f \
\( -name "*.cpp" -o -name "*.h" \) -and \
-not \( -path "**/gmock/**" -o -path "**/testdata/**" -o \
-path "**/CustomAssert.*" -o -path "**/ycm_*" \) )

clang-format -i -style=file $files

0 comments on commit 8f2c91d

Please sign in to comment.