Inspection profiles let you configure the inspections, the scope of files that these inspections analyze, and inspection severity settings. Qodana uses inspection profiles to know how and what to inspect in a codebase.
You can employ profiles either using CLI or configuring the
qodana.yaml file as shown in the Set up a profile section.
Out of the box, Qodana provides several predefined profiles hosted on GitHub:
qodana.starteris the default profile and a subset of
qodana.recommendedtriggering the 3-phase analysis
qodana.recommendedis suitable for CI/CD pipelines and mostly implements the default IDE profiles, see the IntelliJ IDEA documentation for details
How to choose a proper profile
If you want a fresh start, you have two options:
Use Qodana in the default mode to execute the three-phase analysis. You do not need to create the
qodana.yamlfile in this case, but you can add it later to amend the set of inspections.
Run Qodana using the
qodana.recommendedprofile. In this case, you need to create the
qodana.yamlfile with a reference to the
qodana.recommendedprofile. This profile contains the inspections for critical or severe issues in the codebase. This profile does not contain any style checks, and non-critical folders, such as
tests, are ignored.
Sometimes it may be challenging to set up analysis for a big project even with the
qodana.recommended profile due to large number of errors reported. To solve this, Qodana offers a 3-phase analysis, where each phase is focused on a certain type of results.
The first phase is based on the
qodana.starterprofile that contains vital checks only. Non-critical folders, such as
tests, are ignored.
The second phase reports the conditions that could affect truthfulness or completeness of the results. For example, if your project relies on external resources or generated code, and they are not available during the analysis, the final results could be compromised. Qodana notifies you about such suspicious results.
The last phase suggests additional checks that are not so vital for the project but still beneficial. To avoid overwhelming, Qodana analyzes only a fraction of the code, just enough to show you the possible outcome.
Set up a profile
You can set up a profile using either the
qodana.yaml file or the Shell commands.
This is how you can configure the profile name using
--profile-name CLI option lets you run Qodana using either the default profiles or the profile name from the custom profile.
This command lets you override the default profile und run Qodana using the
If you need to run Qodana with a custom profile, you can use its actual profile name. This command lets you bind a custom profile:
This is how you can configure the profile path using
You can use this with custom profiles.
--profile-path CLI option lets you override the path to the file containing the profile.
This command lets you bind the file to the profile directory, and the
--profile-path option tells Qodana which profile file to read:
You can configure inspection profiles using two formats:
YAML format is available starting from version 2023.1 of Qodana
XML format can be used as an alternative to YAML