CircleCI
Edit pageLast modified: 12 March 2025CircleCI is a cloud-based CI/CD system. You can build Qodana into your CircleCI pipelines using the CircleCI Qodana orb as described in this section.
tip
To learn more about the CircleCI Qodana orb, visit the CircleCI Qodana orb page on the CircleCI developer portal.
Before you start
Qodana Cloud
All configuration examples in this section use a project token generated by Qodana Cloud. This token is required for the paid Qodana linters and optional for use with the Community linters. You can see these sections to learn how to generate the project token in the Qodana Cloud UI:
The project setup section explains how to generate a project token when first working with Qodana Cloud.
The Manage a project section explains how to create a project token within an existing Qodana Cloud organization.
Once you obtain the project token, you can use the QODANA_TOKEN
variable for identifying in a pipeline or workflow.
If you are using a Qodana Cloud instance other than https://qodana.cloud/
, override it by setting the QODANA_ENDPOINT
environment variable.
Prepare your project
In your CircleCI organization settings, navigate to the Contexts section and define the
qodana
context.In the Contexts section, click the
qodana
context. In this context, define theQODANA_TOKEN
environment variable and save the project token as its value.In your CircleCI organization settings, navigate to the Security section. In this section, opt in to allow using uncertified public orbs.
If necessary, in your repository create the
.circleci/config.yml
file that will contain a CircleCI configuration.
Basic configuration
In the .circleci/config.yml
file, save the following configuration:
version: 2.1
orbs:
qodana: jetbrains/qodana@2024.3
jobs:
code-quality:
machine:
image: 'ubuntu-2004:current'
environment: $QODANA_TOKEN
steps:
- checkout
- qodana/scan
workflows:
main:
jobs:
- code-quality:
context: qodana
This table describes configuration elements:
Configuration block | Description |
---|---|
| Invokes the CircleCI Qodana orb and configures its version |
| Refers to the |
| Invokes the |
This configuration will be extended in the sections below.
Baseline and quality gate
This configuration uses the args
parameter to invoke the baseline and quality gate features:
version: 2.1
orbs:
qodana: jetbrains/qodana@2024.3
jobs:
code-quality:
machine:
image: 'ubuntu-2004:current'
environment: $QODANA_TOKEN
steps:
- checkout
- qodana/scan:
args: > # Use space to separate arguments
--baseline <path-relative-to-project-dir>
--fail-threshold <number-of-problems>
workflows:
main:
jobs:
- code-quality:
context: qodana
Specific linter
This configuration sample uses the args
parameter to run the specific linter like jetbrains/qodana-jvm
:
version: 2.1
orbs:
qodana: jetbrains/qodana@2024.3
jobs:
code-quality:
machine:
image: 'ubuntu-2004:current'
environment: $QODANA_TOKEN
steps:
- checkout
- qodana/scan:
args: -l jetbrains/qodana-jvm # Use space to separate arguments
workflows:
main:
jobs:
- code-quality:
context: qodana
Specific branch
This configuration instructs Qodana to analyze changes only on the main
branch:
version: 2.1
orbs:
qodana: jetbrains/qodana@2024.3
jobs:
code-quality:
machine:
image: 'ubuntu-2004:current'
environment: $QODANA_TOKEN
steps:
- checkout
- qodana/scan
workflows:
main:
jobs:
- code-quality:
context: qodana
filters:
branches:
only:
- main # Specify your branch here
Commands and parameters
The CircleCI Qodana orb provides the scan
command to let you inspect your project and report the results.
This table contains the list of optional string parameters that can be additionally used with the scan
command.
Parameter | Description | Default value |
---|---|---|
| Customize the generated cache hash |
|
| Customize the generated cache hash |
|
| Additional arguments of the Qodana CLI | No default value |
| Name of the analysis artifact, used for uploading analysis results |
|
| Directory for Qodana caches |
|
| Directory for storing the results of scanning |
|
Thanks for your feedback!