I’ve added some XML custom rules for my project. Then I added these rules to my local SonarQube server. When I analyze my project all of the custom rules appear. When I opened my project in Eclipse and connected to my local sonarqube via sonarlint, everything works fine. The problem with intellij. It doesn’t show any of rules except the rules that have been there before.
in my pom.xml I flagged this one
Also I’m informed that sonarlint doesn’t support 3rd party plugins, but I don’t use any of them. Maybe there is some exceptions for intellij? cause for eclipse those rules appear.
My sonarqube version is 188.8.131.5242 and sonarlint Version for Intellij : 184.108.40.2062 Sonarlint for eclipse 4.1
SonarLint for Eclipse and IntelliJ are very similar, so it should work. Have you updated the SonarLint local storage in IntelliJ?
Thank you for your reply. Yes, I updated binding, but it didn’t help.
Can you open the SonarLint logs tab, enable verbose output, and run again the binding update. It should display the list of plugins that have been downloaded from the server. Please share the entire log if you don’t know where to look at.
I see my XML plugin
Load plugins (done) | time=10ms
- SonarScala 220.127.116.115 (sonarscala)
- SonarPython 18.104.22.16822 (python)
- SonarJava 22.214.171.12489 (java)
- SonarHTML 126.96.36.1995 (web)
SonarXML 2.1.0-SNAPSHOT (xml)
- SonarKotlin 188.8.131.525 (kotlin)
- SonarPHP 184.108.40.20637 (php)
- SonarTS 220.127.116.1166 (typescript)
- SonarRuby 18.104.22.1685 (ruby)full_log.txt (29.5 KB)
UPD: uploaded full log
I see you have modified the SonarXML plugin to implement your additional rules. That’s hard to see why it doesn’t work in IntelliJ when it works in Eclipse.
Are you able to share the changes you made on the plugin somewhere so that we could see if something is wrong?
@Julien_HENRY, this is my project
@Julien_HENRY Forget to mention, current branch is: 1.0
In fact this is not a forked version of SonarXML, but a brand new analyzer. So that’s expected to not have SonarLint running it (look for the FAQ in this forum for details).
Now I’m really surprised when you say it works in SonarLint for Eclipse. This is unexpected.
I tried to fork it from here https://github.com/DianaAimbetova/sonar-xml , but then I wasn’t able to push anything there, so that’s why I created new repo. What should I do to be able to add rules into intellij’s sonarlint?
We don’t have an official API for adding custom rules to SonarXML. I don’t think this is on our short term roadmap. So you can continue with your fork, but we won’t provide any active support. Or maybe if your rules are valuable to the community, you can create a new thread to suggest them, and we could consider implementing them in the official SonarXML plugin.
So the only way to add custom rules into sonar-XML analyzer which properly works with intellij is creating xpath rule like it was written here?
I think yes, but I have not tested recently.
Personal rules are not synchronized
I just did a test with a SonarXML custom rule using XPath template:
I works fine in SonarLint for Eclipse:
Currently it doesn’t work in SonarLint for IntelliJ, since the support of XML has not yet been released (so in fact no XML rules at all will show up in IntelliJ). You can watch https://jira.sonarsource.com/browse/SLI-320 to be notified of the release.
@Julien_HENRY thanks a lot