diff --git a/man/images/ide-clion-configuration-misra.png b/man/images/ide-clion-configuration-misra.png new file mode 100644 index 00000000000..30980e2a316 Binary files /dev/null and b/man/images/ide-clion-configuration-misra.png differ diff --git a/man/images/ide-clion-configuration.png b/man/images/ide-clion-configuration.png new file mode 100644 index 00000000000..1c33b79bf57 Binary files /dev/null and b/man/images/ide-clion-configuration.png differ diff --git a/man/images/ide-clion-file-menu.png b/man/images/ide-clion-file-menu.png new file mode 100644 index 00000000000..f2c46233b20 Binary files /dev/null and b/man/images/ide-clion-file-menu.png differ diff --git a/man/images/ide-clion-plugins.png b/man/images/ide-clion-plugins.png new file mode 100644 index 00000000000..58dfe718517 Binary files /dev/null and b/man/images/ide-clion-plugins.png differ diff --git a/man/images/ide-clion-warning.png b/man/images/ide-clion-warning.png new file mode 100644 index 00000000000..7f92fdd5175 Binary files /dev/null and b/man/images/ide-clion-warning.png differ diff --git a/man/images/ide-eclipse-help-menu.png b/man/images/ide-eclipse-help-menu.png new file mode 100644 index 00000000000..fd20ccef1cb Binary files /dev/null and b/man/images/ide-eclipse-help-menu.png differ diff --git a/man/images/ide-eclipse-marketplace.png b/man/images/ide-eclipse-marketplace.png new file mode 100644 index 00000000000..5f3bd866920 Binary files /dev/null and b/man/images/ide-eclipse-marketplace.png differ diff --git a/man/images/ide-eclipse-preferences.png b/man/images/ide-eclipse-preferences.png new file mode 100644 index 00000000000..0419f8eb268 Binary files /dev/null and b/man/images/ide-eclipse-preferences.png differ diff --git a/man/images/ide-eclipse-problems.png b/man/images/ide-eclipse-problems.png new file mode 100644 index 00000000000..a995315ba23 Binary files /dev/null and b/man/images/ide-eclipse-problems.png differ diff --git a/man/images/ide-eclipse-project-menu.png b/man/images/ide-eclipse-project-menu.png new file mode 100644 index 00000000000..b3d3f3e223a Binary files /dev/null and b/man/images/ide-eclipse-project-menu.png differ diff --git a/man/images/ide-eclipse-project-properties.png b/man/images/ide-eclipse-project-properties.png new file mode 100644 index 00000000000..31f98d68576 Binary files /dev/null and b/man/images/ide-eclipse-project-properties.png differ diff --git a/man/images/ide-eclipse-window-menu.png b/man/images/ide-eclipse-window-menu.png new file mode 100644 index 00000000000..0394c83c0ee Binary files /dev/null and b/man/images/ide-eclipse-window-menu.png differ diff --git a/man/images/ide-vs-external-tool-file.png b/man/images/ide-vs-external-tool-file.png new file mode 100644 index 00000000000..884c67d63c8 Binary files /dev/null and b/man/images/ide-vs-external-tool-file.png differ diff --git a/man/images/ide-vs-external-tool-project.png b/man/images/ide-vs-external-tool-project.png new file mode 100644 index 00000000000..f7be15df3da Binary files /dev/null and b/man/images/ide-vs-external-tool-project.png differ diff --git a/man/images/ide-vs-external-tools-menu.png b/man/images/ide-vs-external-tools-menu.png new file mode 100644 index 00000000000..6d7251fc234 Binary files /dev/null and b/man/images/ide-vs-external-tools-menu.png differ diff --git a/man/images/ide-vs-output.png b/man/images/ide-vs-output.png new file mode 100644 index 00000000000..5b08f164775 Binary files /dev/null and b/man/images/ide-vs-output.png differ diff --git a/man/images/ide-vs-tools-menu.png b/man/images/ide-vs-tools-menu.png new file mode 100644 index 00000000000..de1013b1aea Binary files /dev/null and b/man/images/ide-vs-tools-menu.png differ diff --git a/man/images/ide-vscode-install.png b/man/images/ide-vscode-install.png new file mode 100644 index 00000000000..d9d95b17e0a Binary files /dev/null and b/man/images/ide-vscode-install.png differ diff --git a/man/images/ide-vscode-settings-menu.png b/man/images/ide-vscode-settings-menu.png new file mode 100644 index 00000000000..d10d4d6612a Binary files /dev/null and b/man/images/ide-vscode-settings-menu.png differ diff --git a/man/images/ide-vscode-settings.png b/man/images/ide-vscode-settings.png new file mode 100644 index 00000000000..5d1637fa481 Binary files /dev/null and b/man/images/ide-vscode-settings.png differ diff --git a/man/images/ide-vscode-warning.png b/man/images/ide-vscode-warning.png new file mode 100644 index 00000000000..9e323e9bee0 Binary files /dev/null and b/man/images/ide-vscode-warning.png differ diff --git a/man/manual.md b/man/manual.md index 79b19124e22..4b0b598ac7e 100644 --- a/man/manual.md +++ b/man/manual.md @@ -1480,6 +1480,157 @@ To see all options, run: python3 reports/explorer/report.py -h +# IDE integration + +## Visual Studio Code + +Install the extension "Cppcheck Official": + +![Installing the Cppcheck Official extension](images/ide-vscode-install.png) + +Click on the "gearwheel" to open a popup menu. Click on "Settings": + +![Opening the extension settings](images/ide-vscode-settings-menu.png) + +Enable Cppcheck and set its path: + +![Cppcheck Official settings](images/ide-vscode-settings.png) + +If you want to pass extra options to Cppcheck, you can use the "Arguments" option. + +::: {.content-visible when-profile="premium"} + +For instance, premium options such as a coding standard can be configured with the "Arguments" option. + +::: + +You can now switch to the editor and write code. Cppcheck is executed when you save. In the screenshot +below we have written the faulty code `int x = 1000 / 0;`: + +![Cppcheck warnings in Visual Studio Code](images/ide-vscode-warning.png) + +## Visual Studio - External tool + +Open "External Tools..." in the "Tools" menu: + +![The Tools menu in Visual Studio](images/ide-vs-external-tools-menu.png) + +Add a "Cppcheck File" command: + +![Adding a "Cppcheck File" command](images/ide-vs-external-tool-file.png){width=50%} + +- Title: anything you like, for instance `Cppcheck File` +- Command: the path to the Cppcheck executable, for instance `C:\Program Files\Cppcheck\cppcheck.exe` +- Arguments: + + ``` + --enable=style -q --template=vs "$(ItemPath)" + ``` + +- Ensure that "Use Output window" is selected. + +Add a "Cppcheck Project" command: + +![Adding a "Cppcheck Project" command](images/ide-vs-external-tool-project.png){width=50%} + +- Title: anything you like, for instance `Cppcheck Project` +- Command: the path to the Cppcheck executable, for instance `C:\Program Files\Cppcheck\cppcheck.exe` +- Arguments: + + ``` + --enable=style -j12 -q --template=vs --project="$(ProjectDir)$(ProjectFileName)" + ``` + +- Modify `-j12` so that the desired number of threads is used. +- Ensure that "Use Output window" is selected. + +With these arguments Cppcheck will analyze the current vcxproj project. + +In both commands you can add arbitrary extra arguments, for instance `--library=..`, `--platform=..` +or `--inconclusive`. + +::: {.content-visible when-profile="premium"} + +For Cppcheck Premium the command is typically `C:\Program Files\Cppcheck Premium\cppcheck.exe`, and +you can add `--premium=..` options to the arguments. + +::: + +You can now execute "Cppcheck File" and "Cppcheck Project" in the "Tools" menu: + +![Executing Cppcheck from the Tools menu](images/ide-vs-tools-menu.png) + +The warnings are shown in the Output window at the bottom of the screen. You can double click on a +warning to open the location in the editor. + +![Cppcheck warnings in the Output window](images/ide-vs-output.png) + +## Eclipse-based IDEs + +In the "Help" menu, click on "Eclipse Marketplace...": + +![The Help menu in Eclipse](images/ide-eclipse-help-menu.png) + +Install the "cppcheclipse" plugin: + +![Installing cppcheclipse](images/ide-eclipse-marketplace.png){width=55%} + +Open the "Window" menu and click on "Preferences": + +![The Window menu in Eclipse](images/ide-eclipse-window-menu.png) + +Configure the path to the Cppcheck executable: + +![cppcheclipse preferences](images/ide-eclipse-preferences.png) + +Adjust the cppcheclipse options in the project properties. Open the "Project" menu and click on +"Properties": + +![The Project menu in Eclipse](images/ide-eclipse-project-menu.png) + +![cppcheclipse project properties](images/ide-eclipse-project-properties.png){width=70%} + +Problems will be shown in the editor: + +![Cppcheck warnings in Eclipse](images/ide-eclipse-problems.png) + +::: {.content-visible when-profile="premium"} + +In the above screenshot Misra C 2023 is enabled in the project properties, and there are Misra +violations on line 2 and 6. + +::: + +## CLion + +Open "Settings..." in the "File" menu: + +![The File menu in CLion](images/ide-clion-file-menu.png){width=40%} + +In the settings dialog, browse to "Plugins" and install the "cppcheck" plugin: + +![Installing the cppcheck plugin](images/ide-clion-plugins.png) + +After installing the plugin, edit the "Cppcheck Configuration". Set the "Cppcheck Path" and the +"Cppcheck Options": + +![Cppcheck Configuration](images/ide-clion-configuration.png) + +::: {.content-visible when-profile="premium"} + +For instance, to enable Misra C++ 2023 add the option `--premium=misra-c++-2023`: + +![Cppcheck Configuration with Misra C++ 2023](images/ide-clion-configuration-misra.png) + +The CLion Cppcheck plugin does not handle the Cppcheck safety certified behavior well, therefore +also add the option `--premium=safety-off`. + +::: + +Cppcheck warnings are now shown in the editor: + +![Cppcheck warnings in CLion](images/ide-clion-warning.png) + # Check level ## Reduced