Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
# Cppcheck Official


**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.

![GIF showing example of warnings output from cppcheck](./images/check_result.gif)

## Features

- **On-save linting**: When you save a c/cpp file, `cppcheck` is automatically run on that file.
- **Per-file diagnostics**: Only diagnostics relevant to the saved file are displayed.
- **Configurable severity threshold**: Filter out messages below a chosen severity level (`info`, `warning`, or `error`).
- **Set C/C++ standard**: Easily specify `--std=<id>` (e.g. `c++17`, `c99`, etc.).
- **Diagnostic cleanup**: When you close a file, its diagnostics are automatically cleared.
- **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.
- **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)
![GIF showing where to set up project file](./images/project_file.gif)
- **Warning notes**: Display notes for warnings when those are available
- **Warning type suppression**: Suppress warnings with comments on the form `// cppcheck suppress >warning type<`. Cppcheck also warns about unmatched suppressions.
![GIF showing how to suppress warnings](./images/suppression.gif)

## Requirements

**Cppcheck** must be installed on your system.
- By default, this extension looks for `cppcheck` on the system PATH.
- Alternatively, specify a custom executable path using the `cppcheck-official.path` setting.

![GIF showing location of path setting](./images/cppcheck_path.gif)

Examples of installing Cppcheck:
- On Linux (Debian/Ubuntu), install via `sudo apt-get install cppcheck`.
- On macOS with Homebrew: `brew install cppcheck`.
Expand Down
Binary file added images/check_result.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cppcheck_path.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/project_file.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/suppression.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.