From a48ee8e7c57f34bb089a738facaf65edd493f74c Mon Sep 17 00:00:00 2001 From: Jay Rajput Date: Sun, 11 Oct 2020 23:53:56 +0530 Subject: [PATCH] [docs] Explain how to use Smatch and it's converter on the kernel - 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 --- docs/README.md | 1 + docs/supported_code_analyzers.md | 1 + tools/report-converter/README.md | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/docs/README.md b/docs/README.md index 74e4be6541..f4c891da41 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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) | diff --git a/docs/supported_code_analyzers.md b/docs/supported_code_analyzers.md index 9a924d0b12..b1eddceeb6 100644 --- a/docs/supported_code_analyzers.md +++ b/docs/supported_code_analyzers.md @@ -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) | ✓ | diff --git a/tools/report-converter/README.md b/tools/report-converter/README.md index c6b1a27593..d774b0a001 100644 --- a/tools/report-converter/README.md +++ b/tools/report-converter/README.md @@ -21,6 +21,7 @@ a CodeChecker server. * [Pyflakes](#pyflakes) * [Markdownlint](#markdownlint) * [Coccinelle](#coccinelle) +* [Smatch](#smatch) * [License](#license) ## Install guide @@ -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 @@ -409,7 +411,29 @@ 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 +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