Skip to content

SonarLint for Eclipse

Gilles Querret edited this page Jan 2, 2025 · 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, 12.2 and 12.8. CABL version 2.17 (or more recent) is required.

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 12.7+

Starting from PDSOE 12.7, the SonarLint Rule Description view can't be displayed, and throws an exception in the SonarLint Console:

Unable to open external browser
java.net.MalformedURLException: unknown protocol: data
	at java.base/java.net.URL.<init>(URL.java:681)
	at java.base/java.net.URL.<init>(URL.java:569)
	at java.base/java.net.URL.<init>(URL.java:516)
    ...

PDSOE defines Edge as the default browser in Eclipse, which has known limitations when it's embedded as a view. Edge is only used to display the Progress welcome page. Reverting to the default browser will solve the problem. This can be done by removing the following line in %DLC%\oeide\eclipse\eclipse.ini:

-Dorg.eclipse.swt.browser.DefaultType="edge"

SonarLint on PDSOE 11.7 and connected to SonarQube 9.x

As PDSOE 11.7 is based on Eclipse 4.5 (released in 2015) and Java 8, there is an 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

SonarLint on PDSOE 11.7 and connected to SonarQube 10.x

While not recommended, you can use the latest version of SonarLint (6.2.2244) to connect to SonarQube 10.x from PDSOE 11.7. This has been tested up to 10.3 ; ugly workarounds had to be found to keep PDSOE compatible with SonarLint, and higher version of SonarQube will probably break additional things.