Skip to content

Commit d8d237d

Browse files
author
Jonathan Abrahams
committed
SERVER-22842 Support JavaScript style for clang-format. The JavasScript format
is disabled, but defined for src/mongo & jstests
1 parent be3d44b commit d8d237d

File tree

2 files changed

+198
-1
lines changed

2 files changed

+198
-1
lines changed

jstests/.clang-format

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
Language: Cpp
2+
# BasedOnStyle: Google
3+
# ---
4+
AccessModifierOffset: -4
5+
AlignOperands: false
6+
AlignAfterOpenBracket: true
7+
AlignEscapedNewlinesLeft: true
8+
AlignTrailingComments: true
9+
AllowAllParametersOfDeclarationOnNextLine: true
10+
AllowShortBlocksOnASingleLine: false
11+
AllowShortCaseLabelsOnASingleLine: false
12+
AllowShortFunctionsOnASingleLine: Empty
13+
AllowShortIfStatementsOnASingleLine: false
14+
AllowShortLoopsOnASingleLine: false
15+
AlwaysBreakAfterDefinitionReturnType: false
16+
AlwaysBreakBeforeMultilineStrings: true
17+
AlwaysBreakTemplateDeclarations: true
18+
BinPackArguments: false
19+
BinPackParameters: false
20+
BreakBeforeBinaryOperators: None
21+
BreakBeforeBraces: Attach
22+
BreakBeforeTernaryOperators: true
23+
BreakConstructorInitializersBeforeComma: false
24+
ColumnLimit: 100
25+
CommentPragmas: ''
26+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
27+
ConstructorInitializerIndentWidth: 4
28+
ContinuationIndentWidth: 4
29+
Cpp11BracedListStyle: true
30+
DerivePointerAlignment: false
31+
DisableFormat: false
32+
ExperimentalAutoDetectBinPacking: false
33+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
34+
IndentCaseLabels: true
35+
IndentFunctionDeclarationAfterType: false
36+
IndentWidth: 4
37+
IndentWrappedFunctionNames: false
38+
KeepEmptyLinesAtTheStartOfBlocks: false
39+
MaxEmptyLinesToKeep: 2
40+
NamespaceIndentation: None
41+
ObjCSpaceAfterProperty: false
42+
ObjCSpaceBeforeProtocolList: false
43+
PenaltyBreakBeforeFirstCallParameter: 19
44+
PenaltyBreakComment: 300
45+
PenaltyBreakFirstLessLess: 120
46+
PenaltyBreakString: 1000
47+
PenaltyExcessCharacter: 1000000
48+
PenaltyReturnTypeOnItsOwnLine: 200
49+
PointerAlignment: Left
50+
SpaceAfterCStyleCast: false
51+
SpaceBeforeAssignmentOperators: true
52+
SpaceBeforeParens: ControlStatements
53+
SpaceInEmptyParentheses: false
54+
SpacesBeforeTrailingComments: 2
55+
SpacesInAngles: false
56+
SpacesInCStyleCastParentheses: false
57+
SpacesInContainerLiterals: true
58+
SpacesInParentheses: false
59+
SpacesInSquareBrackets: false
60+
Standard: Cpp11
61+
TabWidth: 4
62+
UseTab: Never
63+
---
64+
65+
Language: JavaScript
66+
# Disable JS formatting until the JS linter is in place (SERVER-22338)
67+
DisableFormat: true
68+
# BasedOnStyle: Google
69+
# ---
70+
AccessModifierOffset: -1
71+
AlignAfterOpenBracket: true
72+
AlignEscapedNewlinesLeft: true
73+
AlignOperands: false
74+
AlignTrailingComments: false
75+
AllowAllParametersOfDeclarationOnNextLine: true
76+
AllowShortBlocksOnASingleLine: false
77+
AllowShortCaseLabelsOnASingleLine: false
78+
AllowShortFunctionsOnASingleLine: None
79+
AllowShortIfStatementsOnASingleLine: false
80+
AllowShortLoopsOnASingleLine: false
81+
AlwaysBreakAfterDefinitionReturnType: false
82+
AlwaysBreakBeforeMultilineStrings: true
83+
AlwaysBreakTemplateDeclarations: true
84+
BinPackArguments: false
85+
BinPackParameters: false
86+
BreakBeforeBinaryOperators: None
87+
BreakBeforeBraces: Attach
88+
BreakBeforeTernaryOperators: true
89+
BreakConstructorInitializersBeforeComma: false
90+
ColumnLimit: 100
91+
CommentPragmas: ''
92+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
93+
ConstructorInitializerIndentWidth: 4
94+
ContinuationIndentWidth: 4
95+
Cpp11BracedListStyle: true
96+
DerivePointerAlignment: true
97+
#DisableFormat: false
98+
ExperimentalAutoDetectBinPacking: false
99+
ForEachMacros: [ ]
100+
IndentCaseLabels: true
101+
IndentFunctionDeclarationAfterType: false
102+
IndentWidth: 4
103+
IndentWrappedFunctionNames: false
104+
KeepEmptyLinesAtTheStartOfBlocks: false
105+
MaxEmptyLinesToKeep: 1
106+
NamespaceIndentation: None
107+
ObjCBlockIndentWidth: 2
108+
ObjCSpaceAfterProperty: false
109+
ObjCSpaceBeforeProtocolList: false
110+
PenaltyBreakBeforeFirstCallParameter: 1
111+
PenaltyBreakComment: 300
112+
PenaltyBreakFirstLessLess: 120
113+
PenaltyBreakString: 1000
114+
PenaltyExcessCharacter: 1000000
115+
PenaltyReturnTypeOnItsOwnLine: 200
116+
PointerAlignment: Left
117+
SpaceAfterCStyleCast: false
118+
SpaceBeforeAssignmentOperators: true
119+
SpaceBeforeParens: ControlStatements
120+
SpaceInEmptyParentheses: false
121+
SpacesBeforeTrailingComments: 2
122+
SpacesInAngles: false
123+
SpacesInCStyleCastParentheses: false
124+
SpacesInContainerLiterals: false
125+
SpacesInParentheses: false
126+
SpacesInSquareBrackets: false
127+
Standard: Auto
128+
TabWidth: 4
129+
UseTab: Never

