Skip to content

Commit

Permalink
[docs] Explain how to use Smatch and it's converter on the kernel
Browse files Browse the repository at this point in the history
- Smatch documentation in report converter explains the usage
  of smatch tool on kernel sources
- Smatch is accessible from the main readme file and supported
  code analyzer file
  • Loading branch information
jay24rajput committed Oct 13, 2020
1 parent 47ef715 commit 19420f0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ The following tools are supported:
| | [Cppcheck](/tools/report-converter/README.md#cppcheck) |
| | [Facebook Infer](/tools/report-converter/README.md#facebook-infer) |
| | [Coccinelle](/tools/report-converter/README.md#coccinelle) |
| | [Smatch](/tools/report-converter/README.md#smatch) |
| **Java** | [SpotBugs](/tools/report-converter/README.md#spotbugs) |
| | [Facebook Infer](/tools/report-converter/README.md#fbinfer) |
| **Python** | [Pylint](/tools/report-converter/README.md#pylint) |
Expand Down
1 change: 1 addition & 0 deletions docs/supported_code_analyzers.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ CodeChecker result directory which can be stored to a CodeChecker server.
| | [Cppcheck](/tools/report-converter/README.md#cppcheck) ||
| | [Facebook Infer](/tools/report-converter/README.md#fbinfer) ||
| | [Coccinelle](/tools/report-converter/README.md#coccinelle) ||
| | [Smatch](/tools/report-converter/README.md#smatch) ||
| **Java** | [FindBugs](http://findbugs.sourceforge.net/) ||
| | [SpotBugs](/tools/report-converter/README.md#spotbugs) ||
| | [Facebook Infer](/tools/report-converter/README.md#fbinfer) ||
Expand Down
25 changes: 25 additions & 0 deletions tools/report-converter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ a CodeChecker server.
* [Pyflakes](#pyflakes)
* [Markdownlint](#markdownlint)
* [Coccinelle](#coccinelle)
* [Smatch](#smatch)
* [License](#license)

## Install guide
Expand Down Expand Up @@ -385,6 +386,7 @@ report-converter -t mdl -o ./codechecker_mdl_reports ./mdl_reports.out

# Store Markdownlint reports with CodeChecker.
CodeChecker store ./codechecker_mdl_reports -n mdl
```
## [Coccinelle](https://github.com/coccinelle/coccinelle)
[Coccinelle](https://github.com/coccinelle/coccinelle) allows programmers to easily
Expand All @@ -409,7 +411,30 @@ report-converter -t coccinelle -o ./codechecker_coccinelle_reports ./coccinelle_

# Store the Cocccinelle reports with CodeChecker.
CodeChecker store ./codechecker_coccinelle_reports -n coccinelle
```
## [Smatch](https://repo.or.cz/w/smatch.git)
[Smatch](https://repo.or.cz/w/smatch.git) is a static analysis tool for C that is used on the kernel.
The recommended way of running Smatch is to redirect the output to a file and
give this file to the report converter tool.
The following example shows you how to run Smatch on kernel sources
and store the results found by Smatch to the CodeChecker database.
```sh
# Change Directory to your project
cd path/to/linux/kernel/repository

# Run Smatch
# Note: The warnings will be stored by default into smatch_warns.txt after executing the following command
path/to/smatch/smatch_scripts/test_kernel.sh

# Use 'report-converter' to create a CodeChecker report directory from the
# analyzer result of Smatch
report-converter -t smatch -o ./codechecker_smatch_reports ./smatch_warns.txt

# Store the Smatch reports with CodeChecker.
CodeChecker store ./codechecker_smatch_reports -n smatch
```
## License
Expand Down

0 comments on commit 19420f0

Please sign in to comment.