Install Free
Eclipse | Getting started | Running an analysis

Was this page helpful?

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 

Automatic analysis can be controlled on a per-project basis: Right-click on a project in the Project or Package Explorer, open Properties > SonarLint to select/deselect Run SonarLint automatically.

Here are all the ways to trigger a SonarLint analysis in Eclipse:

  • Detect issues on file open and save (default): When the file is opened, autosaved, or manually saved.
  • On-demand: Selections of one or more files can be analyzed together by right-clicking over a file selection in the Eclipse Project Explorer, then select SonarLint > Analyze.
  • Analyze changed files: Right-click over a Project folder in the Project/Package Explorer and select SonarLint > Analyze changed files to run an analysis on all uncommitted files. Your project must be under Git source control and you must have Egit installed. 
  • By selection: Use this method to get feedback on issues found in a set of files or set of projects. Select one or more files/projects in the Project Explorer, then right-click and select SonarLint > Analyze. The SonarLint Report view will open automatically and present issues found in your selection.

There’s a status bar in the lower right corner to report the state of analysis. Issues found after an analysis of the active file are displayed in the SonarLint view window in the SonarLint On-The-Fly tab; note that you can also select multiple files in the Eclipse Project/Package Explorer and see them in the SonarLint On-The-Fly tab. Issues found after the analysis of multiple files are displayed in the SonarLint Report tab. See the documentation about Investigating issues for more details.

JavaScript and TypeScript analysis

To perform CSS, JavaScript, or TypeScript analysis, SonarLint must find the file path to your Node.js. If you have troubles, go to Eclipse > Settings to open the Preferences menu, then find SonarLint and set your Node.js executable path.

File exclusions

It’s possible to limit the analysis using this same navigation path (as above). In Windows, go to Project > Properties > SonarLint and select File Exclusions (in Mac: Eclipse > Settings > SonarLint > File Exclusions). There you can specify files to exclude. More details about File Exclusions can be found here

It is also possible to exclude a file or files from the Eclipse Explorer window. Select one or more files in the Explorer, then right-click and select SonarLint > Exclude.

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

Creative Commons License