src/mongo/.clang-format

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
Language: Cpp
12
# BasedOnStyle: Google
3+
# ---
24
AccessModifierOffset: -4
35
AlignOperands: false
46
AlignAfterOpenBracket: true
@@ -34,7 +36,6 @@ IndentFunctionDeclarationAfterType: false
3436
IndentWidth: 4
3537
IndentWrappedFunctionNames: false
3638
KeepEmptyLinesAtTheStartOfBlocks: false
37-
Language: Cpp
3839
MaxEmptyLinesToKeep: 2
3940
NamespaceIndentation: None
4041
ObjCSpaceAfterProperty: false
@@ -59,3 +60,70 @@ SpacesInSquareBrackets: false
5960
Standard: Cpp11
6061
TabWidth: 4
6162
UseTab: Never
63+
---
64+
65+
Language: JavaScript
66+
# Disable JS formatting until the JS linter is in place (SERVER-22338)
67+
DisableFormat: true
68+
# BasedOnStyle: Google
69+
# ---
70+
AccessModifierOffset: -1
71+
AlignAfterOpenBracket: true
72+
AlignEscapedNewlinesLeft: true
73+
AlignOperands: false
74+
AlignTrailingComments: false
75+
AllowAllParametersOfDeclarationOnNextLine: true
76+
AllowShortBlocksOnASingleLine: false
77+
AllowShortCaseLabelsOnASingleLine: false
78+
AllowShortFunctionsOnASingleLine: None
79+
AllowShortIfStatementsOnASingleLine: false
80+
AllowShortLoopsOnASingleLine: false
81+
AlwaysBreakAfterDefinitionReturnType: false
82+
AlwaysBreakBeforeMultilineStrings: true
83+
AlwaysBreakTemplateDeclarations: true
84+
BinPackArguments: false
85+
BinPackParameters: false
86+
BreakBeforeBinaryOperators: None
87+
BreakBeforeBraces: Attach
88+
BreakBeforeTernaryOperators: true
89+
BreakConstructorInitializersBeforeComma: false
90+
ColumnLimit: 100
91+
CommentPragmas: ''
92+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
93+
ConstructorInitializerIndentWidth: 4
94+
ContinuationIndentWidth: 4
95+
Cpp11BracedListStyle: true
96+
DerivePointerAlignment: true
97+
#DisableFormat: false
98+
ExperimentalAutoDetectBinPacking: false
99+
ForEachMacros: [ ]
100+
IndentCaseLabels: true
101+
IndentFunctionDeclarationAfterType: false
102+
IndentWidth: 4
103+
IndentWrappedFunctionNames: false
104+
KeepEmptyLinesAtTheStartOfBlocks: false
105+
MaxEmptyLinesToKeep: 1
106+
NamespaceIndentation: None
107+
ObjCBlockIndentWidth: 2
108+
ObjCSpaceAfterProperty: false
109+
ObjCSpaceBeforeProtocolList: false
110+
PenaltyBreakBeforeFirstCallParameter: 1
111+
PenaltyBreakComment: 300
112+
PenaltyBreakFirstLessLess: 120
113+
PenaltyBreakString: 1000
114+
PenaltyExcessCharacter: 1000000
115+
PenaltyReturnTypeOnItsOwnLine: 200
116+
PointerAlignment: Left
117+
SpaceAfterCStyleCast: false
118+
SpaceBeforeAssignmentOperators: true
119+
SpaceBeforeParens: ControlStatements
120+
SpaceInEmptyParentheses: false
121+
SpacesBeforeTrailingComments: 2
122+
SpacesInAngles: false
123+
SpacesInCStyleCastParentheses: false
124+
SpacesInContainerLiterals: false
125+
SpacesInParentheses: false
126+
SpacesInSquareBrackets: false
127+
Standard: Auto
128+
TabWidth: 4
129+
UseTab: Never

0 commit comments

Comments
 (0)