Skip to content

Commit 27ee165

Browse files
committed
Add clang baseline
1 parent 9497dfc commit 27ee165

File tree

2 files changed

+125
-0
lines changed

2 files changed

+125
-0
lines changed

.clang-format

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: WebKit
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: DontAlign
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlines: Right
9+
AlignOperands: false
10+
AlignTrailingComments: false
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: All
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: false
21+
BinPackArguments: true
22+
BinPackParameters: true
23+
BraceWrapping:
24+
AfterClass: false
25+
AfterControlStatement: false
26+
AfterEnum: false
27+
AfterFunction: true
28+
AfterNamespace: false
29+
AfterObjCDeclaration: false
30+
AfterStruct: false
31+
AfterUnion: false
32+
AfterExternBlock: false
33+
BeforeCatch: false
34+
BeforeElse: false
35+
IndentBraces: false
36+
SplitEmptyFunction: true
37+
SplitEmptyRecord: true
38+
SplitEmptyNamespace: true
39+
BreakBeforeBinaryOperators: All
40+
BreakBeforeBraces: WebKit
41+
BreakBeforeInheritanceComma: false
42+
BreakBeforeTernaryOperators: true
43+
BreakConstructorInitializersBeforeComma: false
44+
BreakConstructorInitializers: BeforeComma
45+
BreakAfterJavaFieldAnnotations: false
46+
BreakStringLiterals: true
47+
ColumnLimit: 0
48+
CommentPragmas: '^ IWYU pragma:'
49+
CompactNamespaces: false
50+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
51+
ConstructorInitializerIndentWidth: 4
52+
ContinuationIndentWidth: 4
53+
Cpp11BracedListStyle: false
54+
DerivePointerAlignment: false
55+
DisableFormat: false
56+
ExperimentalAutoDetectBinPacking: false
57+
FixNamespaceComments: false
58+
ForEachMacros:
59+
- foreach
60+
- Q_FOREACH
61+
- BOOST_FOREACH
62+
IncludeBlocks: Preserve
63+
IncludeCategories:
64+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
65+
Priority: 2
66+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
67+
Priority: 3
68+
- Regex: '.*'
69+
Priority: 1
70+
IncludeIsMainRegex: '(Test)?$'
71+
IndentCaseLabels: false
72+
IndentPPDirectives: None
73+
IndentWidth: 4
74+
IndentWrappedFunctionNames: false
75+
JavaScriptQuotes: Leave
76+
JavaScriptWrapImports: true
77+
KeepEmptyLinesAtTheStartOfBlocks: true
78+
MacroBlockBegin: ''
79+
MacroBlockEnd: ''
80+
MaxEmptyLinesToKeep: 1
81+
NamespaceIndentation: Inner
82+
ObjCBlockIndentWidth: 4
83+
ObjCSpaceAfterProperty: true
84+
ObjCSpaceBeforeProtocolList: true
85+
PenaltyBreakAssignment: 2
86+
PenaltyBreakBeforeFirstCallParameter: 19
87+
PenaltyBreakComment: 300
88+
PenaltyBreakFirstLessLess: 120
89+
PenaltyBreakString: 1000
90+
PenaltyExcessCharacter: 1000000
91+
PenaltyReturnTypeOnItsOwnLine: 60
92+
PointerAlignment: Left
93+
RawStringFormats:
94+
- Delimiter: pb
95+
Language: TextProto
96+
BasedOnStyle: google
97+
ReflowComments: true
98+
SortIncludes: true
99+
SortUsingDeclarations: true
100+
SpaceAfterCStyleCast: false
101+
SpaceAfterTemplateKeyword: true
102+
SpaceBeforeAssignmentOperators: true
103+
SpaceBeforeParens: ControlStatements
104+
SpaceInEmptyParentheses: false
105+
SpacesBeforeTrailingComments: 1
106+
SpacesInAngles: false
107+
SpacesInContainerLiterals: true
108+
SpacesInCStyleCastParentheses: false
109+
SpacesInParentheses: false
110+
SpacesInSquareBrackets: false
111+
Standard: Cpp11
112+
TabWidth: 8
113+
UseTab: Never
114+
...
115+

deploy.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ elif [ "$1" == "gtest-setup" ]; then
6464
sudo cp *.a /usr/lib
6565

6666
echo "GTest Install Complete"
67+
elif [ "$1" == "format" ]; then
68+
find . -regex '.*\.\(cpp\|hpp\|cu\|c\|h\)' -exec clang-format -style=file -i {} \;
69+
retVal=$?
70+
if [ $retVal -ne 0 ]; then
71+
echo "Failure detected during format"
72+
echo "Make sure you have installed the package clang-format"
73+
exit 1
74+
else
75+
echo "Format successful"
76+
fi
6777
elif [ "$1" == "clean" ]; then
6878
rm -rf build
6979
rm -rf out

0 commit comments

Comments
 (0)