Qodana 2024.2 Help

Plugins

You can extend Qodana using either existing plugins from repositories like JetBrains Marketplace, or using custom plugins.

Plugins from JetBrains Marketplace

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.

Custom plugins

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:

  1. In your project root directory, create the .qodana directory.

  2. 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.

  3. In the qodana.yaml file, enable the inspection as described in the YAML file section.

  4. Run Qodana using examples below:

    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.2 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, and QODANA_TOKEN refers to a project token.

Last modified: 23 October 2024