Plugins
You can extend Qodana using either existing plugins from repositories like JetBrains Marketplace, or using custom plugins.
To have a plugin installed from JetBrains Marketplace and running, in the qodana.yaml
file specify the plugin
option:
plugins:
- id: <plugin.id>
Here, <plugin-id>
denotes the Plugin ID from JetBrains Marketplace. For example, for the Grazie Professional Plugin ID will be com.intellij.grazie.pro
. To find the ID of a specific plugin, on the plugin page of JetBrains Marketplace, click the Overview tab, and then navigate to the Additional Information section.
note
Several plugins may have dependencies that are not present in Qodana images. You can check the list of dependencies included in each Qodana linter using our GitHub repository. You can navigate to the Versions tab and then click the latest version.
tip
To learn how to develop plugins, you can review the Creating Your First Plugin page of the IntelliJ Platform Plugin SDK documentation portal. Besides that, each plugin should perform inspections and produce inspection results as described in the Inspections section of the documentation portal.
Before running a custom plugin using Qodana, prepare the following components:
Files containing the plugin code, for example
.jar
files,Plugin configuration contained in a file,
The inspection name that enables the plugin.
Follow this procedure to set up a plugin:
In your project root directory, create the
.qodana
directory.In the
.qodana
directory, save all files related to a plugin. In case the plugin consists of several.jar
files, you can create a directory inside.qodana
and save them there. You can also download and run plugins from JetBrains Marketplace.In the
qodana.yaml
file, enable the inspection as described in the YAML file section.Run Qodana using examples below:
Qodana CLIDocker imageGitHub Actions$qodana scan \ -l <linter> -e QODANA_TOKEN="<cloud-project-token>" \ -v <plugin-directory>/<plugin-name>.jar:/opt/idea/custom-plugins/<plugin-name>.jar \ -v <path-to-plugin-config>/<config-file>:/opt/idea/custom-plugins/<config-file>
$docker run \ -v <project-directory>:/data/project/ \ -e QODANA_TOKEN="<cloud-project-token>" \ -v <plugin-directory>/<plugin-name>.jar:/opt/idea/custom-plugins/<plugin-name>.jar \ -v <path-to-plugin-config>/<config-file>:/opt/idea/custom-plugins/<config-file> <linter>
name: Qodana on: workflow_dispatch: pull_request: push: branches: # Specify your branches here - main # The 'main' 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 with: args: > --linter,<linter>, -v,<plugin-directory>/<plugin-name>.jar:/opt/idea/custom-plugins/<plugin-name>.jar, -v,<path-to-plugin-config>/<config-file>:/opt/idea/custom-plugins/<config-file> env: QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
Here,
<linter>
denotes the linter name, andQODANA_TOKEN
refers to a project token.
Thanks for your feedback!