SonarLint offers a fully-integrated user experience in Eclipse-based IDEs. After installing the plugin issues will be reported as Eclipse markers.

SonarLint is free, open source, and available in the Eclipse Marketplace. Note that it requires Java 8 to run. The connected mode is compatible with SonarQube 5.6+.

SonarLint in Eclipse

Connected Mode

You can bind Eclipse projects to a SonarQube project (supporting SonarQube servers 5.6+). This operation will make SonarLint use the analyzers, quality profiles and settings defined on your SonarQube server. This is a convenient way of customizing the rules used by SonarLint.

First step is to configure connection with the SonarQube server:

  • In SonarQube server view, right click and choose "New -> Server connection", or directly do "File -> New -> Other... -> SonarLint -> New Server".
  • Choose target server: SonarCloud or a SonarQube server
  • Follow the wizard steps to provide credentials and other connection details
  • Click "Finish" to close the wizard. A background process will start updating configuration from the server (may take a while)

You can manage your SonarQube server connections in the "SonarQube Servers" view. Note: To manually trigger an update of local configuration (if remote SonarQube configuration has changed): right click on a server and use the "Update all project bindings" action.

Now you can bind one or more Eclipse project(s) to their remote SonarQube pair. Right click on Eclipse project -> "SonarLint -> Bind with remote SonarQube server..."

You can now use the wizard to find the matching SonarQube project. Give a try to the "auto-bind" feature that will find best match based on Eclipse project name. If auto-bind fail you can manually search for a project.

Click on "Finish" to persist the binding. You should now see the SonarQube overlay on your bound Eclipse project icon.

That's it, you can now code and see SonarLint reporting issues based on remote SonarQube configuration.

News

  • June 27, 2017 - We released version 3.2.0, with "Analyze all files" feature, a reworked server connection wizard, and many optimizations and bug fixes. Analyzers were updated to their latest version (SonarJava 4.10.0.10260, SonarPython 1.8.0.1496, SonarJS 3.1.0.5111).
  • May 5, 2017 - We released version 3.1.0, that allow to connect to an organization when using sonarqube.com. This version also collect anonymous usage statistics to help us focus our efforts. SonarJS was also updated to the latest version (SonarJS 3.0.0.4962).
  • April 11, 2017 - We released version 3.0.0, that is a big technical refactoring to help integration with other Eclipse based IDEs like IBM IDz. Analyzers were also updated (SonarJava 4.8.0.9441, SonarJS 2.21.1.4786, SonarPHP 2.10.0.2087) and many small bug were fixed.
    Possible update issue: we used to have multiple features in the update site. Starting from 3.0 there is only one. This may cause some difficulties to update. The workaround is to manually uninstall old "Optionnal Configurators" features (for JDT/CDT).
  • February 20, 2017 - We released version 2.6.0, with a new view to see additional issue locations (flows, secondary locations). Also updated embedded analyzers (SonarJava 4.5.0.8398, SonarJS 2.20.0.4207, SonarPython 1.7.1195) and support PL/I in connected mode.
  • January 10, 2017 - Bug fix version 2.5.1 was released, fixing a problem that was preventing the analysis of C/C++ projects in Eclipse CDT to work out of the box.
  • December 14, 2016 - We released version 2.5.0 of SonarLint for Eclipse with the two main improvements: ability to run an analysis on all changed files (based on the SCM) and official support of C/C++ projects when using Eclipse CDT. There are also several bug fixes and small improvements. The analyzer SonarJava was updated to version 4.3.
  • December 5, 2016 - We released version 2.4.0 of SonarLint for Eclipse with the main improvement of showing a notification when an update is detected for the current bindings (new version of an analyzer installed on the SonarQube server for example). There are also several bug fixes and performance improvements.
  • November 21, 2016 - Version 2.3.1 is out. It fixes hiding resolved issues on Windows, and other minor bugs.
  • November 15, 2016 - We released version 2.3.0 of SonarLint for Eclipse with the main improvement of hiding resolved issues in connected mode. Changing/updating bindings will trigger analysis of open files. The current file will be analyzed after starting Eclipse. Files in aggregator Maven projects will be no longer analyzed twice. We have also updated some analyzers to their latest version (Java 4.2.1, JavaScript 2.18, PHP 2.9). Starting from this version, SonarLint is only compatible with SonarQube 5.6+ (current LTS).
  • August 26, 2016 - We released version 2.2.1 of SonarLint for Eclipse with one important performance improvement when analyzing Java source files. Java and JavaScript analyzers were also updated to their latest version. Compatibility with IBM JVM in connected mode was restored.
  • July 29, 2016 - We released version 2.2.0 of SonarLint for Eclipse with many improvements: Support of Python and updated Java and JavaScript analyzers. File/issue exclusions configured on SonarQube server are now taken into account (in connected mode). Support of custom rules (but plugins have to be updated). Starting from this version, Java 8 is required to run SonarLint and Juno is no more supported.
  • June 3, 2016 - We released version 2.1.0 of SonarLint for Eclipse with extended support of SonarQube 4.5.4+ in connected mode. Some SonarSource commercial plugins are also supported. We have also updated Java and JavaScript analyzers to their latest version (Java 3.14 and JavaScript 2.12).
  • April 4, 2016 - We released version 2.0.0 of SonarLint for Eclipse with ability to connect to a SonarQube server. We have also updated Java and JavaScript analyzers to their latest version (Java 3.12 and JavaScript 2.11).
  • March 2, 2016 - We released bugfix version 1.3.1 of SonarLint for Eclipse.
  • February 17, 2016 - We released version 1.3 of SonarLint for Eclipse. The plugin is now fully standalone: there is no more dependency on http://update.sonarlint.org. We removed the quick fix // NOSONAR that was too controversial. Java analyzer is updated to its latest version (3.10). Some rules were added on pom.xml files.
  • January 15, 2016 - We have updated Java and JavaScript analyzers to their latest version (Java 3.9 and JavaScript 2.10). Use Help -> Update SonarLint analyzers menu to get them.
  • December 16, 2015 - We released version 1.2 of SonarLint for Eclipse. It is possible to see recently introduced issues by displaying the "Date" column in SonarLint issues view. Also there is a quick fix for SonarLint issues to mute them by adding a // NOSONAR comment.
  • December 7, 2015 - We released version 1.1 of SonarLint for Eclipse. Updated versions of Java, JavaScript and PHP analyzers: some issues start to be more precisely located on code. Few more rules and many improvements to existing ones. Use Help -> Update SonarLint menu to get new analyzers.
  • October 15, 2015 - Today we released version 1.0 of SonarLint for Eclipse. Java, JavaScript and PHP are supported.

