You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CodeChecker is a tool for performing static code analysis and generating reports.
3
+
We provide scripts and custom configuration for running the CodeChecker.
4
+
5
+
We regularly run CodeChecker to check for any potential bugs or security issues. It is also
6
+
recommended to run the CodeChecker yourself on any code you plan to contribute, as it can discover
7
+
issues that other tools (compiler, ASAN, ...) can miss.
8
+
9
+
Note that the CodeChecker is supported on Linux and macOS only.
10
+
11
+
## Generating Reports
12
+
You need to install the following dependencies:
13
+
14
+
- CodeChecker
15
+
- Check out the [official repository](https://github.com/Ericsson/codechecker) for guidance.
16
+
- Checkers for CodeChecker:
17
+
- clang-tidy
18
+
- clangsa
19
+
- jq (used by our script for merging JSON reports)
20
+
21
+
We generate reports from multiple projects (examples and tests) to cover as much CALs and HALs
22
+
as possible. The reports are then merged and exported to HTML.
23
+
24
+
To generate HTML report, you can use our convenience script. Reports will be
25
+
generated to `.codechecker/reports_html` in the Libtropic repository.
26
+
27
+
!!! example "Generating HTML report"
28
+
=== ":fontawesome-brands-linux: Linux"
29
+
```bash { .copy }
30
+
# Run from root directory of the Libtropic repository.
31
+
scripts/codechecker/run_checks.sh
32
+
```
33
+
34
+
=== ":fontawesome-brands-apple: macOS"
35
+
TBA
36
+
37
+
??? note "Note: Running from a different directory"
38
+
The script also supports running from a different directory, but you have to pass
39
+
a path to the Libtropic repository as a first argument:
40
+
41
+
!!! example "Generating HTML report from any directory"
42
+
=== ":fontawesome-brands-linux: Linux"
43
+
```bash { .copy }
44
+
scripts/codechecker/run_checks.sh <path_to_repo>
45
+
```
46
+
47
+
=== ":fontawesome-brands-apple: macOS"
48
+
TBA
49
+
50
+
If the script executes without any errors, exports will be ready and you can open
51
+
`.codechecker/reports_html/index.html` in your favourite web browser.
52
+
53
+
## Remarks
54
+
The current CodeChecker configuration is in YAML format, as it is more human-readable than JSON and also supports comments.
55
+
56
+
The configuration file enables some strict checkers, which may produce a lot of warnings. It is recommended to run the analysis using the full configuration at least once. After that, you can manually disable any checkers you find unnecessary.
0 commit comments