Skip to content

Commit 567cc29

Browse files
committed
[common] Initial commit
0 parents  commit 567cc29

26 files changed

+1438
-0
lines changed

.clang-format

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
Language: Cpp
3+
AccessModifierOffset: -4
4+
AlignAfterOpenBracket: Align
5+
AlignConsecutiveAssignments: true
6+
AlignConsecutiveDeclarations: false
7+
AlignEscapedNewlines: true
8+
AlignOperands: true
9+
AlignTrailingComments: true
10+
AllowAllParametersOfDeclarationOnNextLine: true
11+
AllowShortBlocksOnASingleLine: true
12+
AllowShortCaseLabelsOnASingleLine: true
13+
AllowShortFunctionsOnASingleLine: Inline
14+
AllowShortIfStatementsOnASingleLine: false
15+
AllowShortLoopsOnASingleLine: false
16+
AlwaysBreakAfterDefinitionReturnType: None
17+
AlwaysBreakAfterReturnType: None
18+
AlwaysBreakBeforeMultilineStrings: false
19+
AlwaysBreakTemplateDeclarations: Yes
20+
BinPackArguments: false
21+
BinPackParameters: false
22+
BraceWrapping:
23+
AfterCaseLabel: true
24+
AfterClass: true
25+
AfterControlStatement: true
26+
AfterEnum: true
27+
AfterFunction: true
28+
AfterNamespace: false
29+
AfterObjCDeclaration: true
30+
AfterStruct: true
31+
AfterUnion: true
32+
AfterExternBlock: true
33+
BeforeCatch: true
34+
BeforeElse: true
35+
IndentBraces: false
36+
SplitEmptyFunction: true
37+
SplitEmptyRecord: true
38+
SplitEmptyNamespace: true
39+
BreakBeforeBinaryOperators: All
40+
BreakBeforeBraces: Custom
41+
BreakBeforeInheritanceComma: false
42+
BreakInheritanceList: BeforeColon
43+
BreakBeforeTernaryOperators: true
44+
BreakConstructorInitializersBeforeComma: false
45+
BreakConstructorInitializers: BeforeComma
46+
BreakAfterJavaFieldAnnotations: false
47+
BreakStringLiterals: true
48+
ColumnLimit: 110
49+
CommentPragmas: '^ IWYU pragma:'
50+
CompactNamespaces: false
51+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
52+
ConstructorInitializerIndentWidth: 4
53+
ContinuationIndentWidth: 4
54+
Cpp11BracedListStyle: true
55+
DerivePointerAlignment: false
56+
DisableFormat: false
57+
ExperimentalAutoDetectBinPacking: false
58+
FixNamespaceComments: true
59+
ForEachMacros:
60+
- forever
61+
- foreach
62+
- Q_FOREACH
63+
- BOOST_FOREACH
64+
IncludeBlocks: Regroup
65+
IncludeCategories:
66+
# "include"
67+
- Regex: '".*"'
68+
Priority: 1
69+
# Libraries
70+
- Regex: '^<.+\.h(pp)?>'
71+
Priority: 2
72+
# Special libraries, without extension
73+
- Regex: '^<.*'
74+
Priority: 3
75+
# Standard library headers
76+
- Regex: '^<[a-z_]+>'
77+
Priority: 4
78+
IncludeIsMainRegex: '(Test)?$'
79+
IndentCaseLabels: true
80+
IndentPPDirectives: None
81+
IndentWidth: 4
82+
IndentWrappedFunctionNames: false
83+
JavaScriptQuotes: Leave
84+
JavaScriptWrapImports: true
85+
KeepEmptyLinesAtTheStartOfBlocks: false
86+
MacroBlockBegin: ''
87+
MacroBlockEnd: ''
88+
MaxEmptyLinesToKeep: 1
89+
NamespaceIndentation: None
90+
ObjCBinPackProtocolList: Auto
91+
ObjCBlockIndentWidth: 4
92+
ObjCSpaceAfterProperty: false
93+
ObjCSpaceBeforeProtocolList: true
94+
PenaltyBreakAssignment: 150
95+
PenaltyBreakBeforeFirstCallParameter: 300
96+
PenaltyBreakComment: 500
97+
PenaltyBreakFirstLessLess: 400
98+
PenaltyBreakString: 600
99+
PenaltyBreakTemplateDeclaration: 10
100+
PenaltyExcessCharacter: 50
101+
PenaltyReturnTypeOnItsOwnLine: 300
102+
PointerAlignment: Right
103+
ReflowComments: false
104+
SortIncludes: true
105+
SortUsingDeclarations: true
106+
SpaceAfterCStyleCast: true
107+
SpaceAfterTemplateKeyword: false
108+
SpaceBeforeAssignmentOperators: true
109+
SpaceBeforeCpp11BracedList: false
110+
SpaceBeforeCtorInitializerColon: true
111+
SpaceBeforeInheritanceColon: true
112+
SpaceBeforeParens: ControlStatements
113+
SpaceBeforeRangeBasedForLoopColon: true
114+
SpaceInEmptyParentheses: false
115+
SpacesBeforeTrailingComments: 1
116+
SpacesInAngles: false
117+
SpacesInContainerLiterals: false
118+
SpacesInCStyleCastParentheses: false
119+
SpacesInParentheses: false
120+
SpacesInSquareBrackets: false
121+
Standard: Cpp11
122+
TabWidth: 4
123+
UseTab: Never
124+
...

