|
3 | 3 |
|
4 | 4 | **Cppcheck Official** is a Visual Studio Code extension that runs [cppcheck](https://cppcheck.sourceforge.io/) against C/C++ files upon save and reports any warnings or errors in the Problems panel. |
5 | 5 |
|
6 | | -<video src="./images/check_result.mp4" controls width="360"></video> |
| 6 | + |
7 | 7 |
|
8 | 8 | ## Features |
9 | 9 |
|
10 | 10 | - **On-save linting**: When you save a c/cpp file, `cppcheck` is automatically run on that file. |
11 | 11 | - **Per-file diagnostics**: Only diagnostics relevant to the saved file are displayed. |
12 | 12 | - **Configurable severity threshold**: Filter out messages below a chosen severity level (`info`, `warning`, or `error`). |
13 | 13 | - **Diagnostic cleanup**: When you close a file, its diagnostics are automatically cleared. |
14 | | -- **Project file support**: You can feed your project file to cppcheck through the `--project` flag in the `cppcheck-official.arguments` field in the extension settings. (See video below) |
15 | | - |
16 | | -<video src="./images/project_file.mp4" controls width="360"></video> |
| 14 | +- **Project file support**: You can feed your project file to cppcheck through the `--project` flag in the `cppcheck-official.arguments` field in the extension settings. (See GIF below) |
| 15 | + |
17 | 16 | - **Warning notes**: Display notes for warnings when those are available |
18 | 17 | - **Dynamic config**: The extension supports running a script to generate arguments to pass to cppcheck. This can be done by including the command in the argument field wrapped with \${}, e.g. `--suppress=memleak:src/file1.cpp ${bash path/to/script.sh}`. The script is expected to output the argument(s) wrapped with \${}. If the script e.g. creates a project file it should print out as `${--project=path/to/projectfile.json}`. This output will be spliced into the argument string as such: `--suppress=memleak:src/file1.cpp --project=path/to/projectfile.json`. |
19 | 18 |
|
20 | | -<video src="./images/suppression.mp4" controls width="360"></video> |
| 19 | + |
21 | 20 | ## Requirements |
22 | 21 |
|
23 | 22 | **Cppcheck** must be installed on your system. |
24 | 23 | - By default, this extension looks for `cppcheck` on the system PATH. |
25 | 24 | - Alternatively, specify a custom executable path using the `cppcheck-official.path` setting. |
26 | 25 |
|
27 | | -<video src="./images/cppcheck_path.mp4" controls width="360"></video> |
| 26 | + |
28 | 27 |
|
29 | 28 | Examples of installing Cppcheck: |
30 | 29 | - On Linux (Debian/Ubuntu), install via `sudo apt-get install cppcheck`. |
|
0 commit comments