Qodana 2024.1 Help

Native mode

By default, Qodana runs its linters using Docker based on Linux images. In specific cases, you have to deal with private packages or run Qodana on the operating systems that provide incomplete support for Docker.

To overcome this, starting from version 2023.3 Qodana supports the native mode for the Qodana for .NET mode by default. In this case, Qodana reuses its execution environment, which lets you execute Qodana in exactly the same environment as you use for building the projects, use the correct operating system, have access to all repository credentials, and resolve dependencies.

Before you start

Make sure that you have a proper version of the .NET SDK and all required dependencies installed on your machine.

Build the project before inspecting it using Qodana. You can do it by using the bootstrap key of the qodana.yaml file.

The project building and artifact packaging stages should occur before Qodana or simultaneously with it. Because running Qodana may affect the project state and its files, we recommend that you avoid reusing the same directory in your build pipelines any further.

You can also provide Qodana with a pre-built project, or specify the build steps in your CI/CD pipeline. In this case, in your repository create the empty qodana.yaml file to eliminate warnings related to project building.

In your operating system, save the QODANA_TOKEN environment variable containing the Qodana Cloud project token.

Install Qodana CLI on the machine where you plan to run Qodana.

Starting from the version 2023.3 of Qodana, the sanity inspection will report in case the qodana.yaml file containing the bootstrap key is missing in your project directory. The bootstrap key should contain instructions for building the project. If you do not wish to build the project, disable this inspection using the --disable-sanity option, add this inspection to a baseline, or create the qodana.yaml file that will contain the ide: QDNET configuration.

We recommend running the native mode on the same machine where you build a project because this can guarantee that Qodana has access to private NuGet feeds.

How it works

Assuming that you have already installed Qodana CLI and followed the instructions from the previous section, you have two options for running Qodana in the native mode:

qodana scan \    --ide QDNET

This command will download the required JetBrains IDE binary file and start Qodana.

If you have already specified ide: QDNET in the qodana.yaml file, you do not have to use it in this command, so this command is already sufficient:

qodana scan

In the qodana.yaml file, save the following configuration:

ide: QDNET

Run Qodana using this command:

qodana scan
Last modified: 07 June 2024