Deployment
This section describes all deployment options available for Qodana.
System requirements
Requirement | Minimum | Recommended |
|---|---|---|
RAM | 2 GB of free RAM | 8 GB of total system RAM |
CPU | Any modern CPU | Multicore CPU. Qodana supports multithreading for different operations and processes making it faster the more CPU cores it can use. |
Disk space | 2.5 GB + space for all dependencies and cache | At least 5 GB of free space + space for all dependencies and cache |
Operating system | Officially released versions of the following:
| The latest versions of the following:
|
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, Qodana supports native mode for the following linters:
Linter | Linter name |
|---|---|
| |
| |
| |
| |
| |
| |
| |
|
You can run native mode on Linux, macOS, and Microsoft Windows.
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
General steps for all supported linters
In your operating system, save the QODANA_TOKEN environment variable containing the Qodana Cloud project token.
If you wish to run Qodana using a command line, then install Qodana CLI on the machine where you will run it.
Starting from 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. You can disable this inspection using the --disable-sanity option, or add this inspection to a baseline.
Qodana for .NET
In addition to general steps, 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, it is advised to avoid reusing the same directory in your build pipelines any further.
You can also provide Qodana a pre-built project, or specify the build steps in your CI/CD pipeline. To remove warnings related to project building, in your repository create the empty qodana.yaml file.
How native mode works
You can enable native mode by using the --within-docker false option in combination with the --linter <linter-name> option. These options tell Qodana to download and employ the required JetBrains IDE binary file while running a Qodana linter.
Below are the examples showing how you can run Qodana in native mode:
Make sure that the
QODANA_TOKENvariable is defined in the environment and refers to a proper project token. If necessary, you can define it:QODANA_TOKEN=<cloud-project-token>Run the
qodana scancommand:qodana scan \ --linter <linter-name> \ --within-docker false
IDE integration
You can run Qodana in several JetBrains IDEs, Visual Studio Code, and Visual Studio. See the Overview of IDE Integration section for details.
Qodana CLI
Qodana CLI is a simple cross-platform command-line tool that lets you run Qodana linters with minimum effort.
To run Qodana CLI in the default mode, you must have Docker or Podman installed and running locally. If you are using Linux, you should be able to run Docker under your current non-root user.
Install Qodana CLI on your machine using available options:
Install with Homebrew (recommended):
brew install jetbrains/utils/qodanaAlternatively, you can install Qodana CLI using our installer:
curl -fsSL https://jb.gg/qodana-cli/install | bashYou can install a
nightlyor any other version the following way:curl -fsSL https://jb.gg/qodana-cli/install | bash -s -- nightlyOn Linux, you can also install Qodana using Go:
go install github.com/JetBrains/qodana-cli@latestInstall with Windows Package Manager (recommended):
winget install -e --id JetBrains.QodanaCLIInstall with Chocolatey:
choco install qodanaInstall with Scoop:
scoop bucket add jetbrains https://github.com/JetBrains/scoop-utils scoop install qodanaIn the project root directory, declare the
QODANA_TOKENvariable containing a project token:QODANA_TOKEN=<cloud-project-token>set QODANA_TOKEN=<cloud-project-token>Run Qodana:
qodana scanqodana scan
Docker images
Qodana is also distributed across multiple Docker images listed in the table below:
Linter | Docker image |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
* Using optional tags, you can pull pre-configured Qodana images:
For the Qodana for C/C++ and Qodana Community for C/C++ linters, use the
-clangXXtag to specify the Clang-Tidy version from 15 to 18.For the Qodana for Ruby linter, use the
-ruby3.Xtag to specify the Ruby version from 3.1 to 3.4. If not specified, version 3.4 will be used.Using the
-privilegedtag, you can run Qodana in the privileged mode to execute commands that require root access. In this case, Qodana comes with a defaultqodanauser that possesses root privileges and does not require a password. To use this mode with the Qodana for C/C++, Qodana Community for C/C++, and Qodana for Ruby linters, the-clangXXand-ruby3.Xtags should be specified, respectively.
To specify Docker images from the table, use the --image option.
CI integration
You can run Qodana using various CI/CD pipelines, as explained in the Overview of CI integration section.
For Azure Pipelines, CircleCI, GitHub Actions, GitLab CI/CD, and TeamCity, Qodana provides native solutions. To run Qodana using Bitbucket Cloud, and Jenkins, you can use Docker images.
Gradle plugin
The Gradle Qodana plugin provides the Gradle interface for running code inspections provided by Qodana. To start, apply the Gradle plugin org.jetbrains.qodana in the Gradle configuration file.
Add the following to the build.gradle configuration file.
Add the following to the build.gradle.kts configuration file:
qodana { } extension configuration
Properties available for configuration in the qodana { } top-level configuration closure:
Name | Description | Type | Default Value |
|---|---|---|---|
| Path to the project folder to analyze. |
|
|
| Path to the directory to store task results. |
|
|
| Path to the directory to store the generated report. |
|
|
Gradle Qodana Tasks
qodanaScan
Start Qodana in the project directory.
The task relies on the qodana { } extension configuration. However, it is also controlled by provided arguments.
Example
Add this to your Gradle configuration file:
Groovy –
build.gradleplugins { // applies Gradle Qodana plugin to use it in project id "org.jetbrains.qodana" version "..." } qodana { // by default result path is $projectPath/build/results resultsPath = "some/output/path" } qodanaScan { arguments = ["--fail-threshold", "0"] }Kotlin –
build.gradle.ktsplugins { // applies Gradle Qodana plugin to use it in a project id("org.jetbrains.qodana") version "..." } qodana { // by default, the result path is $projectPath/build/results resultsPath.set("some/output/path") } qodanaScan { resultsPath.set("some/output/path") arguments.set(listOf("--fail-threshold", "0")) }
Now you can run analyses using the qodanaScan Gradle task:
A complete guide for options and configuration of arguments parameters can be found on Qodana CLI docs page.