Skip to content

Commit 4582402

Browse files
committed
build(project): initial version
0 parents  commit 4582402

File tree

14 files changed

+2155
-0
lines changed

14 files changed

+2155
-0
lines changed

.clang-format

Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
###############################################################################
2+
# SPDX-License-Identifier: CC0-1.0
3+
# SPDX-FileType: OTHER
4+
# SPDX-FileCopyrightText: (c) 2022, OpenGateware authors and contributors
5+
###############################################################################
6+
---
7+
Language: Cpp
8+
Standard: c++17
9+
BasedOnStyle: LLVM
10+
# The extra indent or outdent of access modifiers (e.g., public)
11+
AccessModifierOffset: -4
12+
# Align parameters on the open bracket
13+
# someLongFunction(argument1,
14+
# argument2);
15+
AlignAfterOpenBracket: Align
16+
# Do not align equals signs of consecutive assignments
17+
AlignConsecutiveAssignments: Consecutive
18+
# Do not align the value of consecutive macros
19+
AlignConsecutiveMacros: Consecutive
20+
# Do not align the colons of consecutive bitfields
21+
AlignConsecutiveBitFields: Consecutive
22+
# Do not align the variable names of consecutive declarations
23+
AlignConsecutiveDeclarations: None
24+
# Align escaped newlines in macros - as far left as possible
25+
AlignEscapedNewlines: Right
26+
# Horizontally align operands of binary and ternary expressions
27+
# Keeping the operand on the right edge of the upper line
28+
AlignOperands: Align
29+
# Do not align consecutive comments that follow a line of code
30+
AlignTrailingComments: true
31+
# If a function call or braced initializer list doesn't fit on a line,
32+
# allow putting all arguments onto the next line, even if BinPackArguments is false.
33+
AllowAllArgumentsOnNextLine: true
34+
# If a constructor definition with a member initializer list doesn't fit on a
35+
# single line, allow putting all member initializers onto the next line, if
36+
# `ConstructorInitializerAllOnOneLineOrOnePerLine` is true. Note that this parameter
37+
# has no effect if `ConstructorInitializerAllOnOneLineOrOnePerLine` is false.
38+
AllowAllConstructorInitializersOnNextLine: true
39+
# If the function declaration doesn't fit on a line, allow putting all
40+
# parameters of a function declaration onto the next line even if BinPackParameters is false.
41+
AllowAllParametersOfDeclarationOnNextLine: true
42+
AllowShortEnumsOnASingleLine: false
43+
AllowShortBlocksOnASingleLine: Empty
44+
AllowShortCaseLabelsOnASingleLine: true
45+
AllowShortFunctionsOnASingleLine: None
46+
AllowShortLambdasOnASingleLine: All
47+
AllowShortIfStatementsOnASingleLine: Never
48+
AllowShortLoopsOnASingleLine: false
49+
AlwaysBreakAfterDefinitionReturnType: None
50+
AlwaysBreakAfterReturnType: None
51+
AlwaysBreakBeforeMultilineStrings: false
52+
AlwaysBreakTemplateDeclarations: Yes
53+
BinPackArguments: true
54+
BinPackParameters: true
55+
# Add one space on each side of the :
56+
BitFieldColonSpacing: Both
57+
# Configure each individual brace in BraceWrapping.
58+
BreakBeforeBraces: Custom
59+
BraceWrapping:
60+
# Opening brace under case label
61+
AfterCaseLabel: false
62+
# Class brace opens on the same line as the class name
63+
AfterClass: false
64+
# Braces are under control statement
65+
AfterControlStatement: Never
66+
# Braces are under enum
67+
AfterEnum: false
68+
# Braces are under function prototype
69+
AfterFunction: false
70+
# Braces are under namespace
71+
AfterNamespace: false
72+
# Braces are under struct keyword
73+
AfterStruct: false
74+
# Braces are under union keyword
75+
AfterUnion: false
76+
# Braces are under extern keyword
77+
AfterExternBlock: false
78+
# Braces are under catch keyword
79+
BeforeCatch: false
80+
# else keyword is placed under if close brace
81+
BeforeElse: false
82+
# Braces Wrap lambda block.
83+
BeforeLambdaBody: false
84+
# Do not place a trailing while loop below the close brace
85+
BeforeWhile: false
86+
# Do not indent wrapped braces
87+
IndentBraces: false
88+
# Empty function body braces are on multiple lines
89+
SplitEmptyFunction: false
90+
# Empty class/struct/union body braces are on multiple lines
91+
SplitEmptyRecord: true
92+
# empty namespace body braces are on multiple lines
93+
SplitEmptyNamespace: true
94+
# For splitting long binary operations, break after the operator
95+
BreakBeforeBinaryOperators: None
96+
# Place concept declaration on a new line
97+
BreakBeforeConceptDeclarations: true
98+
# Ternary operators will be placed after line breaks.
99+
BreakBeforeTernaryOperators: true
100+
# Break constructor initializers after the colon and commas
101+
BreakConstructorInitializers: AfterColon
102+
# Break inheritance list after the colon and comma
103+
BreakInheritanceList: AfterColon
104+
# Allow breaking long string literals into multiple lines
105+
BreakStringLiterals: true
106+
# Max Width of a line when formatting
107+
ColumnLimit: 180
108+
# A regular expression that describes comments with special meaning,
109+
# which should not be split into lines or otherwise changed.
110+
CommentPragmas: '^ IWYU pragma:'
111+
# Each namespace declaration is placed on a new line
112+
CompactNamespaces: false
113+
# Do not require initializers to be on their own lines when breaking
114+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
115+
# The number of characters to use for indentation of constructor initializer
116+
# lists as well as inheritance lists.
117+
ConstructorInitializerIndentWidth: 4
118+
# Indent width for line continuations.
119+
ContinuationIndentWidth: 4
120+
# format braced lists as best suited for C++11 braced lists
121+
Cpp11BracedListStyle: true
122+
# Analyze the formatted file for the most used line ending (\r\n or \n).
123+
# UseCRLF is only used as a fallback if none can be derived.
124+
DeriveLineEnding: true
125+
# Do not read the file to derive pointer alignment requirements. Uses PointerAlignment value.
126+
DerivePointerAlignment: false
127+
# Do not completely disable formatting
128+
DisableFormat: false
129+
# Remove all empty lines after access modifiers
130+
#EmptyLineAfterAccessModifier: Never
131+
# Add empty line only when access modifier starts a new logical block.
132+
# Logical block is a group of one or more member fields or functions.
133+
EmptyLineBeforeAccessModifier: LogicalBlock
134+
# Each call can be bin-packed, one-per-line or inconclusive.
135+
ExperimentalAutoDetectBinPacking: false
136+
# add missing namespace end comments for short namespaces and fixes invalid existing ones.
137+
FixNamespaceComments: true
138+
# A vector of macros that should be interpreted as foreach loops instead of as function calls.
139+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
140+
# Sort each #include block separately (blocks of includes are separated by empty lines)
141+
IncludeBlocks: Preserve
142+
# Regular expressions denoting the different #include categories used for ordering #includes.
143+
IncludeCategories:
144+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
145+
Priority: 2
146+
SortPriority: 0
147+
CaseSensitive: false
148+
- Regex: '^(<|"(gtest|gmock|isl|json|catch2|cmocka)/)'
149+
Priority: 3
150+
SortPriority: 0
151+
CaseSensitive: false
152+
- Regex: '.*'
153+
Priority: 1
154+
SortPriority: 0
155+
CaseSensitive: false
156+
# Specify a regular expression of suffixes that are allowed in the file-to-main-include mapping.
157+
# use this regex of allowed suffixes to the header stem.
158+
# A partial match is done, so that: - "" means "arbitrary suffix" - "$" means "no suffix"
159+
IncludeIsMainRegex: '$'
160+
# Specify a regular expression for files being formatted that are allowed to be considered
161+
# "main" in the file-to-main-include mapping.
162+
IncludeIsMainSourceRegex: ''
163+
# access modifiers are indented (or outdented) relative to the record members,
164+
# respecting the AccessModifierOffset
165+
#IndentAccessModifiers: false
166+
# Do not indent case blocks one level from case label
167+
IndentCaseBlocks: false
168+
# Do indent case labels within a switch block
169+
IndentCaseLabels: true
170+
# Use AfterExternBlock's indenting rule
171+
IndentExternBlock: AfterExternBlock
172+
# Goto labels are indented to proper level
173+
IndentGotoLabels: false
174+
# Indents preprocessor directives before the hash.
175+
IndentPPDirectives: BeforeHash
176+
# Number of columns to use for indentation
177+
IndentWidth: 4
178+
# Indent if a function definition or declaration is wrapped after the type.
179+
IndentWrappedFunctionNames: false
180+
# Insert trailing commas in container literals (arrays and objects) that wrap across multiple lines.
181+
InsertTrailingCommas: None
182+
# Remove empty lines at the start of a block
183+
KeepEmptyLinesAtTheStartOfBlocks: false
184+
# Align lambda body relative to the start of the lambda signature
185+
#LambdaBodyIndentation: Signature
186+
# A regular expression matching macros that start a block.
187+
MacroBlockBegin: ''
188+
# A regular expression matching macros that end a block.
189+
MacroBlockEnd: ''
190+
# Maximum number of consecutive empty lines to keep
191+
MaxEmptyLinesToKeep: 1
192+
# Don't indent namespaces
193+
NamespaceIndentation: All
194+
# A vector of macros which are used to open namespace blocks
195+
#NamespaceMacros: ''
196+
PenaltyBreakAssignment: 2
197+
PenaltyBreakBeforeFirstCallParameter: 19
198+
PenaltyBreakComment: 300
199+
PenaltyBreakFirstLessLess: 120
200+
PenaltyBreakString: 1000
201+
PenaltyBreakTemplateDeclaration: 10
202+
PenaltyExcessCharacter: 1000000
203+
PenaltyReturnTypeOnItsOwnLine: 60
204+
# align pointers: int *ptr
205+
PointerAlignment: Right
206+
# align references like pointers
207+
ReferenceAlignment: Right
208+
# Clang-format will attempt to reflow long comments
209+
ReflowComments: true
210+
# Always have an ending namespace commment
211+
#ShortNamespaceLines: 0
212+
# Include sorting is alphabetical and case-insensitive
213+
SortIncludes: Never #CaseInsensitive
214+
# using declarations will be alphabetically sorted
215+
SortUsingDeclarations: true
216+
# Do not insert a space after a C-style cast
217+
SpaceAfterCStyleCast: false
218+
# Do not insert as pace after a logical not (!)
219+
SpaceAfterLogicalNot: false
220+
# Do not insert as pace after the template keyword
221+
SpaceAfterTemplateKeyword: false
222+
# Don't ensure spaces around pointer qualifiers, use PointerAlignment instead
223+
SpaceAroundPointerQualifiers: Default
224+
# Place spaces before assignment operators (=, +=, etc.)
225+
SpaceBeforeAssignmentOperators: true
226+
# Do not place a space before a case statement colon
227+
SpaceBeforeCaseColon: false
228+
# Do not place a space before a C++11 braced list
229+
SpaceBeforeCpp11BracedList: false
230+
# Do place a space between the constructor and the initializer colon
231+
SpaceBeforeCtorInitializerColon: true
232+
# Place a space between the class and the inheritance colon
233+
SpaceBeforeInheritanceColon: true
234+
# Never place a space between an item and following parens
235+
SpaceBeforeParens: Never
236+
# do not place a space before a range based for loop
237+
SpaceBeforeRangeBasedForLoopColon: false
238+
# do not place a space before square brackets []
239+
SpaceBeforeSquareBrackets: false
240+
# do not place a space in an empty block
241+
SpaceInEmptyBlock: false
242+
# Do not place a space in empty parens
243+
SpaceInEmptyParentheses: false
244+
# Spaces between end of the code and the start of a // line comment
245+
SpacesBeforeTrailingComments: 1
246+
# Remove spaces within <> : <int>
247+
SpacesInAngles: false #Never
248+
# Do not add spaces in C-style cast parens
249+
SpacesInCStyleCastParentheses: false
250+
# Do not add spaces around if/for/while/switch conditions
251+
SpacesInConditionalStatement: false
252+
# Do not insert spaces inside container literals
253+
SpacesInContainerLiterals: false
254+
# Do not insert spaces after ( and before )
255+
SpacesInParentheses: false
256+
# Do not insert spaces after [ and before ]
257+
SpacesInSquareBrackets: false
258+
# Macros which are ignored in front of a statement, as if they were an attribute.
259+
# StatementAttributeLikeMacros:
260+
# A vector of macros that should be interpreted as complete statements.
261+
# StatementMacros: ''
262+
# The number of columns used for tab stops.
263+
TabWidth: 4
264+
# A vector of macros that should be interpreted as type declarations instead of as function calls.
265+
#TypenameMacros: ''
266+
# use \n for line breaks
267+
UseCRLF: false
268+
# Use tabs whenever we need to fill whitespace that spans at least from one tab stop to the next one.
269+
UseTab: ForContinuationAndIndentation
270+
# A vector of macros which are whitespace-sensitive and should not be touched.
271+
WhitespaceSensitiveMacros:
272+
- STRINGIZE
273+
- PP_STRINGIZE
274+
- BOOST_PP_STRINGIZE
275+
- NS_SWIFT_NAME
276+
- CF_SWIFT_NAME
277+
...

