SonarLint for eclipse: Unnecessary changes to sqPrefixKey

We’re using SonarLint for Java (Version 4.0) in connected mode (SonarQube Server in Version 6.7.2) with Eclipse 4.10.
Because we have more than 1500 projects we’re analyzing we couldn’t bind every project manually in every developer’s IDE. The solution we came up with is to create a settings file for each project with serverId and projectKey already specified and pushing the settings file to source code management. This way, an individual developer only has to configure a server connection. This solution isn’t ideal, but it’s working flawlessly for those projects which are analyzed on the server.
However, for those projects currently not analyzed (mainly test projects; bound for when we enable analyzing our tests) the sqPrefixKey is modified whenever a configuration update is applied.

In the log file I get entries which seem fine:

Detected prefixes for projectA:
  IDE prefix: 
  Server side prefix: path/to/projects/projectA

However, there are multiple entries where server prefix is not correct:

Detected prefixes for projectB:
  IDE prefix: 
  Server side prefix: path/to/projects/projectZ
Detected prefixes for projectC:
  IDE prefix: 
  Server side prefix: path/to/projects/projectZ

This results in lots of changes which must be reverted (pushing the changes would not help, the next update might set projectY as sqPrefixKey).

2 Likes

Any insights or hints how to proceed?

Hi Olivier,

Sorry for the late answer. To me the first thing we should try is to improve is the automatic prefix detection. Any idea why it is failing? Are your modules containing the same file names?
In your example, can you provide the list of files under:

projectB
projectC
path/to/projects/projectZ

Do you need all files below the directory (recursively) or only the first level (directly below the directory)?

To reproduce the issue I would need all file names (recursively). You can send them to me as private message if you are concerned about privacy.

Sorry, but it seems I’m not able to send you a private message:

pm

Hi Oliver,
in our project we have come up with the same solution of delivering the configurations to our version control system and having the developers only specify a connection with a defined name.
But unfortunately we are now also experiencing the same problem with the changing sqPrefixKeys.
Had you found any solution to this, what you could share?

Hi Jessica,

as far as I remember the SonarSource team changed how the score for a project is computed. This was done in https://jira.sonarsource.com/browse/SLCORE-245 and released in SonarLint 4.2. Definitely after upgrading to 4.3 the toggling stopped (except for some projects which contain almost the same files).

Hope that helps