Qodana 2023.1 Help

Prepare your project

When Qodana runs on your project, it tries to figure out the build system and project structure by itself. If Qodana cannot figure out the project structure, it will run the inspections nevertheless, but some inspections may report that they cannot find classes, packages, files or cannot resolve references. In these cases, Qodana needs a bit of help. Typical actions to prepare the project for Qodana are:

  • Install third-party packages or libraries

  • Run a program that sets up the build environment

These actions are carried out using the bootstrap option of the qodana.yaml file:

bootstrap: |+ set -eu # For PHP projects that use Laravel: #composer require --dev barryvdh/laravel-ide-helper # For JavaScript projects that use Node.js: #npm install

To be able to use syntax highlighting and validation in your IDE, you can create the prepare-qodana.sh shell script and save it to the root directory of your project:

#! /bin/sh # Example bootstrap steps, see https://jetbrains.com/help/qodana/before-running-qodana.html set -eu # For PHP projects that use Laravel: #composer require --dev barryvdh/laravel-ide-helper # For JavaScript projects that use Node.js: #npm install

Run the script within a Qodana Docker container using the bootstrap option:

bootstrap: sh ./prepare-qodana.sh

Examples

This configuration tells Qodana to install a specific version of Node.JS and project dependencies:

bootstrap: |+ set -eu # Sets the node version to be used nodenv install 18.14.2 nodenv global 18.14.2 npm install -g yarn # Install project dependencies yarn install --frozen-lockfile

Here, the Node.JS version can be retrieved from either an environment variable or package.json.

Last modified: 08 March 2023