Skip to content

Commit

Permalink
Iterate on formatting, add script to run the formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
  • Loading branch information
kdt3rd committed Jun 27, 2019
1 parent 6513fcf commit 969305c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
28 changes: 14 additions & 14 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
Expand All @@ -13,15 +13,15 @@ AllowAllParametersOfDeclarationOnNextLine: true
# AllowAllConstructorInitializersOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: false
# AllowShortLambdasOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterDefinitionReturnType: TopLevel
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
Expand Down Expand Up @@ -57,7 +57,6 @@ ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
Expand Down Expand Up @@ -87,19 +86,19 @@ ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 4
PenaltyBreakAssignment: 8
PenaltyBreakBeforeFirstCallParameter: 8
PenaltyBreakComment: 300
PenaltyBreakComment: 1000
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 20
PointerAlignment: Right
PointerAlignment: Left
ReflowComments: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
Expand All @@ -109,12 +108,13 @@ SpaceBeforeParens: Always
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: true
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
#UseTab: ForIndentation
UseTab: Never
...
15 changes: 15 additions & 0 deletions util/reformat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /bin/sh

cformat=`which clang-format`
if [[ "${cformat}" == "" ]]; then
echo "ERROR: clang-format not found"
exit 1
fi

scriptpath=`realpath $0`
scriptdir=`dirname $scriptpath`
basedir=`dirname $scriptdir`
echo "Processing files in: ${basedir}"
cd ${basedir}
find . \( -name '*.cpp' -o -name '*.h' \) -exec ${cformat} -style=file -verbose -i {} \;

0 comments on commit 969305c

Please sign in to comment.