8000 added new clang style and reformat script for clang-format 6.0 · arangodb/arangodb@2a6add0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2a6add0

Browse files
committed
added new clang style and reformat script for clang-format 6.0
1 parent 8fab388 commit 2a6add0

File tree

4 files changed

+123
-3
lines changed

4 files changed

+123
-3
lines changed

.clang-format

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

lib/Basics/Common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@
3232

3333
// debug malloc for Windows (only used when DEBUG is set)
3434
#define _CRTDBG_MAP_ALLOC
35+
// clang-format off
3536
#include <stdlib.h>
3637
#include <crtdbg.h>
38+
// clang-format on
3739

3840
#ifndef NOMINMAX
3941
#define NOMINMAX
@@ -42,8 +44,10 @@
4244
#endif
4345

4446
#define TRI_WITHIN_COMMON 1
47+
// clang-format off
4548
#include "Basics/operating-system.h"
4649
#include "Basics/application-exit.h"
50+
// clang-format on
4751
#undef TRI_WITHIN_COMMON
4852

4953
#include <assert.h>
@@ -168,13 +172,15 @@ typedef long suseconds_t;
168172
#include <vector>
169173

170174
#define TRI_WITHIN_COMMON 1
175+
// clang-format off
171176
#include "Basics/voc-errors.h"
172177
#include "Basics/error.h"
173178
#include "Basics/debugging.h"
174179
#include "Basics/make_unique.h"
175180
#include "Basics/memory.h"
176181
#include "Basics/system-compiler.h"
177182
#include "Basics/system-functions.h"
183+
// clang-format on
178184
#undef TRI_WITHIN_COMMON
179185

180186
#ifdef _WIN32

lib/Basics/VelocyPackDumper.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
#include "Logger/Logger.h"
2828

2929
#include <velocypack/velocypack-common.h>
30+
3031
#include <velocypack/AttributeTranslator.h>
31-
#include "velocypack/Iterator.h"
32+
#include <velocypack/Iterator.h>
3233
#include <velocypack/Options.h>
3334
#include <velocypack/Slice.h>
35+
3436
#include <velocypack/velocypack-aliases.h>
3537

3638
using namespace arangodb::basics;

utils/reformat.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
find arangod arangosh lib enterprise \
4+
-name Zip -prune -o \
5+
-type f "(" -name "*.cpp" -o -name "*.h" ")" \
6+
"!" "(" -name "tokens.*" -o -name "v8-json.*" -o -name "voc-errors.*" -o -name "grammar.*" -o -name "xxhash.*" -o -name "exitcodes.*" ")" | \
7+
xargs clang-format -i -verbose

0 commit comments

Comments
 (0)
0