Installing the Visual Studio Code extension

To install the Perforce Static Analysis extension for Visual Studio Code:

  1. Download the applicable Klocwork Desktop tools package (kw-desktop-tools.<version>.<platform>.zip) from Support downloads.

    Tip: The Visual Studio Code extension is Klocwork Server version agnostic. You can install a newer version of the extension by downloading a newer or latest version of the Klocwork Desktop tools package, while keeping your Klocwork Server at an earlier version. This allows you to support later versions of Visual Studio Code and take advantage of certainbug fixes.

    Log in to the site using your Rogue Wave Support Center user ID and password. If you do not currently have a Rogue Wave Support Center user ID and password, register as a new user. Active maintenance is required to access this page.

    You can download the zip package directly from the Downloads section in the Klocwork Portal if your administrator has deployed the desktop analysis plug-ins. See Downloading and deploying the desktop analysis plug-ins for more information.
  2. Once downloaded, unzip the package into your preferred location.
  3. In Visual Studio Code, click Extensions > ... and select Install from VSIX.
  4. Navigate to the downloaded .vsix file (For example, 'p4savscodeextension.vsix') and select OK.
  5. Refresh and the extension now appears in your Extensions panel.
  6. Navigate to the Perforce Static Analysis extension settings.

  7. Under Perforce Static Analysis, locate the Active Tool Selection section. From this menu, select Klocwork to enable the Klocwork panel.

The Klocwork panel is now visible on the left side of the IDE and all Klocwork commands are available. This step is only required upon first use of the extension.

Configuring your settings

You can configure your settings as follows:
  1. In VS Code, open the Extensions panel.
  2. Right-click the Klocwork extension, select Settings. You can configure the following:
    • Continuous Analysis Enabled allows continuous analysis to run against your project; remove this option if you prefer to run analysis on demand.
    • Display Klocwork Analysis Results When Workspace Loaded determines which Klocwork diagnostics are displayed when opening a workspace with previously generated analysis results.
    • Help: Source allows you to specify where to access Klocwork checker help from (Online or Server). Default is set to Server.
    • Klocwork Tools Location allows you to specify the location of the Klocwork command line tools; This is required to run analysis (For example, 'C:\Klocwork\Command Line 21.1\bin'). Note that the extension is also able to pick up this setting from the PATH environment variable. For instructions on how to install these tools, see Installing the Build Tools package.
    • Logging: Level determines the level of details provided in the Klocwork output log.