1
- # CLion -cppcheck
1
+ # clion -cppcheck
2
2
3
- - Runs ` cppcheck ` on the fly while you write code.
4
- - Highlights lines and displays ` cppcheck ` error messages.
5
- - Supports passing options to ` cppcheck ` .
3
+ A plugin for JetBrains IDEs to provide inspections for C/C++ files based on the static analyzer [ Cppcheck] ( https://cppcheck.sourceforge.io/ ) .
6
4
7
5
This project is supported with a free open source license of CLion from
8
6
[ JetBrains] ( https://www.jetbrains.com/?from=clion-cppcheck ) .
9
7
8
+ ## Features
9
+
10
+ - Runs ` Cppcheck ` on the fly while you write code.
11
+ - Highlights lines and displays ` Cppcheck ` error messages.
12
+ - Supports passing options to ` Cppcheck ` .
13
+
10
14
## Installation
11
15
12
- See
13
- [ Installing, Updating and Uninstalling Repository Plugins] ( https://www.jetbrains.com/help/clion/managing-plugins.html )
16
+ Install the [ ` cppcheck ` plugin] [ cppcheck_plugin ] from the JetBrains Marketplace.
14
17
15
- - [ ` cppcheck ` in JetBrains Plugin Repository] [ cppcheck_plugin ]
18
+ See
19
+ [ Installing, Updating and Uninstalling Repository Plugins] ( https://www.jetbrains.com/help/clion/managing-plugins.html ) for more details.
16
20
17
- ### Initial Configuration
21
+ ### Initial Plugin Configuration
18
22
19
23
1 . Install the [ ` cppcheck ` ] ( http://cppcheck.sourceforge.net/ ) tool using the instructions on its homepage. This plugin
20
- does ** not** bundle the ` cppcheck ` tool itself, which must be installed separately.
24
+ does ** not** bundle the ` Cppcheck ` tool itself, which must be installed separately.
21
25
2 . Install the [ cppcheck plugin] [ cppcheck_plugin ] into CLion.
22
- 3 . Configure the plugin with the ** absolute** path to the ` cppcheck ` executable into the ` cppcheck path ` option.
26
+ 3 . Configure the plugin with the ** absolute** path to the ` Cppcheck ` executable into the ` cppcheck path ` option.
23
27
1 . Windows
24
28
1 . File | Settings | Cppcheck configuration
25
29
2 . Usually the path is ` C:\Program Files (x86)\Cppcheck\cppcheck.exe `
26
30
2 . macOS:
27
31
1 . CLion | Preferences | Cppcheck configuration
28
- 2 . In a terminal run ` which cppcheck ` to find the path to ` cppcheck ` . If you installed it with
32
+ 2 . In a terminal run ` which cppcheck ` to find the path to ` Cppcheck ` . If you installed it with
29
33
[ Homebrew] ( https://brew.sh/ ) , the path will be ` /usr/local/bin/cppcheck ` .
30
34
3 . Linux
31
35
1 . File | Settings | Cppcheck configuration
32
- 2 . In a terminal run ` which cppcheck ` to find the path to ` cppcheck ` . If you installed it with your
36
+ 2 . In a terminal run ` which cppcheck ` to find the path to ` Cppcheck ` . If you installed it with your
33
37
system's package manager, it is probably located at ` /usr/bin/cppcheck ` .
34
38
35
39
[ cppcheck_plugin ] : https://plugins.jetbrains.com/plugin/8143
@@ -46,10 +50,10 @@ See https://github.com/johnthagen/clion-cppcheck/issues for a complete list of t
46
50
47
51
### Analyzing header files
48
52
49
- ` cppcheck ` is not designed to be run on header files (` .h ` ) directly, as must be done for this
53
+ ` Cppcheck ` is not designed to be run on header files (` .h ` ) directly, as must be done for this
50
54
plugin, and as a result may have false positives.
51
55
52
- When run on header files directly, ` cppcheck ` defaults to C as the language, which will generate
56
+ When run on header files directly, ` Cppcheck ` defaults to C as the language, which will generate
53
57
false positives for C++ projects. So ` --language=c++ ` is implicitly added as option when analyzing header files.
54
58
55
59
It will also provide ` unusedFunction ` and ` unusedStructMember ` false positives so these findings are being suppressed.
@@ -60,7 +64,7 @@ https://github.com/johnthagen/clion-cppcheck/issues/52
60
64
61
65
### Analyzing multiple configurations
62
66
63
- By default ` cppcheck ` tries to determine all the available configurations for a file (i.e. all combination of the used
67
+ By default ` Cppcheck ` tries to determine all the available configurations for a file (i.e. all combination of the used
64
68
preprocessor defines). As the plugin doesn't get the current list of defines this may lead to findings shown in code
65
69
which is shown as disabled in the editor. To check just a specific configuration you can either add defines using ` -D `
66
70
to the options. Or you can limit the configurations to a single one adding ` --max-configs=1 ` .
@@ -76,7 +80,7 @@ https://github.com/johnthagen/clion-cppcheck/issues/52
76
80
77
81
### Multiple include paths
78
82
79
- No additional includes path are being passed to ` cppcheck ` for the analysis which might result in false positives or not
83
+ No additional includes path are being passed to ` Cppcheck ` for the analysis which might result in false positives or not
80
84
all findings being shown.
81
85
82
86
You can add additional include path using the ` -I <path> ` options.
@@ -87,8 +91,8 @@ https://github.com/johnthagen/clion-cppcheck/issues/55
87
91
88
92
### Batch analysis
89
93
90
- The batch analysis passes the files individually to ` cppcheck ` just like the highlighting inspections. So if you pass a
91
- folder to the batch analysis it might not show the same findings as when passing a folder to ` cppcheck ` itself.
94
+ The batch analysis passes the files individually to ` Cppcheck ` just like the highlighting inspections. So if you pass a
95
+ folder to the batch analysis it might not show the same findings as when passing a folder to ` Cppcheck ` itself.
92
96
93
97
It will also pass all the contents of the folder to the analysis and not just project files. This might lead to
94
98
unexpected findings.
@@ -108,10 +112,10 @@ https://github.com/johnthagen/clion-cppcheck/issues/53
108
112
109
113
### External libraries / System includes
110
114
111
- ` cppcheck ` does not support analyzing of external library or system includes. It provides profiles for several external
115
+ ` Cppcheck ` does not support analyzing of external library or system includes. It provides profiles for several external
112
116
libraries which describe the contents and behavior of the includes which allows it to finding issues with usage of them
113
117
in the code. To add such a profile to your analysis you need to specify it via the ` --library=<name> ` option. The
114
- available profile can be found in the ` cfg ` folder of your ` cppcheck ` installation.
118
+ available profile can be found in the ` cfg ` folder of your ` Cppcheck ` installation.
115
119
116
120
### Global options
117
121
@@ -188,7 +192,7 @@ Support Cppcheck >1.89. (Contribution by @SJ-Innovation)
188
192
189
193
### 1.2.0 - 2018-04-11
190
194
191
- Greatly improve plugin responsiveness to changes by using virtual files to interact with ` cppcheck ` .
195
+ Greatly improve plugin responsiveness to changes by using virtual files to interact with ` Cppcheck ` .
192
196
(Contribution by @fastasturtle )
193
197
194
198
### 1.1.0 - 2018-04-02
@@ -234,7 +238,7 @@ Fix execution on Linux.
234
238
235
239
### 1.0.1 - 2016-01-11
236
240
237
- Fix possible out of bounds line number when `` cppcheck `` gets out of sync with in-memory file.
241
+ Fix possible out of bounds line number when `` Cppcheck `` gets out of sync with in-memory file.
238
242
239
243
### 1.0.0 - 2016-01-07
240
244
0 commit comments