Qodana 2023.1 Help

Plugins

You can extend Qodana using either existing plugins from repositories, or by developing your own plugins.

Plugins from repositories

This section explains how to inspect PHP code using the Qodana for PHP linter enhanced with the Php Inspections (EA Extended) plugin. You can repeat these steps for any relevant IDE plugin from JetBrains Marketplace or any custom repository.

Install and configure the plugin

To run the inspections from the plugin, Qodana needs access to these files:

  • The code of the plugin

  • The configuration of the plugin

  • The inspection profile containing the configuration of the plugin inspections

Here is how you can obtain these files:

  • Install the plugin using any of the installation method available. For any installation method chosen, you need to know the path to the plugin file after it has been installed. If you install the plugin using the Settings | Plugins dialog of your IDE, see the Plugins directory section for reference. If you download the PhpInspectionsEA.jar plugin file from JetBrains Marketplace, save it to a directory accessible by Qodana.

  • The ea_extended.xml plugin configuration file is located in the options subdirectory of the IDE config directory. You can save this file to any directory accessible by Qodana.

  • Navigate to the Inspections dialog of your IDE, expand the PHP | Php Inspections (EA Extended) entry, check the inspections you would like to employ, and export the inspection profile in the project root folder under the qodana-inspection-profile.xml filename.

Configure Qodana

In the project root directory, create the qodana.yaml file and specify the path to the profile location in it:

profile: path: ./qodana-inspection-profile.xml

Run Qodana

Use this snippet for running Qodana locally:

docker run --rm \ -p 8080:8080 \ -v <project-directory>:/data/project/ \ -v <report-directory>:/data/results/ \ -v <path-to-plugin-file>/PhpInspectionsEA.jar:/opt/idea/plugins/PhpInspectionsEA.jar \ -v <path-to-plugin-config>/ea_extended.xml:/root/.config/idea/options/ea_extended.xml \ jetbrains/qodana-php --show-report

Custom plugins

To learn how to develop plugins, you can study 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.

Last modified: 31 May 2023