Install Free
IntelliJ | Getting started | Running an analysis

Running an analysis

On this page

Now that you've installed SonarLint 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 SonarLint 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 >  SonarLint; in the Settings tab, deselect Automatically trigger analysis

There are additional ways to trigger a SonarLint analysis in IntelliJ:

  • On the Fly (default): When the file is autosaved or manually saved. Issues found during the analysis are highlighted in the SonarLint 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 SonarLint > Analyze with SonarLint. You can also click the green arrow in the sidebar of the SonarLInt View window or, analyze all project files by right-clicking in the explorer window and selecting Analyze with SonarLint. 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 > SonarLint > Analyze with SonarLint. The Report tab will open automatically in the SonarLint 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 > SonarLint > 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 SonarLint view window; conversely, there is a Cancel SonarLint Analysis button shown in red. Also, the Current file tab offers a shortcut to the Project Settings and a Clear SonarLint Issues button to help manage the report of issues.

Triggering an analysis from the Report tab

SonarLint 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 SonarLint 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 SonarLint > Analyze with SonarLint, you can click on the folder icon in the left toolbar of the SonarLint 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 > SonarLint > 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