Custom rules are downloaded but not executed

I wrote a small rule for sonarqube using this tutorial. I uploaded the compiled JAR to sonarqube, enabled it and it works on sonarqube. But now I want to integrate this custom rule into IntelliJ’s Sonarlint plugin by using the connected mode. I entered all connection data and updated the connection multiple times.

When clicking on Sonarlint -> Logs -> Show more informations the plugin is actually downloaded and listed. But the report does not show any finding.
Here is my sourcecode. I dont understand what my mistake is.

1 Like

Hello Leslie, I just took your custom rules plugin for a spin and everything seems to work as intended.

What I did was:

  • clone your custom rules plugin repository
  • build the plugin JAR
  • install it in a local SonarQube instance
  • create a new “Custom” Quality Profile
  • enable the custom rule in the “Custom” Quality Profile, with type “String” as parameter
  • set the “Custom” Quality Profile as the default profile for Java on the server
  • bind an IntelliJ project to a project on the SonarQube instance

With this setup, a SonarLint issue is correctly raised on a sample method that takes and returns a String.

As for the versions I used: SonarQube 7.9, IntelliJ Idea Ultimate 2019.2, SonarLint for IntelliJ 4.1.0.3312.

You might want to check that the Quality Profile used to analyze your project is the intended one, either by setting as default, or by configuring it on the server-side project which you bind to.

2 Likes

Thank you a lot, setting the Quality Profile as default profile was the key for it to work.

1 Like