MCPcopy Index your code
hub / github.com/JetBrains/qodana-cli

github.com/JetBrains/qodana-cli @v2026.2-nightly

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2026.2-nightly ↗ · + Follow
1,696 symbols 7,543 edges 234 files 525 documented · 31%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Qodana CLI

JetBrains project Qodana [GoReport][gh:goreport] [GitHub Discussions][jb:discussions] [Twitter Follow][jb:twitter]

qodana is a simple cross-platform command-line tool to run Qodana linters anywhere with minimum effort required.

tl;dr

Install and run:

qodana scan --show-report

You can also add the linter by its name with the --linter option (e.g. --linter jetbrains/qodana-js).

qodana

Installation

💡 The Qodana CLI is distributed and run as a binary. The Qodana linters with inspections are Docker Images or, starting from version 2023.2, your local/downloaded by CLI IDE installations (experimental support). - To run Qodana with a container (the default mode in CLI), you must have Docker or Podman installed and running locally to support this: https://www.docker.com/get-started, and, if you are using Linux, you should be able to run Docker from the current (non-root) user (https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) - To run Qodana without a container, you must have the IDE installed locally to provide the IDE installation path to the CLI or specify the product code, and CLI will try to download the IDE automatically (experimental support).

macOS and Linux

Install with Homebrew (recommended)
brew install jetbrains/utils/qodana
Install with our installer
curl -fsSL https://jb.gg/qodana-cli/install | bash

Also, you can install nightly or any other version the following way:

curl -fsSL https://jb.gg/qodana-cli/install | bash -s -- nightly

Windows

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

Anywhere else

Alternatively, you can install the latest binary (or the apt/rpm/deb package) from this page.

Usage

https://user-images.githubusercontent.com/13538286/233484685-b9225168-8379-41bf-b8c8-6149a324cea8.mp4

🎥 The "Get Started with Qodana CLI" video is also available on YouTube.

Prepare your project

Before you start using Qodana, you need to configure your project – choose a linter to use. If you know what linter you want to use, you can skip this step.

Also, Qodana CLI can choose a linter for you. Just run the following command in your project root:

qodana init

Analyze your project

