Skip to content

SonarLint for Eclipse

Gilles Querret edited this page Dec 12, 2023 · 43 revisions

According to the web page:

SonarLint is an Eclipse plugin that provides on-the-fly feedback to developers on new bugs and quality issues injected into Java, JavaScript and PHP code.

OpenEdge code can't be checked in SonarLint for Eclipse without a SonarQube server. Please refer to the Getting started page in order to set up a SonarQube server.

Download and install

In order to install (or upgrade) SonarLint with Progress Developer Studio, please download the right version:

🚯 Please don't report issues to the public mailing lists of SonarLint, as this is not a supported configuration.

⚠️ Plugin can only be executed on PDS 11.7 and 12.x. Your SonarQube instance must run version 2.8.0 (or greater) of the OpenEdge plugin and of the rules plugin.

From Progress Developer Studio:

  • choose Help -> Install new software...
  • click on Add..., then on the Archive... button and select the ZIP file you just downloaded
  • check the two boxes SonarLint for Eclipse and Required dependencies
  • click on Next > and follow the instructions
  • restart Progress Developer Studio

Server configuration

Open the SonarLint Bindings view, then configure your server connection:

🔗 Open image

Project configuration

Make sure your project is available on SonarQube (analyzed at least once). Right-click on your project, and select SonarLint -> Bind to SonarQube or SonarCloud, then attach your OpenEdge project to a SonarQube project using the SonarQube project key.

🔗 Open image

FAQ and tips

Source code can't be parsed because of missing <table>

  • First verify that all databases have a unique identifier. This can be found by executing FIND FIRST _db. MESSAGE _db-guid. while connected to each database. Any duplicates in the list of GUIDs will probably lead to an inconsistent database schema in SonarLint.
  • If using TCP/IP database connections, the schema may not be available immediately from Developer Studio. You can use OpenEdge -> Refresh cache in Developer Studio to refresh the schema.
  • You can also delete the .schema files in <project_root>/.sonarlint to force a refresh during the next analysis

Unable to analyze XML XREF due to org.xml.sax.SAXParseException

If workspace option Build automatically (from Project menu) is unset, and Compile on save if required (from Preferences -> Progress OpenEdge -> Editor -> Build) is set, then SonarLint and the compiler are triggered at the same time, and then XML files can't be parsed correctly as they may not be fully generated. In this case, disable Run SonarLint automatically from SonarLint, and trigger analysis manually.

In trouble?

In case you don't see any issue reported in your source code, then you should enable 'Analysis log' and 'Verbose output' in the SonarLint Console (from Console view).

Annotations

SonarLint annotations can be configured in the Eclipse preferences, section General > Editors > Text editors > Annotations

SonarLint on PDSOE 11.7 and connected to SonarQube 9.x

As PDSOE 11.7 is based on Eclipse 4.5 (released in 2015), there is a small incompatibility between SonarLint and Eclipse secure storage. If you have an error message when trying to connect to the remote SonarQube server, then you should delete the existing secure storage:

  • Open Eclipse preferences
  • Section General > Security > Secure Storage, then Contents tab
  • Select existing "Default Secure Storage" and click on Delete