Install Free
IntelliJ | Getting started | Running an analysis

Running an analysis

On this page

Now that you've installed the SonarQube for IDE extension in your IDE, running an analysis is straight-forward. For the most part, new analyses are automatically triggered when you open a file, as you type, or with each file save following a change in the code. Below we've outlined other ways to trigger a SonarQube for IDE analysis.

Triggering an analysis

By default, new analyses are automatically triggered as you type, following a change in the code. You can disengage automatic analysis by going to IntelliJ Settings > Tools >  SonarQube for IDE; in the Settings tab, deselect Automatically trigger analysis

There are additional ways to trigger a SonarQube for IDE analysis in IntelliJ:

  • On the Fly (default): When the file is autosaved or manually saved. Issues found during the analysis are highlighted in the SonarQube for IDE view window under the Current file tab.
  • On-Demand: Single files can be analyzed by right-clicking over a file in the project tree, then selecting SonarQube for IDE > Analyze with SonarQube for IDE. You can also click the green arrow in the sidebar of the SonarQube for IDE View window or, analyze all project files by right-clicking in the explorer window and selecting Analyze with SonarQube for IDE. At any time you can use the keyboard shortcut Cmd+Shift+S/Ctrl+Shift+S on your Mac/Windows machine to analyze all project files.
  • By selection: Use this method to get feedback on issues found in a set of files. Select one or more files in the Project Tree, then right-click > SonarQube for IDE > Analyze with SonarQube for IDE. The Report tab will open automatically in the SonarQube for IDE view window where you can view issues found in multiple files. Note that you can also click the Analyze All Project Files button from the Report tab, without having to select them from the Project Tree.

To perform JavaScript or TypeScript analysis, you must set the file path to your Node.js. Go to IntelliJ Settings > Tools > SonarQube for IDE > Settings tab, and click the three dots to bring up a navigation window.

Triggering an analysis from Current File tab

It is possible to trigger an analysis on demand by clicking the green arrow in the sidebar of the SonarQube for IDE view window; conversely, there is a Cancel SonarQube for IDE Analysis button shown in red. Also, the Current file tab offers a shortcut to the Project Settings and a Clear SonarQube for IDE Issues button to help manage the report of issues.

Triggering an analysis from the Report tab

SonarQube for IntelliJ allows you to complete an analysis of all project files and an option to review issues found in other files without having to open them.

From the Report tab of the SonarQube for IDE view window, click on the Analyze VCS Changed Files button to analyze files that are not yet committed but have changed since the last commit.

In addition to right-clicking on the project folder to select SonarQube for IDE > Analyze with SonarQube for IDE, you can click on the folder icon in the left toolbar of the SonarQube for IDE view window to Analyze All Project Files. Likewise from the explorer window, entering the keyboard shortcut Cmd+Shift+S/Ctrl+Shift+S on your Mac/Windows machine will trigger an analysis on all project files and automatically open the Reports tab to view the report.

File exclusions

In addition, it’s possible to limit the analysis by excluding files.  Go to IntelliJ Settings > Tools > SonarQube for IDE > File Exclusions to define an exclusion pattern. More details about File exclusions can be found here


Was this page helpful?

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARQUBE, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License