.clang-tidy

+157
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
# Enable ALL the things! Except not really
3+
# misc-non-private-member-variables-in-classes: the options don't do anything
4+
Checks: "*,\
5+
-google-readability-todo,\
6+
-altera-unroll-loops,\
7+
-fuchsia-*,\
8+
fuchsia-multiple-inheritance,\
9+
-llvm-header-guard,\
10+
-llvm-include-order,\
11+
-llvmlibc-*,\
12+
-misc-non-private-member-variables-in-classes"
13+
WarningsAsErrors: ''
14+
CheckOptions:
15+
- key: 'bugprone-argument-comment.StrictMode'
16+
value: 'true'
17+
# Prefer using enum classes with 2 values for parameters instead of bools
18+
- key: 'bugprone-argument-comment.CommentBoolLiterals'
19+
value: 'true'
20+
- key: 'bugprone-misplaced-widening-cast.CheckImplicitCasts'
21+
value: 'true'
22+
- key: 'bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression'
23+
value: 'true'
24+
- key: 'bugprone-suspicious-string-compare.WarnOnLogicalNotComparison'
25+
value: 'true'
26+
- key: 'readability-simplify-boolean-expr.ChainedConditionalReturn'
27+
value: 'true'
28+
- key: 'readability-simplify-boolean-expr.ChainedConditionalAssignment'
29+
value: 'true'
30+
- key: 'readability-uniqueptr-delete-release.PreferResetCall'
31+
value: 'true'
32+
- key: 'cppcoreguidelines-init-variables.MathHeader'
33+
value: '<cmath>'
34+
- key: 'cppcoreguidelines-narrowing-conversions.PedanticMode'
35+
value: 'true'
36+
- key: 'readability-else-after-return.WarnOnUnfixable'
37+
value: 'true'
38+
- key: 'readability-else-after-return.WarnOnConditionVariables'
39+
value: 'true'
40+
- key: 'readability-inconsistent-declaration-parameter-name.Strict'
41+
value: 'true'
42+
- key: 'readability-qualified-auto.AddConstToQualified'
43+
value: 'true'
44+
- key: 'readability-redundant-access-specifiers.CheckFirstDeclaration'
45+
value: 'true'
46+
# Identifier styles
47+
- key: 'readability-identifier-naming.AbstractClassCase'
48+
value: 'CamelCase'
49+
- key: 'readability-identifier-naming.ClassCase'
50+
value: 'CamelCase'
51+
- key: 'readability-identifier-naming.ClassConstantCase'
52+
value: 'lower_case'
53+
- key: 'readability-identifier-naming.ClassMemberCase'
54+
value: 'lower_case'
55+
- key: 'readability-identifier-naming.ClassMethodCase'
56+
value: 'lower_case'
57+
- key: 'readability-identifier-naming.ConstantCase'
58+
value: 'lower_case'
59+
- key: 'readability-identifier-naming.ConstantPrefix'
60+
value: 'k'
61+
- key: 'readability-identifier-naming.ConstantMemberCase'
62+
value: 'lower_case'
63+
- key: 'readability-identifier-naming.ConstantParameterCase'
64+
value: 'lower_case'
65+
- key: 'readability-identifier-naming.ConstantPointerParameterCase'
66+
value: 'lower_case'
67+
- key: 'readability-identifier-naming.ConstexprFunctionCase'
68+
value: 'lower_case'
69+
- key: 'readability-identifier-naming.ConstexprMethodCase'
70+
value: 'lower_case'
71+
- key: 'readability-identifier-naming.ConstexprVariableCase'
72+
value: 'lower_case'
73+
- key: 'readability-identifier-naming.EnumCase'
74+
value: 'lower_case'
75+
- key: 'readability-identifier-naming.EnumConstantCase'
76+
value: 'lower_case'
77+
- key: 'readability-identifier-naming.FunctionCase'
78+
value: 'lower_case'
79+
- key: 'readability-identifier-naming.GlobalConstantCase'
80+
value: 'lower_case'
81+
- key: 'readability-identifier-naming.GlobalConstantPrefix'
82+
value: 'k'
83+
- key: 'readability-identifier-naming.GlobalConstantPointerCase'
84+
value: 'lower_case'
85+
- key: 'readability-identifier-naming.GlobalFunctionCase'
86+
value: 'lower_case'
87+
- key: 'readability-identifier-naming.GlobalPointerCase'
88+
value: 'lower_case'
89+
- key: 'readability-identifier-naming.GlobalVariableCase'
90+
value: 'lower_case'
91+
- key: 'readability-identifier-naming.InlineNamespaceCase'
92+
value: 'lower_case'
93+
- key: 'readability-identifier-naming.LocalConstantCase'
94+
value: 'lower_case'
95+
- key: 'readability-identifier-naming.LocalConstantPointerCase'
96+
value: 'lower_case'
97+
- key: 'readability-identifier-naming.LocalPointerCase'
98+
value: 'lower_case'
99+
- key: 'readability-identifier-naming.LocalVariableCase'
100+
value: 'lower_case'
101+
- key: 'readability-identifier-naming.MacroDefinitionCase'
102+
value: 'UPPER_CASE'
103+
- key: 'readability-identifier-naming.MemberCase'
104+
value: 'lower_case'
105+
- key: 'readability-identifier-naming.MethodCase'
106+
value: 'lower_case'
107+
- key: 'readability-identifier-naming.NamespaceCase'
108+
value: 'lower_case'
109+
- key: 'readability-identifier-naming.ParameterCase'
110+
value: 'lower_case'
111+
- key: 'readability-identifier-naming.ParameterPackCase'
112+
value: 'lower_case'
113+
- key: 'readability-identifier-naming.PointerParameterCase'
114+
value: 'lower_case'
115+
- key: 'readability-identifier-naming.PrivateMemberCase'
116+
value: 'lower_case'
117+
- key: 'readability-identifier-naming.PrivateMemberSuffix'
118+
value: '_'
119+
- key: 'readability-identifier-naming.PrivateMethodCase'
120+
value: 'lower_case'
121+
- key: 'readability-identifier-naming.ProtectedMemberCase'
122+
value: 'lower_case'
123+
- key: 'readability-identifier-naming.ProtectedMemberSuffix'
124+
value: '_'
125+
- key: 'readability-identifier-naming.ProtectedMethodCase'
126+
value: 'lower_case'
127+
- key: 'readability-identifier-naming.PublicMemberCase'
128+
value: 'lower_case'
129+
- key: 'readability-identifier-naming.PublicMethodCase'
130+
value: 'lower_case'
131+
- key: 'readability-identifier-naming.ScopedEnumConstantCase'
132+
value: 'lower_case'
133+
- key: 'readability-identifier-naming.StaticConstantCase'
134+
value: 'lower_case'
135+
- key: 'readability-identifier-naming.StaticVariableCase'
136+
value: 'lower_case'
137+
- key: 'readability-identifier-naming.StructCase'
138+
value: 'lower_case'
139+
- key: 'readability-identifier-naming.TemplateParameterCase'
140+
value: 'CamelCase'
141+
- key: 'readability-identifier-naming.TemplateTemplateParameterCase'
142+
value: 'CamelCase'
143+
- key: 'readability-identifier-naming.TypeAliasCase'
144+
value: 'lower_case'
145+
- key: 'readability-identifier-naming.TypedefCase'
146+
value: 'lower_case'
147+
- key: 'readability-identifier-naming.TypeTemplateParameterCase'
148+
value: 'CamelCase'
149+
- key: 'readability-identifier-naming.UnionCase'
150+
value: 'lower_case'
151+
- key: 'readability-identifier-naming.ValueTemplateParameterCase'
152+
value: 'CamelCase'
153+
- key: 'readability-identifier-naming.VariableCase'
154+
value: 'lower_case'
155+
- key: 'readability-identifier-naming.VirtualMethodCase'
156+
value: 'lower_case'
157+
...