Frequently Asked Questions

  • Which languages are supported?

    Out of the box: Java, JavaScript, PHP and Python

    With the Connected Mode, it adds: C/C++, ABAP, COBOL, PL/SQL, PL/I, Swift and RPG

  • How to trigger SonarLint analysis?

    SonarLint analysis is automatically triggered by a resource change listener (in short: when a file is modified) and also when you open a file.

    If you want to disable the automatic analysis: go to project properties (right click on the project -> Properties), select SonarLint entry and uncheck "Enable SonarLint on-the-fly"

    You can also manually run SonarLint analysis using the context menu on project or individual source files:

  • How can I connect SonarLint to SonarCloud or to my SonarQube server? - Please use connected mode to connect with SonarCloud or a SonarQube server.
  • In Connected Mode will all plugins installed on SonarQube be executed in SonarLint?

    SonarLint supports only the SonarSource Analyzers (SonarJava, SonarJS, ...) and also custom rules extending these SonarSource analyzers.

    We don't plan to support plugins running third-party analyzers (like PMD, Android Lint, JSLint...). Most of the time those analyzers already have dedicated IDE integration.

  • How to see rule description?

    Full rule description is available in a dedicated view. You can open it using the context menu in the issues view, or using the quick fix action on a marker:

  • How to exclude files from the analysis?

    By default we are excluding derived files. Apart from that all files recognized as a supported language are analyzed. In connected mode you can configure some exlusions on server side.

  • How to open the SonarLint console?

    The SonarLint console allow to see logs of the analysis. This can be useful to understand some technical issues. You can open it from standard Eclipse Console views:

  • How to enable verbose logs?

    By default the SonarLint console will not display debug logs. You can enable debug logs from the SonarLint console:

Contribute

SonarLint for Eclipse is open source under the LGPL v3 license. You can fork us on GitHub, and submit Pull Requests. Feel free to fix bugs or to implement new features.

Feedback

The preferred way to discuss about SonarLint is by posting on the SonarLint Google Group. We are also constantly monitoring questions posted to StackOverflow. For faster answers mark your StackOverflow questions with [SonarLint] and [Eclipse] tags.