Skip to content

Commit d745b59

Browse files
authored
Styleguide (#70)
* updating for styleguide * updating clang_formatting * adding exclusion for csv.hpp file * Updating workflow for clang format * fixing per clang-format * uhhhhhhh, ok there clang and vscode * trying to up the clang version * removing reflow comments
1 parent 36f26c6 commit d745b59

18 files changed

Lines changed: 696 additions & 518 deletions

.clang-format

Lines changed: 163 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -1,195 +1,194 @@
11
---
2-
Language: Cpp
3-
BasedOnStyle: LLVM
4-
AccessModifierOffset: -4
5-
AlignAfterOpenBracket: Align
6-
AlignArrayOfStructures: None
7-
AlignConsecutiveAssignments: false
8-
AlignConsecutiveBitFields: false
9-
AlignConsecutiveDeclarations: false
10-
AlignConsecutiveMacros: false
11-
AlignEscapedNewlines: Right
12-
AlignOperands: Align
13-
AlignTrailingComments: true
14-
AllowAllArgumentsOnNextLine: true
15-
AllowAllParametersOfDeclarationOnNextLine: true
16-
AllowShortEnumsOnASingleLine: true
17-
AllowShortBlocksOnASingleLine: Never
18-
AllowShortCaseLabelsOnASingleLine: false
19-
AllowShortFunctionsOnASingleLine: All
20-
AllowShortLambdasOnASingleLine: All
21-
AllowShortIfStatementsOnASingleLine: Never
22-
AllowShortLoopsOnASingleLine: false
23-
AlwaysBreakAfterDefinitionReturnType: None
24-
AlwaysBreakAfterReturnType: None
25-
AlwaysBreakBeforeMultilineStrings: false
26-
AlwaysBreakTemplateDeclarations: MultiLine
2+
Language: Cpp
3+
BasedOnStyle: LLVM
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: Align
6+
AlignArrayOfStructures: None
7+
AlignConsecutiveAssignments: false
8+
AlignConsecutiveBitFields: false
9+
AlignConsecutiveDeclarations: false
10+
AlignConsecutiveMacros: false
11+
AlignEscapedNewlines: Right
12+
AlignOperands: Align
13+
AlignTrailingComments: true
14+
AllowAllArgumentsOnNextLine: true
15+
AllowAllParametersOfDeclarationOnNextLine: true
16+
AllowShortEnumsOnASingleLine: true
17+
AllowShortBlocksOnASingleLine: Never
18+
AllowShortCaseLabelsOnASingleLine: false
19+
AllowShortFunctionsOnASingleLine: All
20+
AllowShortLambdasOnASingleLine: All
21+
AllowShortIfStatementsOnASingleLine: Never
22+
AllowShortLoopsOnASingleLine: false
23+
AlwaysBreakAfterDefinitionReturnType: None
24+
AlwaysBreakAfterReturnType: None
25+
AlwaysBreakBeforeMultilineStrings: false
26+
AlwaysBreakTemplateDeclarations: MultiLine
2727
AttributeMacros:
2828
- __capability
29-
BinPackArguments: true
30-
BinPackParameters: true
29+
BinPackArguments: true
30+
BinPackParameters: true
3131
BraceWrapping:
32-
AfterCaseLabel: false
33-
AfterClass: false
34-
AfterControlStatement: Never
35-
AfterEnum: false
36-
AfterFunction: false
37-
AfterNamespace: false
38-
AfterObjCDeclaration: false
39-
AfterStruct: false
40-
AfterUnion: false
41-
AfterExternBlock: false
42-
BeforeCatch: false
43-
BeforeElse: false
44-
BeforeLambdaBody: false
45-
BeforeWhile: false
46-
IndentBraces: false
47-
SplitEmptyFunction: true
48-
SplitEmptyRecord: true
49-
SplitEmptyNamespace: true
50-
BreakBeforeBinaryOperators: None
51-
BreakBeforeConceptDeclarations: true
52-
BreakBeforeBraces: Attach
53-
BreakBeforeInheritanceComma: false
54-
BreakInheritanceList: BeforeColon
55-
BreakBeforeTernaryOperators: true
56-
BreakConstructorInitializersBeforeComma: false
57-
BreakConstructorInitializers: BeforeColon
58-
BreakAfterJavaFieldAnnotations: false
59-
BreakStringLiterals: true
60-
ColumnLimit: 80
61-
CommentPragmas: '^ IWYU pragma:'
62-
QualifierAlignment: Leave
63-
CompactNamespaces: false
64-
ConstructorInitializerIndentWidth: 4
65-
ContinuationIndentWidth: 4
66-
Cpp11BracedListStyle: true
67-
DeriveLineEnding: true
68-
DerivePointerAlignment: false
69-
DisableFormat: false
70-
EmptyLineAfterAccessModifier: Never
71-
EmptyLineBeforeAccessModifier: LogicalBlock
72-
ExperimentalAutoDetectBinPacking: false
73-
PackConstructorInitializers: BinPack
32+
AfterCaseLabel: false
33+
AfterClass: false
34+
AfterControlStatement: Never
35+
AfterEnum: false
36+
AfterFunction: false
37+
AfterNamespace: false
38+
AfterObjCDeclaration: false
39+
AfterStruct: false
40+
AfterUnion: false
41+
AfterExternBlock: false
42+
BeforeCatch: false
43+
BeforeElse: false
44+
BeforeLambdaBody: false
45+
BeforeWhile: false
46+
IndentBraces: false
47+
SplitEmptyFunction: true
48+
SplitEmptyRecord: true
49+
SplitEmptyNamespace: true
50+
BreakBeforeBinaryOperators: None
51+
BreakBeforeConceptDeclarations: true
52+
BreakBeforeBraces: Attach
53+
BreakBeforeInheritanceComma: false
54+
BreakInheritanceList: BeforeColon
55+
BreakBeforeTernaryOperators: true
56+
BreakConstructorInitializersBeforeComma: false
57+
BreakConstructorInitializers: BeforeColon
58+
BreakAfterJavaFieldAnnotations: false
59+
BreakStringLiterals: true
60+
ColumnLimit: 80
61+
CommentPragmas: "^ IWYU pragma:"
62+
QualifierAlignment: Leave
63+
CompactNamespaces: false
64+
ConstructorInitializerIndentWidth: 4
65+
ContinuationIndentWidth: 4
66+
Cpp11BracedListStyle: true
67+
DeriveLineEnding: true
68+
DerivePointerAlignment: false
69+
DisableFormat: false
70+
EmptyLineAfterAccessModifier: Never
71+
EmptyLineBeforeAccessModifier: LogicalBlock
72+
ExperimentalAutoDetectBinPacking: false
73+
PackConstructorInitializers: BinPack
7474
# BasedOnStyle: ''
7575
ConstructorInitializerAllOnOneLineOrOnePerLine: false
76-
AllowAllConstructorInitializersOnNextLine: true
77-
FixNamespaceComments: true
76+
AllowAllConstructorInitializersOnNextLine: true
77+
FixNamespaceComments: true
7878
ForEachMacros:
7979
- foreach
8080
- Q_FOREACH
8181
- BOOST_FOREACH
8282
IfMacros:
8383
- KJ_IF_MAYBE
84-
IncludeBlocks: Preserve
84+
IncludeBlocks: Preserve
8585
IncludeCategories:
86-
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
87-
Priority: 2
88-
SortPriority: 0
89-
CaseSensitive: false
90-
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
91-
Priority: 3
92-
SortPriority: 0
93-
CaseSensitive: false
94-
- Regex: '.*'
95-
Priority: 1
96-
SortPriority: 0
97-
CaseSensitive: false
98-
IncludeIsMainRegex: '(Test)?$'
99-
IncludeIsMainSourceRegex: ''
100-
IndentAccessModifiers: false
101-
IndentCaseLabels: false
102-
IndentCaseBlocks: false
103-
IndentGotoLabels: true
104-
IndentPPDirectives: None
105-
IndentExternBlock: AfterExternBlock
86+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
87+
Priority: 2
88+
SortPriority: 0
89+
CaseSensitive: false
90+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
91+
Priority: 3
92+
SortPriority: 0
93+
CaseSensitive: false
94+
- Regex: ".*"
95+
Priority: 1
96+
SortPriority: 0
97+
CaseSensitive: false
98+
IncludeIsMainRegex: "(Test)?$"
99+
IncludeIsMainSourceRegex: ""
100+
IndentAccessModifiers: false
101+
IndentCaseLabels: false
102+
IndentCaseBlocks: false
103+
IndentGotoLabels: true
104+
IndentPPDirectives: None
105+
IndentExternBlock: AfterExternBlock
106106
# IndentRequiresClause: true
107-
IndentWidth: 4
108-
IndentWrappedFunctionNames: false
107+
IndentWidth: 4
108+
IndentWrappedFunctionNames: false
109109
# InsertBraces: false
110-
InsertTrailingCommas: None
111-
JavaScriptQuotes: Leave
112-
JavaScriptWrapImports: true
113-
KeepEmptyLinesAtTheStartOfBlocks: true
114-
LambdaBodyIndentation: Signature
115-
MacroBlockBegin: ''
116-
MacroBlockEnd: ''
117-
MaxEmptyLinesToKeep: 1
118-
NamespaceIndentation: All
119-
ObjCBinPackProtocolList: Auto
120-
ObjCBlockIndentWidth: 2
121-
ObjCBreakBeforeNestedBlockParam: true
122-
ObjCSpaceAfterProperty: false
123-
ObjCSpaceBeforeProtocolList: true
124-
PenaltyBreakAssignment: 2
125-
PenaltyBreakBeforeFirstCallParameter: 19
126-
PenaltyBreakComment: 300
127-
PenaltyBreakFirstLessLess: 120
128-
PenaltyBreakOpenParenthesis: 0
129-
PenaltyBreakString: 1000
130-
PenaltyBreakTemplateDeclaration: 10
131-
PenaltyExcessCharacter: 1000000
132-
PenaltyReturnTypeOnItsOwnLine: 60
133-
PenaltyIndentedWhitespace: 0
134-
PointerAlignment: Right
135-
PPIndentWidth: -1
136-
ReferenceAlignment: Pointer
137-
ReflowComments: true
138-
RemoveBracesLLVM: false
110+
InsertTrailingCommas: None
111+
JavaScriptQuotes: Leave
112+
JavaScriptWrapImports: true
113+
KeepEmptyLinesAtTheStartOfBlocks: true
114+
LambdaBodyIndentation: Signature
115+
MacroBlockBegin: ""
116+
MacroBlockEnd: ""
117+
MaxEmptyLinesToKeep: 1
118+
NamespaceIndentation: None
119+
ObjCBinPackProtocolList: Auto
120+
ObjCBlockIndentWidth: 2
121+
ObjCBreakBeforeNestedBlockParam: true
122+
ObjCSpaceAfterProperty: false
123+
ObjCSpaceBeforeProtocolList: true
124+
PenaltyBreakAssignment: 2
125+
PenaltyBreakBeforeFirstCallParameter: 19
126+
PenaltyBreakComment: 300
127+
PenaltyBreakFirstLessLess: 120
128+
PenaltyBreakOpenParenthesis: 0
129+
PenaltyBreakString: 1000
130+
PenaltyBreakTemplateDeclaration: 10
131+
PenaltyExcessCharacter: 1000000
132+
PenaltyReturnTypeOnItsOwnLine: 60
133+
PenaltyIndentedWhitespace: 0
134+
PointerAlignment: Right
135+
PPIndentWidth: -1
136+
ReferenceAlignment: Pointer
137+
ReflowComments: false
138+
RemoveBracesLLVM: false
139139
# RequiresClausePosition: OwnLine
140-
SeparateDefinitionBlocks: Leave
141-
ShortNamespaceLines: 1
142-
SortIncludes: CaseSensitive
143-
SortJavaStaticImport: Before
144-
SortUsingDeclarations: true
145-
SpaceAfterCStyleCast: false
146-
SpaceAfterLogicalNot: false
147-
SpaceAfterTemplateKeyword: true
148-
SpaceBeforeAssignmentOperators: true
149-
SpaceBeforeCaseColon: false
150-
SpaceBeforeCpp11BracedList: false
151-
SpaceBeforeCtorInitializerColon: true
152-
SpaceBeforeInheritanceColon: true
153-
SpaceBeforeParens: ControlStatements
140+
SeparateDefinitionBlocks: Leave
141+
ShortNamespaceLines: 1
142+
SortIncludes: CaseSensitive
143+
SortJavaStaticImport: Before
144+
SortUsingDeclarations: true
145+
SpaceAfterCStyleCast: false
146+
SpaceAfterLogicalNot: false
147+
SpaceAfterTemplateKeyword: true
148+
SpaceBeforeAssignmentOperators: true
149+
SpaceBeforeCaseColon: false
150+
SpaceBeforeCpp11BracedList: false
151+
SpaceBeforeCtorInitializerColon: true
152+
SpaceBeforeInheritanceColon: true
153+
SpaceBeforeParens: ControlStatements
154154
SpaceBeforeParensOptions:
155-
AfterControlStatements: true
156-
AfterForeachMacros: true
157-
AfterFunctionDefinitionName: false
158-
AfterFunctionDeclarationName: false
159-
AfterIfMacros: true
160-
AfterOverloadedOperator: false
155+
AfterControlStatements: true
156+
AfterForeachMacros: true
157+
AfterFunctionDefinitionName: false
158+
AfterFunctionDeclarationName: false
159+
AfterIfMacros: true
160+
AfterOverloadedOperator: false
161161
# AfterRequiresInClause: false
162162
# AfterRequiresInExpression: false
163-
BeforeNonEmptyParentheses: false
164-
SpaceAroundPointerQualifiers: Default
165-
SpaceBeforeRangeBasedForLoopColon: true
166-
SpaceInEmptyBlock: false
167-
SpaceInEmptyParentheses: false
168-
SpacesBeforeTrailingComments: 1
169-
SpacesInAngles: Never
170-
SpacesInConditionalStatement: false
171-
SpacesInContainerLiterals: true
172-
SpacesInCStyleCastParentheses: false
163+
BeforeNonEmptyParentheses: false
164+
SpaceAroundPointerQualifiers: Default
165+
SpaceBeforeRangeBasedForLoopColon: true
166+
SpaceInEmptyBlock: false
167+
SpaceInEmptyParentheses: false
168+
SpacesBeforeTrailingComments: 1
169+
SpacesInAngles: Never
170+
SpacesInConditionalStatement: false
171+
SpacesInContainerLiterals: true
172+
SpacesInCStyleCastParentheses: false
173173
SpacesInLineCommentPrefix:
174-
Minimum: 1
175-
Maximum: -1
176-
SpacesInParentheses: false
177-
SpacesInSquareBrackets: false
178-
SpaceBeforeSquareBrackets: false
179-
BitFieldColonSpacing: Both
180-
Standard: Latest
174+
Minimum: 1
175+
Maximum: -1
176+
SpacesInParentheses: false
177+
SpacesInSquareBrackets: false
178+
SpaceBeforeSquareBrackets: false
179+
BitFieldColonSpacing: Both
180+
Standard: Latest
181181
StatementAttributeLikeMacros:
182182
- Q_EMIT
183183
StatementMacros:
184184
- Q_UNUSED
185185
- QT_REQUIRE_VERSION
186-
TabWidth: 8
187-
UseCRLF: false
188-
UseTab: Never
186+
TabWidth: 8
187+
UseCRLF: false
188+
UseTab: Never
189189
WhitespaceSensitiveMacros:
190190
- STRINGIZE
191191
- PP_STRINGIZE
192192
- BOOST_PP_STRINGIZE
193193
- NS_SWIFT_NAME
194194
- CF_SWIFT_NAME
195-
...
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: clang-format Check
2+
on:
3+
push:
4+
branches: '*'
5+
pull_request:
6+
branches: [ "main" ]
7+
jobs:
8+
formatting-check:
9+
name: Formatting Check
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
path:
14+
- check: 'include'
15+
exclude: '(csv.hpp)'
16+
- check: 'tests'
17+
exclude: ''
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Run clang-format style check for C/C++/Protobuf programs.
21+
uses: jidicula/clang-format-action@v4.14.0
22+
with:
23+
clang-format-version: '19'
24+
check-path: ${{ matrix.path['check'] }}
25+
exclude-regex: ${{ matrix.path['exclude'] }}
26+
fallback-style: 'Mozilla' # optional

0 commit comments

Comments
 (0)