Gradle plugin
The Gradle Qodana plugin provides the Gradle interface to run code inspections from Intellij IDEA. To get started, 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
To configure the plugin, use the following options in the top level qodana { }
configuration node.
Name | Description | Type | Default Value |
---|---|---|---|
| Automatically pull the latest Qodana Docker image before running the inspection. |
|
|
| Path to the cache directory. |
|
|
| Name of the Qodana Docker container. |
|
|
| Name of the Qodana Docker image. |
|
|
| Docker executable name. |
|
|
| Path to the project folder to inspect. |
|
|
| Path to directory to store the execution results. |
|
|
| Generate HTML report. |
|
|
| Serve an HTML report on |
|
|
| Default port used to serve the HTML report. |
|
|
Gradle Qodana tasks
After the Gradle Qodana plugin is applied and configured, you can run the provided tasks:
runInspections
Starts Qodana code analysis in a Docker container. The task runs according to the qodana { }
extension configuration but also provides additional properties and helper methods to configure the Docker image.
Properties
Name | Description | Type | Default Value |
---|---|---|---|
| Path to the profile file to be mounted as |
|
|
| Path to the list of plugins to be disabled in the Qodana IDE instance to be mounted as |
|
|
| Inspect uncommitted changes and report new problems. |
|
|
| JVM parameters to start the IntelliJ IDEA JVM with. |
|
|
Helper methods
Name | Description |
---|---|
| Adds a new port binding. |
| Mounts a local directory to the given Docker path. |
| Adds an environment variable. |
| Adds a Docker argument to the executed command. |
| Adds a Docker image argument to the executed command. |
updateInspections
Pulls the latest Qodana Inspections Docker container. The task automatically runs before runInspections
if the qodana.autoUpdate
property is set to true
.
stopInspections
Stops the Qodana Inspections Docker container.
cleanInspections
Cleans up the Qodana Inspections output directory.
Example
Add the following to the build.gradle
configuration file:
Add the following to the build.gradle.kts
configuration file:
To run the inspections, start the runInspections
Gradle task: