SonarLint intelliJ : profiles not in sync

167 views
Skip to first unread message

etienne...@gmail.com

unread,
May 23, 2018, 12:53:19 PM5/23/18
to SonarLint
Hi,
I am using :
IntelliJ 2018.1.4 Ultimate
SonarLint 3.4.0.2532

I am not able to load a quality profile associated to the project.

I am aware of checkstyle and other third parties rules not being supported.

I tried to add a plain rule in the profile, change the severity of a rule, etc, nothing gets updated in IntelliJ.

So my guess is that all the rules that I see are local.

By the way, I don't know how to modify the console log level. All I found was a panel in which you can set properties, is that how I am supposed to do ? What are the properties ?

Thank you

Etienne

janos....@sonarsource.com

unread,
May 24, 2018, 8:24:05 AM5/24/18
to SonarLint
Hi,

After you update the quality profile on SonarQube, to make it take effect in SonarLint, you need to update the bindings in SonarLint. Open the server configurations, select the server where you made the change, and click Update binding. Also make sure that your project in SonarLint is bound to the correct project on the correct server.

You can enable detailed logs using the gear icon in the Log tab of the SonarLint view. For maximum verbosity, enable Verbose output and Analysis logs.


With detailed logs enabled, you will be able to see the connected server, project, and quality profiles used.

Cheers,
Janos

etienne...@gmail.com

unread,
May 24, 2018, 9:22:58 AM5/24/18
to SonarLint
Hi,
Thanks for your answer to my silly question, I can now see the logs and identify the issue :

The "default" profile (according to sonar) is picked up and not the specific profile attached to that specific sonar project (I am positive I am linking to the right sonar project). I guess this is not the expected behaviour, is it ?

Thanks

Etienne

Janos Gyerik

unread,
May 24, 2018, 9:31:25 AM5/24/18
to etienne...@gmail.com, SonarLint
Hi,

Certainly not the expected behavior. Are you sure the project is configured with the correct profile on SonarQube? That should be clear on the dashboard of the project on SonarQube.

Cheers,
Janos

--
You received this message because you are subscribed to a topic in the Google Groups "SonarLint" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarlint/rWcB6pJup6Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/dd8458d5-f56c-49ca-b8be-fa1dbd111190%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Janos Gyerik | SonarSource

Software Developer

http://sonarsource.com


Are you using SonarLint in your IDE?

etienne...@gmail.com

unread,
May 24, 2018, 9:49:26 AM5/24/18
to SonarLint
Yes, on the dashboard of the project, on the right, I see the quality gate name and the quality profile name, and the one received by sonarLint is not that one but the "default" one.

Thanks,
Etienne

Janos Gyerik

unread,
May 24, 2018, 9:50:56 AM5/24/18
to etienne...@gmail.com, SonarLint
Can you please send the logs for an example analysis?

--
You received this message because you are subscribed to a topic in the Google Groups "SonarLint" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarlint/rWcB6pJup6Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarlint+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Julien HENRY

unread,
May 24, 2018, 10:33:27 AM5/24/18
to Janos Gyerik, etienne...@gmail.com, SonarLint
Could it be (again) an Elastic Search index issue? @Janos maybe you could find the WS we are calling to fetch quality profiles associated to a project, and ask Etienne to run it from his browser to see the result.

Julien Henry | SonarSource

Developer

https://sonarsource.com


You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/CAG7FkBfWMQkfFp2xOQ31U4%2BhWNuzOQY-p64k1_FCgE52sVv4WQ%40mail.gmail.com.

etienne...@gmail.com

unread,
May 25, 2018, 7:46:28 AM5/25/18
to SonarLint
Hi,

Please let me know if you guys are planning on looking into it, I'd be happy to help if you need more input from my side.

Cheers,

Etienne

Julien HENRY

unread,
May 25, 2018, 8:02:21 AM5/25/18
to Etienne Marin-Matholaz, SonarLint
Etienne,

Could you enable verbose output in SonarLint console, and then update project binding. You should see in logs the call to a WS to fetch quality profiles. Something like:

Simply remove the ".protobuf" from the URL, and call it from your web browser. Check in the response is the quality profiles are correct for each language.

++

Julien Henry | SonarSource

Developer

https://sonarsource.com


--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.

etienne...@gmail.com

