gui-manual: Preferences

This commit is contained in:
Daniel Marjamäki 2020-07-19 08:56:14 +02:00
parent 3723c708fc
commit 011c5e97f9
1 changed files with 110 additions and 23 deletions

View File

@ -9,9 +9,11 @@ documentclass: report
# Standalone analysis # Standalone analysis
It is possible to quickly analyze files. Open the `Analyze` menu and click on either `Files...` or `Directory...`. It is possible to quickly analyze files. Open the `Analyze` menu and click on
either `Files...` or `Directory...`.
It is recommended that you create a project for analysis. A properly configured project will give you better analysis. It is recommended that you create a project for analysis. A properly configured
project will give you better analysis.
# Project # Project
@ -55,9 +57,11 @@ Cppcheck automatically checks the code with different preprocessor configuration
code2 code2
#endif #endif
Cppcheck will automatically perform analysis both when A is defined and B is defined. So any bugs in both code1 and code2 will be detected. Cppcheck will automatically perform analysis both when A is defined and B is
defined. So any bugs in both code1 and code2 will be detected.
If you want to configure that A will always be defined in Cppcheck analysis you can do that here. If you want to configure that A will always be defined in Cppcheck analysis you
can do that here.
Defines are separated by semicolon. So you can for instance write: Defines are separated by semicolon. So you can for instance write:
@ -75,9 +79,11 @@ Cppcheck automatically checks the code with different preprocessor configuration
code2 code2
#endif #endif
Cppcheck will automatically perform analysis both when A is defined and B is defined. So any bugs in both code1 and code2 will be detected. Cppcheck will automatically perform analysis both when A is defined and B is
defined. So any bugs in both code1 and code2 will be detected.
If you want to configure that A is never defined in Cppcheck analysis you can do that here. If you want to configure that A is never defined in Cppcheck analysis you can
do that here.
Undefines are separated by semicolon. So you can for instance write: Undefines are separated by semicolon. So you can for instance write:
@ -97,40 +103,57 @@ Check the libraries that you use in the `Libraries` listbox.
#### Cppcheck build dir #### Cppcheck build dir
This is a work-folder that Cppcheck uses. Each Cppcheck project should have a separate build dir. It is used for: This is a work-folder that Cppcheck uses. Each Cppcheck project should have a
separate build dir. It is used for:
* whole program analysis * whole program analysis
* debug output * debug output
* faster analysis (if a source file has changed check it, if source file is not changed then reuse old results) * faster analysis (if a source file has changed check it, if source file is
not changed then reuse old results)
* statistics * statistics
#### Parser #### Parser
It is in general recommended to use Cppcheck parser. However you can choose to use Clang parser; Clang will be executed with a command line flag that tells it to dump its AST and Cppcheck will read that AST and convert it into a corresponding Cppcheck AST and use that. It is in general recommended to use Cppcheck parser. However you can choose to
use Clang parser; Clang will be executed with a command line flag that tells it
to dump its AST and Cppcheck will read that AST and convert it into a
corresponding Cppcheck AST and use that.
#### Analysis #### Analysis
Configure what kind of analysis you want. Configure what kind of analysis you want.
The `Normal analysis` is recommended for most use cases. Especially if you use Cppcheck in CI. The `Normal analysis` is recommended for most use cases. Especially if you use
Cppcheck in CI.
The `Bug hunting` can be used if you really want to find a bug in your code and can invest time looking at bad results and providing extra configuration. The `Bug hunting` can be used if you really want to find a bug in your code
and can invest time looking at bad results and providing extra configuration.
#### Limit analysis #### Limit analysis
You can turn off checking of headers. That could be interesting if Cppcheck is very slow. But normally, you should check the code in headers. You can turn off checking of headers. That could be interesting if Cppcheck is
very slow. But normally, you should check the code in headers.
It is possible to check the code in unused templates. However the Cppcheck AST will be incomplete/wrong. The recommendation is that you do not check unused templates to avoid wrong warnings. The templates will be checked properly when you do use them. It is possible to check the code in unused templates. However the Cppcheck AST
will be incomplete/wrong. The recommendation is that you do not check unused
templates to avoid wrong warnings. The templates will be checked properly when
you do use them.
Max CTU depth: How deep should the whole program analysis be. The risk with a "too high" value is that Cppcheck will be slow. Max CTU depth: How deep should the whole program analysis be. The risk with a
"too high" value is that Cppcheck will be slow.
Max recursion in template instantiation: Max recursion when Cppcheck instantiates templates. The risk with a "too high" value is that Cppcheck will be slow and can require much memory. Max recursion in template instantiation: Max recursion when Cppcheck
instantiates templates. The risk with a "too high" value is that Cppcheck will
be slow and can require much memory.
### Warning options ### Warning options
#### Root path #### Root path
The root path for warnings. Cppcheck will strip away this part of the path from warnings. For instance if there is a warning in `../myproject/foo/bar/file.cpp` and the root path is `../myproject/foo` then the path for the warning will be `bar/file.cpp`. The root path for warnings. Cppcheck will strip away this part of the path
from warnings. For instance if there is a warning in
`../myproject/foo/bar/file.cpp` and the root path is `../myproject/foo` then
the path for the warning will be `bar/file.cpp`.
#### Warning Tags #### Warning Tags
@ -146,38 +169,102 @@ List of suppressions. These warnings will not be shown.
### Addons ### Addons
Y2038 - 32-bit timers that count number of seconds since 1970 will overflow in year 2038. Check that the code does not use such timers. Y2038 - 32-bit timers that count number of seconds since 1970 will overflow in
year 2038. Check that the code does not use such timers.
Thread safety - Check that the code is thread safe Thread safety - Check that the code is thread safe
Cert - Ensure that the Cert coding standard is followed Cert - Ensure that the Cert coding standard is followed
Misra - Ensure that the Misra coding standard is followed. Please note you need to have a textfile with the misra rule texts to get proper warning messages. Cppcheck is not legally allowed to distribute the misra rule texts. Misra - Ensure that the Misra coding standard is followed. Please note you
need to have a textfile with the misra rule texts to get proper warning
messages. Cppcheck is not legally allowed to distribute the misra rule texts.
Clang-tidy - Run Clang-tidy Clang-tidy - Run Clang-tidy
# Preferences # Preferences
TODO `Number of threads`: Number of threads to use in analysis. Each thread checks
its own source file.
`Force checking of all #ifdef configurations`: Cppcheck try to check all code
and will therefore guess different preprocessor configurations. The maximum
number of configurations that is checked is 14 by default.
`Show full path of files`: Show the full paths in the results.
`Show "No errors found" message when no errors found`: If you want to get a
message box about this.
`Display error id column "Id"`: Show error id in results
`Enable inline suppressions`: You can suppress warnings with comments. See the
Cppcheck manual (http://cppcheck.sf.net/manual.pdf) for more information about
those.
`Check for inconclusive errors also`: When full analysis of the code can not
determine if there should be a warning or not, it is inconclusive. Normally
Cppcheck does not warn then.
`Show statistics on check completion`: Show statistics in a window when
analysis finish.
`Show internal warnings in log`: Internal warnings (for debugging) is shown
in the `Analysis log`.
`Applications`: Configure external editor to open from context menu when you
right click on a warning.
`Save all errors when creating report`: If hidden warnings should be saved or
not.
`Save full path to files in report`: If you use `Root path` the warnings on the
screen will not have the full path.
`Language`: Configure language to use for GUI.
`Python binary`: To be able to execute addons, Cppcheck needs to know where
python is. Unless you configure something, Cppcheck will try to execute python
in your PATH.
`Misra rule texts`: Only needed if you want to use the Misra addon. Cppcheck is
not legally allowed to distribute the Misra rule texts and these must be
provided by users. The Misra rule texts are proprietary. An example rule text
file can be found here: https://github.com/danmar/cppcheck/blob/main/addons/test/misra/misra2012_rules_dummy_ascii.txt
`Clang path`: The path to `clang` binary. If no path is provided then system
PATH is used.
`Visual studio headers`: If you want to use the Visual Studio headers in the
analysis you can provide the path(s) here. Hint: Open a visual studio command
prompt and type `SET INCLUDE`. Then copy/paste the paths.
`Code editor style`: The visual theme to use for the code editor that is used
when you investigate results.
# Looking at results # Looking at results
When you have run the analysis it is time to look at the results. When you have run the analysis it is time to look at the results.
If you click on a warning then the corresponding code will be shown in the "Warning details" at the bottom. If you click on a warning then the corresponding code will be shown in the
"Warning details" at the bottom.
You can right click warnings to get options. The difference of "hiding" a warning and "suppressing" a warning is that the suppression is permanent and hiding the warning is only temporary. You can right click warnings to get options. The difference of "hiding" a
warning and "suppressing" a warning is that the suppression is permanent and
hiding the warning is only temporary.
# Tagging warnings # Tagging warnings
You can manually categorize warnings. You can manually categorize warnings.
You choose the names of the categories yourself in the project file dialog. You choose the names of the categories yourself in the project file dialog.
If tag names are configured then when you look at results you can right click on a warning and tag it. If tag names are configured then when you look at results you can right click
on a warning and tag it.