Overview Version History Q & A Rating & Review
cppcheck-misra Extension
A VS Code extension that runs cppcheck with MISRA C 2012 compliance checking on C/C++ files. Automatically checks code for MISRA violations when saving files and provides visual feedback in the editor.
Features
Automatic checking : Runs cppcheck MISRA analysis automatically when saving C/C++ files
Visual diagnostics : Displays MISRA violations as errors, warnings, or informational messages based on MISRA compliance levels
Manual execution : Can be triggered manually via command palette
Configurable : Customize cppcheck path and enable/disable auto-checking
Performance optimized : Parallel processing for faster analysis
Reduced noise : Automatic suppression of common false positives
Supported MISRA Compliance Levels
Mandatory violations → Error (red underline)
Required violations → Warning (yellow underline)
Advisory violations → Information (blue/gray underline)
Requirements
cppcheck must be installed and available in your system PATH
Alternatively, you can specify the full path to cppcheck in the extension settings
To install cppcheck:
Windows : Download from cppcheck website or use package managers like chocolatey
macOS : brew install cppcheck
Linux : sudo apt-get install cppcheck (Ubuntu/Debian) or use your distribution's package manager
Extension Settings
This extension contributes the following settings:
cppcheck-misra.cppcheckPath: Path to cppcheck executable (default: "cppcheck")
cppcheck-misra.enableOnSave: Enable/disable automatic checking on file save (default: true)
cppcheck-misra.std: C language standard passed to cppcheck (options: c89, c99, c11, default: "c99")
cppcheck-misra.severityMapping.mandatory: Diagnostic severity for MISRA Mandatory violations (options: error, warning, information, hint, default: "error")
cppcheck-misra.severityMapping.required: Diagnostic severity for MISRA Required violations (options: error, warning, information, hint, default: "warning")
cppcheck-misra.severityMapping.advisory: Diagnostic severity for MISRA Advisory violations (options: error, warning, information, hint, default: "information")
Usage
Automatic Checking
Open a C or C++ file
Save the file (Ctrl+S / Cmd+S)
The extension will automatically run cppcheck MISRA analysis
Violations will be displayed as editor diagnostics with appropriate severity levels
Manual Execution
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
Type "Cppcheck MISRA: Run on current file"
Select the command to run cppcheck on the current file
Known Issues
The extension requires cppcheck to be installed separately
File must be saved to disk before checking (unsaved changes are not analyzed)
Currently only supports single file analysis
Release Notes
0.0.1
Initial release of cppcheck-misra extension:
Automatic MISRA C 2012 checking on file save
Manual execution via command palette
Configurable cppcheck path and auto-check behavior
Visual diagnostics with MISRA compliance level-based severity
Enjoy using cppcheck-misra!