Right after you configured your project (or remember linter's name you want to run), you can run Qodana inspections simply by invoking the following command in your project root:

qodana scan
  • After the first Qodana run, the following runs will be faster because of the saved Qodana cache in your project (defaults to ./<userCacheDir>/JetBrains/<linter>/cache)
  • The latest Qodana report will be saved to ./<userCacheDir>/JetBrains/<linter>/results – you can find qodana.sarif.json and other Qodana artifacts (like logs) in this directory.

View the report

After the analysis, the results are saved to ./<userCacheDir>/JetBrains/<linter>/results by default. Inside the directory ./<userCacheDir>/JetBrains/<linter>/results/report, you can find a Qodana HTML report. To view it in the browser, run the following command from your project root:

qodana show

You can serve any Qodana HTML report regardless of the project if you provide the correct report path.

Configuration

To find more CLI options run qodana ... commands with the --help flag. If you want to configure Qodana or a check inside Qodana, consider using qodana.yaml to have the same configuration on any CI you use and your machine.

In some flags help texts you can notice that the default path contains <userCacheDir>/JetBrains. The <userCacheDir> differs from the OS you are running Qodana with. - macOS: ~/Library/Caches/ - Linux: ~/.cache/ - Windows: %LOCALAPPDATA%\ Also, you can just run qodana show -d to open the directory with the latest Qodana report.

init

Configure a project for Qodana

Synopsis

Configure a project for Qodana: prepare Qodana configuration file by analyzing the project structure and generating a default configuration qodana.yaml file.

qodana init [flags]

Options

      --config string        Set a custom configuration file instead of 'qodana.yaml'. Relative paths in the configuration will be based on the project directory.
  -f, --force                Force initialization (overwrite existing valid qodana.yaml)
  -h, --help                 help for init
  -i, --project-dir string   Root directory of the project to configure (default ".")

Options inherited from parent commands

      --disable-update-checks   Disable check for updates
      --log-level string        Set log-level for output (default "error")

scan

Scan project with Qodana

Synopsis

Scan a project with Qodana. It runs one of Qodana's Docker images (https://www.jetbrains.com/help/qodana/docker-images.html) and reports the results.

Note that most options can be configured via qodana.yaml (https://www.jetbrains.com/help/qodana/qodana-yaml.html) file. But you can always override qodana.yaml options with the following command-line options.

qodana scan [flags]

Options

``` -l, --linter string Defines the linter to be used for analysis. Default value is determined based on project files. Available values: qodana-jvm-community, qodana-jvm, qodana-jvm-android, qodana-android, qodana-php, qodana-python-community, qodana-python, qodana-js, qodana-cdnet, qodana-dotnet, qodana-ruby, qodana-cpp, qodana-go, qodana-rust, qodana-clang, qodana-poly. !Legacy note!: Until version 2025.2 this parameter was used to define a docker image. This behavior is deprecated but supported for backward compatibility. Please use parameters --linter and --within-docker=true or --image instead. --within-docker string Defines if analysis is performed within a docker container or not. Set to 'false' for performing analysis in native mode. Set to 'true' for performing analysis within a docker container. The image for container creation will be chosen automatically based on the value of the --linter param (e.g. jetbrains/qodana-jvm for --linter=qodana-jvm). Default value is defined dynamically depending on the current environment and project. --image string Defines an image to be used for analysis execution. Sets --within-docker=true. Sets --linter to the one preinstalled within the image. Available images are: jetbrains/qodana-jvm:2025.3-eap, jetbrains/qodana-dotnet:2025.3-eap, etc. Full list of images is available at https://hub.docker.com/u/jetbrains?search=qodana . -i, --project-dir string Root directory of the inspected project (default ".") --repository-root string Path to the root of the Git repository. This directory must be the same as --project-dir or contain the project directory inside it. -o, --results-dir string Override directory to save Qodana inspection results to (default /JetBrains//results) --cache-dir string Override cache directory (default /JetBrains//cache) -r, --report-dir string Override directory to save Qodana HTML report to (default /JetBrains//results/report) --print-problems Print all found problems by Qodana in the CLI output --code-climate Generate a Code Climate report in SARIF format (compatible with GitLab code Quality), will be saved to the results directory (default true if Qodana is executed on GitLab CI) --bitbucket-insights Send the results BitBucket Code Insights, no additional configuration required if ran in BitBucket Pipelines (default true if Qodana is executed on BitBucket Pipelines) --clear-cache Clear the local Qodana cache before running the analysis -w, --show-report Serve HTML report on port --port int Port to serve the report on (default 8080) --config string Set a custom configuration file instead of 'qodana.yaml'. Relative paths in the configuration will be based on the project directory. -a, --analysis-id string Unique report identifier (GUID) to be used by Qodana Cloud -b, --baseline string Provide the path to an existing SARIF report to be used in the baseline state calculation --baseline-include-absent Include in the output report the results from the baseline run that are absent in the current run --full-history --commit Go through the full commit history and run the analysis on each commit. If combined with --commit, analysis will be started from the given commit. Could take a long time. --commit --full-history Base changes commit to reset to, resets git and starts a diff run: analysis will be run only on changed files since the given commit. If combined with --full-history, full history analysis will be started from the given commit. --fail-threshold string Set the number of problems that will serve as a quality gate. If this number is reached, the inspection run is terminated with a non-zero exit code --disable-sanity Skip running the inspections configured by the sanity profile -d, --only-directory string Directory inside the project-dir directory must be inspected. If not specified, the whole project is inspected -n, --profile-name string Profile name defined in the project -p, --profile-path string Path to the profile file --run-promo string Set to 'true' to have the application run the inspections configured by the promo profile; set to 'false' otherwise (default: 'true' only if Qodana is executed with the default profile) --script string Override the run scenario (default "default") --coverage-dir string Directory with coverage data to process --apply-fixes Apply all available quick-fixes, including cleanup --cleanup Run project cleanup --property stringArray Set a JVM property to be used while running Qodana using the --property property.name=value1,value2,...,valueN notation -s, --save-report Generate HTML report (default true) --timeout int Qodana analysis time limit in milliseconds. If reached, the analysis is terminated, process exits with code timeout-exit-code. Negative – no timeout (default -1) --timeout-exit-code int See timeout option (default 1) --diff-start string Commit to start a diff run from. Only files changed between --diff-start and --diff-end will be analysed. --diff-end string Commit to end a diff run on. Only files changed between --diff-start and --diff-end will be analysed. --reverse Override the default run-scenario for diff runs to always use the reverse-scoped script --no-statistics [qodana-clang/qodana-dotnet] Disable sending anonymous statistics --compile-commands string [qodana-clang specific] Path to compile_commands.json. Should be relative to the project directory. (default "./build/compile_commands.json") --clang-args string [qodana-clang specific] Additional arguments for clang --solution string [qodana-cdnet specific] Relative path to solution file --project string [qodana-cdnet specific] Relative path to project file --configuration string [qodana-cdnet specific] Build configuration --platform string [qodana-cdnet specific] Build platform --no-build [qodana-cdnet specific] Do not build the project before analysis -e, --env stringArray Only for

Extension points exported contracts — how you extend this code

AnalysisRunner (Interface)
AnalysisRunner defines the interface for logic on running analysis on commits [2 implementers]
internal/core/incremental_analysis.go
ThirdPartyLinter (Interface)
(no doc) [4 implementers]
internal/platform/third_party_linter.go
SequenceRunner (Interface)
SequenceRunner defines the interface for different sequence analysis strategies
internal/core/incremental_analysis.go
EnvProvider (Interface)
(no doc) [4 implementers]
internal/platform/qdenv/qdenv.go
Analyzer (Interface)
(no doc) [3 implementers]
internal/platform/product/analyzers.go
CloudTokenLoader (Interface)
(no doc) [2 implementers]
internal/platform/tokenloader/token_loader.go

Core symbols most depended-on inside this repo

Run
called by 360
internal/platform/git/testutil.go
Fatal
called by 322
internal/testutil/mockexe/testing.go
Fatalf
called by 257
internal/testutil/mockexe/testing.go
WriteFile
called by 111
internal/platform/git/testutil.go
Close
called by 108
internal/foundation/fs/atomic.go
Dir
called by 87
internal/platform/git/testutil.go
Error
called by 60
internal/platform/git/git.go
Canonical
called by 60
internal/foundation/fs/canonical_unix.go

Shape

Function 1,234
Method 269
Struct 170
Route 13
Interface 6
Class 2
TypeAlias 2

Languages

Go94%
Python6%
C++1%
C#1%

Modules by API surface

internal/core/corescan/context.go77 symbols
internal/foundation/fs/canonical_test.go65 symbols
internal/sarif/schema.go55 symbols
internal/platform/thirdpartyscan/context.go38 symbols
test_linter/testdata/mock_server.py34 symbols
clang/config_test.go34 symbols
internal/platform/product/analyzers.go29 symbols
internal/platform/qdenv/qdenv.go28 symbols
internal/platform/product/product_test.go28 symbols
internal/platform/qdyaml/yaml.go26 symbols
internal/platform/product/product_info.go26 symbols
internal/platform/git/testutil.go26 symbols

For agents

$ claude mcp add qodana-cli \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact