Skip to content
Merged
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
34 changes: 34 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,40 @@
}
}
}
],
"walkthroughs": [
{
"id": "cppcheck-official.gettingStarted",
"title": "Get Started with Cppcheck",
"description": "Learn the basics of using cppcheck in VS Code with the official extension",
"steps": [
{
"id": "step1",
"title": "Connect extension to your cppcheck executable",
"description": "",
"media": {
"markdown": "walkthrough/path.md"
},
"completionEvents": ["onSettingChanged:cppcheck-official.path"]
},
{
"id": "step2",
"title": "Customize settings",
"description": "",
"media": {
"markdown": "walkthrough/arguments.md"
}
},
{
"id": "step3",
"title": "Try out the extension",
"description": "",
"media": {
"markdown": "walkthrough/test.md"
}
}
]
}
]
},
"scripts": {
Expand Down
13 changes: 13 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ function parseMinSeverity(str: string): SeverityNumber {
// Your extension is activated the very first time the command is executed.
export async function activate(context: vscode.ExtensionContext) {

// Register a command to push user to workspace settings from walkthrough
context.subscriptions.push(
vscode.commands.registerCommand(
'cppcheck-official.configureArguments',
async () => {
await vscode.commands.executeCommand(
'workbench.action.openWorkspaceSettings',
'cppcheck-official.arguments'
);
}
)
);

// Create a diagnostic collection.
const diagnosticCollection = vscode.languages.createDiagnosticCollection("Cppcheck");
context.subscriptions.push(diagnosticCollection);
Expand Down
12 changes: 12 additions & 0 deletions walkthrough/arguments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@


Cppcheck works best for you if you set it up according to your needs. You may e.g. want to disable certain kinds of warnings, and if you have cppcheck premium you will need to set this up for it to work in this extension. All of this is done through the extension property 'arguments', with the different flags or arguments available being detailed in the [official cppcheck documentation](https://files.cppchecksolutions.com/manual.pdf#page=13).

It is recommended to set up these settings in the workspace settings so that you and your team easily can work with the same set up. Furthermore you are likely to want to have the same settings between VS Code and your CI workflows. This is most easily done through project files, which are referenced from the argument setting (see [documentation](https://files.cppchecksolutions.com/manual.pdf#page=4) for how to create a project file).

![image showing project file path being set in arguments property](../images/project_file.png)

Another way of synching your set up between different environments is through using scripts. The argument property supports running scripts with the syntax `@(/path/to/script.sh)`. The extension expects this script to output what to use for arguments wrapped with `@()`, so e.g. `echo "@(--report-progress --enable=style --inconclusive --suppress=syntaxError)"`.


[Set up arguments](command:cppcheck-official.configureArguments)
5 changes: 5 additions & 0 deletions walkthrough/path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
![image showing where to find the cppcheck path property](../images/cppcheck_path.png)

Open the extension settings. Set the path to your cppcheck executable in the `path` property.

[Set path](command:workbench.action.openSettings?%5B%22cppcheck-official.path%22%5D)
5 changes: 5 additions & 0 deletions walkthrough/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
![Image showing cppcheck warnings in the problems tab.](../images/check_result2.png)

Open a .c or .cpp file and save it. If cppcheck detects any issues these will show up in the problems tab in the bottom of your VS Code window.

The extension is in continuous development, so if you find issues, have feature requests or some other kind of feedback we are happy to recieve it at the [Cppcheck Official github page](https://github.com/cppchecksolutions/vscode-cppcheck-official/issues).
Loading