.clang-tidy

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
###############################################################################
2+
# SPDX-License-Identifier: CC0-1.0
3+
# SPDX-FileType: OTHER
4+
# SPDX-FileCopyrightText: (c) 2022, OpenGateware authors and contributors
5+
###############################################################################
6+
---
7+
Checks: '-*,
8+
cert-con54-cpp,
9+
cert-dcl21-cpp,
10+
cert-dcl58-cpp,
11+
cert-err34-c,
12+
cert-err52-cpp,
13+
cert-err58-cpp,
14+
cert-err60-cpp,
15+
cert-exp42-c,
16+
cert-flp30-c,
17+
cert-flp37-c,
18+
cert-msc50-cpp,
19+
cert-msc51-cpp,
20+
cert-str34-c,
21+
###############################################################################
22+
cppcoreguidelines-interfaces-global-init,
23+
cppcoreguidelines-narrowing-conversions,
24+
cppcoreguidelines-pro-type-member-init,
25+
cppcoreguidelines-pro-type-static-cast-downcast,
26+
cppcoreguidelines-slicing,
27+
cppcoreguidelines-virtual-class-destructor,
28+
###############################################################################
29+
google-default-arguments,
30+
google-explicit-constructor,
31+
google-runtime-operator,
32+
###############################################################################
33+
hicpp-exception-baseclass,
34+
hicpp-multiway-paths-covered,
35+
###############################################################################
36+
mpi-buffer-deref,
37+
mpi-type-mismatch,
38+
###############################################################################
39+
openmp-use-default-none,
40+
###############################################################################
41+
abseil-*,
42+
###############################################################################
43+
bugprone-*,
44+
-bugprone-easily-swappable-parameters,
45+
-bugprone-reserved-identifier,
46+
###############################################################################
47+
performance-*,
48+
###############################################################################
49+
misc-*,
50+
-misc-no-recursion,
51+
-misc-non-private-member-variables-in-classes,
52+
###############################################################################
53+
modernize-*,
54+
-modernize-avoid-c-arrays
55+
###############################################################################
56+
portability-*,
57+
###############################################################################
58+
-abseil-string-find-str-contains
59+
###############################################################################
60+
readability-*,
61+
-readability-identifier-length,
62+
-readability-container-contains,
63+
-readability-implicit-bool-conversion,
64+
-readability-magic-numbers,
65+
-readability-function-cognitive-complexity,
66+
-readability-simplify-boolean-expr,
67+
-readability-else-after-return,
68+
-readability-uppercase-literal-suffix,
69+
-readability-isolate-declaration,
70+
71+
#-readability-duplicate-include,
72+
#-readability-function-size,
73+
#-readability-identifier-length,
74+
#-readability-identifier-naming,
75+
#-readability-named-parameter,
76+
#-readability-qualified-auto,
77+
#-readability-redundant-access-specifiers,
78+
#-readability-redundant-preprocessor,
79+
'

0 commit comments

Comments
 (0)