Quick start
The current version of Qodana (2024.3) provides the linters that let you analyze Java, Kotlin, Groovy, PHP, JavaScript, TypeScript, C#, Visual Basic, C, C++, Python, and Golang projects. You can also extend the default linter configuration using various features.
As an example, this section explains how you can quickly start working with Qodana using:
note
You can skip the prerequisites if you would like to run Qodana in JetBrains IDEs.
Depending on your Qodana license, you probably need to obtain a trial license and complete the project setup stage in Qodana Cloud.
To run Qodana in the CLI and GitHub, you will be using a project token available after creating a Qodana Cloud project. To learn more about it, see the Project tokens section.
Starting from version 2023.2, Qodana is available in IntelliJ IDEA and PyCharm (both the Professional and Community editions), PhpStorm, WebStorm, GoLand, and Rider.
tip
You do not need to buy a separate Qodana license to run it in the IDE.
Here is the short video showing how you can run Qodana in your IDE.
Here is the description of all steps shown in this video:
In your IDE, navigate to the Problems tool window.
In the Problems tool window, click the Server-Side Analysis tab.
On the Server-Side Analysis tab, click the Try locally button to start Qodana.
On the Server-Side Analysis tab, you can view inspection results. It also contains two links in the upper part of the tab.
Open Qodana report in browserAdd Qodana to CI/CD pipelineOpen the inspection report in your browser.
Open the configuration wizard to use Qodana in CI/CD pipelines.
To learn more about Qodana and CI/CD pipelines, see the Integration with CI systems section.
Qodana provides two options for local analysis of your code. Qodana CLI is the easiest option to start. Alternatively, you can use the Docker command from the Docker image tab.
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:
macOS and LinuxMicrosoft WindowsInstall with Homebrew (recommended):
$brew install jetbrains/utils/qodana
Alternatively, you can install Qodana CLI using our installer:
$curl -fsSL https://jb.gg/qodana-cli/install | bash
You can install a
nightly
or any other version the following way:$curl -fsSL https://jb.gg/qodana-cli/install | bash -s -- nightly
On Linux, you can also install Qodana using Go:
$go install github.com/JetBrains/qodana-cli@latest
Install with Windows Package Manager (recommended):
winget install -e --id JetBrains.QodanaCLI
Install with Chocolatey:
choco install qodana
Install with Scoop:
scoop bucket add jetbrains https://github.com/JetBrains/scoop-utils scoop install qodana
In the project root directory, declare the
QODANA_TOKEN
variable containing the project token described in the prerequisites:macOS and LinuxMicrosoft Windows$QODANA_TOKEN=<cloud-project-token>
set QODANA_TOKEN=<cloud-project-token>
Run Qodana:
macOS and LinuxMicrosoft Windows$qodana scan
qodana scan
This section assumes that you have the Docker application deployed on your machine.
Pull the image from Docker Hub (only necessary to get the latest version):
$docker pull <image>
Here,
image
denotes the Docker image name of a Qodana linter from this table:Image name
Application
jetbrains/qodana-jvm2024.3
Java and Kotlin for Server Side projects, based on IntelliJ IDEA Ultimate.
jetbrains/qodana-jvm-community2024.3
Java and Kotlin for Server Side projects, based on IntelliJ IDEA Community.
jetbrains/qodana-jvm-android2024.3
Java and Kotlin for Server Side projects, based on IntelliJ IDEA with Android support.
jetbrains/qodana-php2024.3
PHP projects, based on PhpStorm.
jetbrains/qodana-python2024.3
Python projects, based on PyCharm Professional.
jetbrains/qodana-python-community2024.3
Python projects, based on PyCharm Community.
jetbrains/qodana-js2024.3
JavaScript and TypeScript projects, based on WebStorm.
jetbrains/qodana-go2024.3
Golang projects, based on Goland.
jetbrains/qodana-dotnet2024.3
.NET projects, based on Rider.
jetbrains/qodana-cdnet2024.3-eap
.NET projects, based on ReSharper.
jetbrains/qodana-clang2024.3-eap
C and C++ projects containing compilation databases.
Run this command to analyze your codebase:
$docker run \ -v <source-directory>/:/data/project/ \ -e QODANA_TOKEN="<cloud-project-token>" \ jetbrains/qodana-<linter>
Here,
<source-directory>
points to the root of your project, and theQODANA_TOKEN
variable contains the project token described in the prerequisites.Navigate to your Qodana Cloud account to see inspection results.
tip
Depending on your tasks, you can configure Qodana as explained on the Configure Qodana page.
Here is the short video showing how you can configure and run Qodana in GitHub.
Assuming that you already generated a project token as described in the Prerequisites chapter, follow these steps to configure Qodana in GitHub:
On the Settings tab of the GitHub UI, create the
QODANA_TOKEN
encrypted secret and save the project token as its value. If you are using a Qodana Cloud instance other than https://qodana.cloud/, override it by declaring theQODANA_ENDPOINT
environment variable.On the Actions tab of the GitHub UI, set up a new workflow and create the
.github/workflows/code_quality.yml
file.To inspect the
main
andmaster
branches, as well as release branches and the pull requests coming to your repository, save this workflow configuration to the.github/workflows/code_quality.yml
file:name: Qodana on: workflow_dispatch: pull_request: push: branches: # Specify your branches here - main # The 'main' branch - master # The 'master' branch - 'releases/*' # The release branches jobs: qodana: runs-on: ubuntu-latest permissions: contents: write pull-requests: write checks: write steps: - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit fetch-depth: 0 # a full history is required for pull request analysis - name: 'Qodana Scan' uses: JetBrains/qodana-action@v2024.3 env: QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
tip
You can learn more about how to use Qodana in CI/CD pipelines in the Integration with CI systems section.
Thanks for your feedback!