.github/workflows/deploy_docs.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- '.github/workflows/deploy_docs.yml'
8+
- 'docs/**'
9+
- 'include/**'
10+
11+
jobs:
12+
deploy_docs:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
submodules: true
19+
20+
- name: Install Doxygen
21+
run: sudo apt install doxygen -y
22+
23+
- name: Install Poxy
24+
run: sudo pip install poxy
25+
26+
- name: Configure CMake
27+
run: cmake -B ${{ github.workspace }}/build -S ${{ github.workspace }} -DBETHUTIL-COMMON_BUILD_DOCS=ON -D@BETHUTIL-TEMPLATE@_BUILD_SRC=OFF -DBUILD_TESTING=OFF
28+
29+
- name: Build
30+
run: cmake --build ${{ github.workspace }}/build --target docs
31+
32+
- name: Deploy
33+
uses: peaceiris/actions-gh-pages@v3
34+
with:
35+
force_orphan: true
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
publish_dir: ${{ github.workspace }}/build/docs/html/

.github/workflows/formatting.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Apply Formatting
2+
3+
on: [ push, pull_request, pull_request_target ]
4+
5+
jobs:
6+
clang-format:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
12+
- name: Run clang-format
13+
run: find -type f \( -name *.hpp -o -name *.cpp \) | xargs clang-format-12 -style=file -i
14+
15+
- uses: stefanzweifel/git-auto-commit-action@v4
16+
with:
17+
commit_message: apply formatting

0 commit comments

Comments
 (0)