Qodana 2024.1 Help

Visual Studio Code

Visual Studio Code is a source code editor available for Windows, macOS and Linux. This section shows how to use Visual Studio Code version 1.81 and later for viewing Qodana reports from Qodana Cloud.

Before you start

Make sure that you have a Qodana Cloud project, and this project has at least one analysis report related to the project opened by Visual Studio Code. Also, check whether Java 11 or later is installed on your machine by running the java -version command. If necessary, install Java on your local machine.

Download and install Qodana the extension from the Visual Studio Marketplace website, or by navigating to the Extensions view in Visual Studio Code.

Configure the extension

Here is an overview of the Qodana configuration page.

Qodana settings in VS Code

You can configure the extension using the following settings:

Setting

Description

Path Prefix

If necessary, you can override the project path prefix. Here is the rule how the full path to project files is composed:

Full Path = Workspace + Path Prefix + Path in a SARIF file

Here are examples of how to define the correct path prefix:

Full path

Path in SARIF

Workspace

Path prefix

/foo/bar/baz/file

baz/file

/foo/bar

(empty, no value)

/foo/bar/baz/file

baz/file

/foo/bar/baz

..

/foo/bar/baz/file

file

/foo/bar

baz

In a Qodana Cloud report, you can check with the Files section to see how the path in a SARIF file is set.

Feel free to commit the .vscode/settings.json to your repository to share the Qodana settings with your team!

Project ID

You can get the Project ID value by opening the project from the Qodana Cloud report using the Open file in ... button and choosing Visual Studio Code as the tool for opening.

Alternatively, the ID is contained in your Qodana Cloud project URL. This URL has the following structure: https://qodana.cloud/projects/PROJECT_ID/reports/REPORT_ID. From this URL, use only PROJECT_ID. For example, from the URL https://qodana.cloud/projects/AGvmx/reports/EDKYd you will need AGvmx.

In the status bar of the Visual Studio Code UI, you can find the Qodana icon. This icon can have the following states:

  • Settings are not valid means that you need to configure the extension. To do it, you can click this icon, which will redirect you to the extension configuration page.

  • Not attached to report means that you have configured the extension, but the report has not been downloaded yet. To download the report, click the icon.

  • Attached to report means that the report was downloaded from Qodana Cloud, and now you can view it using Visual Studio Code.

Analysis results overview

Once configured, the extension connects to Qodana Cloud and downloads the latest Qodana report, so you can see it in the PROBLEMS tab of Visual Studio Code. If you still do not see the report in the PROBLEMS tab, configure the Path prefix setting.

On this tab, you can click problem items and navigate to code fragments where Qodana detected them.

The PROBLEMS in VS Code

Troubleshooting

I need to switch to another Qodana Cloud account

You can use the Qodana: Reset authentication command to switch between Qodana Cloud accounts without clearing settings. This can be useful in case you have several organizations under different Qodana Cloud accounts.

I cannot get Qodana reports using current settings

You can use the Qodana: Reset all settings command to reset all settings and credentials and try to configure the extension again, or use other settings.

Last modified: 26 April 2024