unread,
May 25, 2018, 8:47:15 AM5/25/18
to SonarLint
Hi,
Yes it's all there. It's picking up the first one (Fusion Java, note that it's default) although my project uses the second one (Air Fusion Java)

{  
         "key":"java-fusion-java-72892",
         "name":"Fusion Java",
         "language":"java",
         "languageName":"Java",
         "isInherited":false,
         "isDefault":true,
         "activeRuleCount":502,
         "activeDeprecatedRuleCount":0,
         "rulesUpdatedAt":"2017-08-16T12:10:35+0000",
         "lastUsed":"2018-05-25T12:28:45+0000",
         "userUpdatedAt":"2017-08-16T12:10:35+0000",
         "organization":"default-organization",
         "isBuiltIn":false,
         "actions":{  
            "edit":true,
            "setAsDefault":true,
            "copy":true
         }
      },
      {  
         "key":"AWHCQ5Ub_qNF7KNpN5l7",
         "name":"Air Fusion Java",
         "language":"java",
         "languageName":"Java",
         "isInherited":true,
         "parentKey":"java-fusion-java-72892",
         "parentName":"Fusion Java",
         "isDefault":false,
         "activeRuleCount":541,
         "activeDeprecatedRuleCount":0,
         "projectCount":0,
         "rulesUpdatedAt":"2018-05-24T13:37:15+0000",
         "lastUsed":"2018-05-25T11:42:39+0000",
         "userUpdatedAt":"2018-05-24T13:37:15+0000",
         "organization":"default-organization",
         "isBuiltIn":false,
         "actions":{  
            "edit":true,
            "setAsDefault":true,
            "copy":true
         }
      },

 

etienne...@gmail.com

unread,
May 25, 2018, 9:16:25 AM5/25/18
to SonarLint
Ok found it. I guess sonarLint ignores the second one because projectCount is 0. So in sonarqube I have to not only associate the profile to the project but also the project to the profile (on the profile page). I don't clearly understand this bidirectionnal association, but fine.

Thanks for your help

Julien HENRY

unread,
May 25, 2018, 9:17:34 AM5/25/18
to Etienne Marin-Matholaz, SonarLint
The result looks wrong. For a given project, only one quality profile should be returned per language. Here the WS returns 2.

Could be a bug on SonarQube side. May I ask you the version of your SonarQube server?

Julien Henry | SonarSource

Developer

https://sonarsource.com


--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.

Julien HENRY

unread,
May 25, 2018, 9:19:36 AM5/25/18
to Etienne Marin-Matholaz, SonarLint
OK, we are getting closer. I think your DB (or maybe ES) was in an inconsistent state, because in the UI, assigning a project to a QP from one side or the other should make no difference.

What was you initial method to associate the profile to the project?

Julien Henry | SonarSource

Developer

https://sonarsource.com


2018-05-25 15:16 GMT+02:00 <etienne...@gmail.com>:
Ok found it. I guess sonarLint ignores the second one because projectCount is 0. So in sonarqube I have to not only associate the profile to the project but also the project to the profile (on the profile page). I don't clearly understand this bidirectionnal association, but fine.

Thanks for your help

--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.

etienne...@gmail.com

unread,
May 25, 2018, 9:32:18 AM5/25/18
to SonarLint
Sorry, thought I'd given it to you, it's Sonar 6.7.1.

We are setting the profile via maven. Note that all branches end up associated to a sonar project with that profile.

Not also that by manually associating the project to the profile (on the profile page) to the MASTER project, and in sonarlint, associating ANY branch I'm working on with the MASTER project key, I get everything working like a charm.

Etienne

Julien HENRY

unread,
May 25, 2018, 10:01:36 AM5/25/18
to Etienne Marin-Matholaz, SonarLint
OK, you were using sonar.profile in your pom.xml (or in command line) right? This is not what we call association. This is just a convenient way to override default association for the time of the analysis, but SonarLint has no way to know that, since it is not persisted. Still, having the WS returning 2 Java profiles looks weird to me.

Julien Henry | SonarSource

Developer

https://sonarsource.com


--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.

etienne...@gmail.com

unread,
May 25, 2018, 10:25:15 AM5/25/18
to SonarLint
Ok, got it. Yes, it is done in the pom. So how should I do instead in the future ? Manually from the sonar interface, right ? But with multiple feature branches being tracked by sonar it is not very convenient.

Yes I agree this is weird. On a more general note, I don't clearly understand why in sonarLint we have to connect to a project key rather than to a profile, because from my point of view that's all we need. Of course I am not aware of all of the implications for sonarLint to work.

Anyway, my issue seems fixed now, so thanks a lot for your help and availability !

Etienne


Le vendredi 25 mai 2018 16:01:36 UTC+2, Julien HENRY a écrit :
OK, you were using sonar.profile in your pom.xml (or in command line) right? This is not what we call association. This is just a convenient way to override default association for the time of the analysis, but SonarLint has no way to know that, since it is not persisted. Still, having the WS returning 2 Java profiles looks weird to me.

Julien Henry | SonarSource

Developer

https://sonarsource.com


2018-05-25 15:32 GMT+02:00 <etienne...@gmail.com>:
Sorry, thought I'd given it to you, it's Sonar 6.7.1.

We are setting the profile via maven. Note that all branches end up associated to a sonar project with that profile.

Not also that by manually associating the project to the profile (on the profile page) to the MASTER project, and in sonarlint, associating ANY branch I'm working on with the MASTER project key, I get everything working like a charm.

Etienne

--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+...@googlegroups.com.

Julien HENRY

unread,
May 25, 2018, 10:44:42 AM5/25/18
to Etienne Marin-Matholaz, SonarLint
SonarLint need more than the quality profile. It also needs project settings (for issue exclusions), and also issue status (false positive/won't fix) to hide them on SonarLint side.

Julien Henry | SonarSource

Developer

https://sonarsource.com


To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/0ec34ece-e344-438d-bc62-d6b4282319f2%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages