Skip to content

Commit 667d7ba

Browse files
Full rewrite, support UAVCAN/CAN (both v1 and v0), UAVCAN/serial (#7)
1 parent fbde691 commit 667d7ba

File tree

82 files changed

+10785
-10203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+10785
-10203
lines changed

.clang-format

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: true
7+
AlignConsecutiveDeclarations: true
8+
AlignEscapedNewlines: Left
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: false
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: Inline
15+
AllowShortIfStatementsOnASingleLine: Never
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: Yes
21+
BinPackArguments: false
22+
BinPackParameters: false
23+
BraceWrapping:
24+
AfterCaseLabel: true
25+
AfterClass: true
26+
AfterControlStatement: true
27+
AfterEnum: true
28+
AfterFunction: true
29+
AfterNamespace: true
30+
AfterStruct: true
31+
AfterUnion: true
32+
BeforeCatch: true
33+
BeforeElse: true
34+
IndentBraces: false
35+
SplitEmptyFunction: false
36+
SplitEmptyRecord: false
37+
SplitEmptyNamespace: false
38+
AfterExternBlock: false # Keeps the contents un-indented.
39+
BreakBeforeBinaryOperators: None
40+
BreakBeforeBraces: Custom
41+
BreakBeforeTernaryOperators: true
42+
BreakConstructorInitializers: AfterColon
43+
# BreakInheritanceList: AfterColon
44+
BreakStringLiterals: true
45+
ColumnLimit: 120
46+
CommentPragmas: '^ (coverity|pragma:)'
47+
CompactNamespaces: false
48+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
49+
ConstructorInitializerIndentWidth: 4
50+
ContinuationIndentWidth: 4
51+
Cpp11BracedListStyle: true
52+
DerivePointerAlignment: false
53+
DisableFormat: false
54+
ExperimentalAutoDetectBinPacking: false
55+
FixNamespaceComments: true
56+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
57+
IncludeBlocks: Preserve
58+
IndentCaseLabels: false
59+
IndentPPDirectives: AfterHash
60+
IndentWidth: 4
61+
IndentWrappedFunctionNames: false
62+
KeepEmptyLinesAtTheStartOfBlocks: false
63+
MacroBlockBegin: ''
64+
MacroBlockEnd: ''
65+
MaxEmptyLinesToKeep: 1
66+
NamespaceIndentation: None
67+
PenaltyBreakAssignment: 2
68+
PenaltyBreakBeforeFirstCallParameter: 10000 # Raised intentionally; prefer breaking all
69+
PenaltyBreakComment: 300
70+
PenaltyBreakFirstLessLess: 120
71+
PenaltyBreakString: 1000
72+
PenaltyExcessCharacter: 1000000
73+
PenaltyReturnTypeOnItsOwnLine: 10000 # Raised intentionally because it hurts readability
74+
PointerAlignment: Left
75+
ReflowComments: true
76+
SortIncludes: false
77+
SortUsingDeclarations: false
78+
SpaceAfterCStyleCast: true
79+
SpaceAfterTemplateKeyword: true
80+
SpaceBeforeAssignmentOperators: true
81+
SpaceBeforeCpp11BracedList: false
82+
SpaceBeforeInheritanceColon: true
83+
SpaceBeforeParens: ControlStatements
84+
SpaceBeforeCtorInitializerColon: true
85+
SpaceBeforeRangeBasedForLoopColon: true
86+
SpaceInEmptyParentheses: false
87+
SpacesBeforeTrailingComments: 2
88+
SpacesInAngles: false
89+
SpacesInCStyleCastParentheses: false
90+
SpacesInContainerLiterals: false
91+
SpacesInParentheses: false
92+
SpacesInSquareBrackets: false
93+
Standard: Cpp11
94+
TabWidth: 8
95+
UseTab: Never
96+
...

.clang-tidy

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
Checks: >-
3+
boost-*,
4+
bugprone-*,
5+
cert-*,
6+
clang-analyzer-*,
7+
cppcoreguidelines-*,
8+
google-*,
9+
hicpp-*,
10+
llvm-*,
11+
misc-*,
12+
modernize-*,
13+
performance-*,
14+
portability-*,
15+
readability-*,
16+
-google-readability-todo,
17+
-readability-avoid-const-params-in-decls,
18+
-readability-function-cognitive-complexity,
19+
-llvm-header-guard,
20+
-google-runtime-references,
21+
-misc-non-private-member-variables-in-classes,
22+
-cppcoreguidelines-non-private-member-variables-in-classes,
23+
-cert-msc30-c,
24+
-cert-msc50-cpp,
25+
-*-easily-swappable-parameters,
26+
WarningsAsErrors: '*'
27+
HeaderFilterRegex: '.*'
28+
AnalyzeTemporaryDtors: false
29+
FormatStyle: file
30+
...

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ cmake-build-*
2727
*.log
2828

2929
# IDE
30-
.idea
3130
.metadata
3231
.settings
3332
.project
3433
.cproject
3534
.pydevproject
3635
*.kdev4
36+
**/.idea/*
37+
!**/.idea/dictionaries
38+
!**/.idea/dictionaries/*

.gitmodules

-9
This file was deleted.

.idea/dictionaries/pavel.xml

+43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.travis.yml

-62
This file was deleted.

CONTRIBUTING.md

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Kocherga contribution guide
2+
3+
## Directory layout
4+
5+
The production sources are located under `/kocherga/`.
6+
Do not put anything else in there.
7+
8+
The tests are located under `/tests/`.
9+
This directory also contains the top `CMakeLists.txt` needed to build and run the tests on the local machine.
10+
11+
The high-level documentation is written in the main README, API documentation is given directly in the header files.
12+
13+
## Standards
14+
15+
The library shall be implemented in ISO C++17 with partial adherence to MISRA C++.
16+
The MISRA compliance is enforced by Clang-Tidy and SonarQube.
17+
Deviations are documented directly in the source code as follows:
18+
19+
```c
20+
// Intentional violation of MISRA: <some valid reason>
21+
<... deviant construct ...> // NOLINT NOSONAR
22+
```
23+
24+
The full list of deviations with the accompanying explanation can be found by grepping the sources.
25+
26+
Do not suppress compliance warnings using the means provided by static analysis tools because such deviations
27+
are impossible to track at the source code level.
28+
An exception applies for the case of false-positive (invalid) warnings -- those should not be mentioned in the codebase.
29+
30+
[Zubax C++ Coding Conventions](https://kb.zubax.com/x/84Ah) shall be followed.
31+
Formatting is enforced by Clang-Format; it is used also to fail the CI/CD build if violations are detected.
32+
33+
Unfortunately, some rules are hard or impractical to enforce automatically,
34+
so code reviewers shall be aware of MISRA and general high-reliability coding practices
35+
to prevent non-compliant code from being accepted into upstream.
36+
37+
## Tools
38+
39+
For the full list of the tools please refer to the CI scripts.
40+
41+
### Clang-Tidy
42+
43+
Clang-Tidy is used to enforce compliance with MISRA and Zubax Coding Conventions.
44+
45+
Clang-Tidy is invoked automatically on each translation unit before it is compiled;
46+
the build will fail if the tool is not available locally.
47+
To disable this behavior, pass `NO_STATIC_ANALYSIS=1` to CMake at the generation time.
48+
49+
### Clang-Format
50+
51+
Clang-Format is used to enforce compliance with MISRA and Zubax Coding Conventions.
52+
53+
To reformat the sources, generate the project and build the target `format`; e.g., for Make: `make format`.
54+
55+
### SonarQube
56+
57+
SonarQube is a cloud solution so its use is delegated to the CI/CD pipeline.
58+
If you need access, please get in touch with the maintainers.
59+
60+
### IDE
61+
62+
The recommended development environment is JetBrains CLion. The root project file can be found under `tests/`.
63+
The repository contains the spelling dictionaries for CLion located under `.idea/`, be sure to use them.
64+
65+
## Testing
66+
67+
Generate the CMake project, build all, and then build the target `test` (e.g., `make test`).
68+
69+
Some of the tests are intended to be run manually due to lack of adequate automation solutions in the v0 ecosystem.
70+
Please navigate to `/tests/integration/validator/` for details.
71+
72+
## Releasing
73+
74+
1. Bump the version numbers (`KOCHERGA_VERSION_MAJOR`, `KOCHERGA_VERSION_MINOR`) in `kocherga.hpp`. Push the change.
75+
2. Create a new release on GitHub: <https://github.com/Zubax/kocherga/releases/new>

0 commit comments

Comments
 (0)