Sonarqube Support

Hi @yole! Any news on this? An official and well supported kotlin plugin would be appreciated

Thanks!

@henry I have also installed the Sonar-Kotlin plugin and see the analysis result.

BUT I’m not seeing coverage results. Jacoco is running, and I can see the html reports in my Gradle output. Did you do anything from a configuration perspective in Sonarqube or your build to accomplish this?

Any assistance/advice greatly appreciated.

1 Like

Once the plugin is available, it will be announced on the Kotlin blog. I don’t have any other news to share at this time.

1 Like

Hi! @yole do you have any update on it? I read up on the discussion that you planned to provide an official plugin the last year.
We want to start coding in Kotlin but this one is the main requirement of the client…
Really thanks in advance!

3 Likes

Would love an update on this as well. Proper Sonarqube support is one of the issues that have to be solved before my team will consider moving to Kotlin.

2 Likes

Hello @yole,
do you have any updates for us?

Would be good to know if it is still on your roadmap and if so when
you are planning to release something.

Thanks!

Once the plugin is available, it will be announced on the Kotlin blog. I don’t have any other news to share at this time.

Hi @yole, I understand that JetBrains has to prioritize this with everything else in the backlog but I’m adding my vote to hopefully see this plugin soon. Look forward to seeing a blog post announcing this.

Thanks,
Thomas

1 Like

Hi @yole, adding my vote too, please let us know if there are news from the Jetbrains side on providing an official plugin. Thanks in advance!

I don’t understand the desire to have a Kotlin plug-in for SonarQube. From my point of view the static analysis of IntelliJ is much more extensive AND it can be used on a continuous integration server, too. The easiest way is probably to use TeamCity, but it can be used with any build server like Jenkins.

That is exactly the point. There are different opinions about stuff like that. And there are companies out there choosing not to use IntelliJ. There are people using eclipse or probably some people just using a basic text editor. I think this plugin would be good just so there are options to choose from. It’s not like static analysis is a solved problem

I agree that diversity is generally a good thing. But I have the suspicion that many users are longing for SonarQube (for Java or Kotlin), because they aren’t aware of the possibility to use IntelliJ inspections on a CI server.

By the way: Using Kotlin with Eclipse is hardly advisable at the current state of the Kotlin Plugin.

I can not say how the Kotlin plugin is for eclipse as I am a happy user of intellij. Still I think that in the long term more options are better than fewer.

Could well be true. As I don’t use Kotlin/Intellij in a professional setting I don’t know how much tools like this are used in Kotlin already.

My team is aware of that, but we are happy the way our pipeline is set up with SonarQube right now, and we don’t want to have to change that.

I’m using Detekt for static analysis. https://github.com/arturbosch/detekt and highly recommend it. Ties in very nicely to Gradle.

The author has provided a preliminary Sonarqube plugin. https://github.com/arturbosch/sonar-kotlin.

I am using it at my corporate employer to satisfy the requirement that all projects must show Issues and coverage in Sonarqube.

Fortunately the ‘owners’ of Sonarqube were willing to install a plugin built from source as this plugin has not been published to the Sonarqube Update Centre.

This will hopefully help some of you get past this roadblock to Kotlin adoption.

Greetings were you able to upload the coverage tests? Our team is having troubles with that.

Using Jacoco gradle plugin (0.8.0)
Using Sonar gradle plugin (2.6.2)

Yes I was. The ‘magic’ configuration was this. Let’s sonarqube/jacoco find the kotlin files. Note that my project is 100% Kotlin, hence the explicit setting to kotlin classes, and it’s Gradle 4+.

If you have a mixed project, you’ll likely need to add to the sonar.java.binaries property.

I spent a bit of time experimenting with this. Using Docker and the Sonarqube container at DockerHub was a HUGE benefit. Sped up attempts significantly.

sonarqube {
    properties {
        property 'sonar.java.binaries', "$projectDir/build/classes/kotlin"
    }
}

As far as I understand, Sonar JIRA is open for everyone for read.
So we can track a progress of official Kotlin plugin development starting from here
https://jira.sonarsource.com/browse/MMF-1214

1 Like

Hi everyone,

I guess I should start with a disclaimer: I’m an engineer @ SonarSource, the company that maintains SonarQube. Having seen this thread, and notably that last note below, If feel compelled to give you a heads-up on the SonarQube+Kotlin situation, and essentially share some good news.

Indeed this Jira entry is the overarching tracking item for the various new languages that we want our products to support in 2018. Kotlin is one that we worked on a couple of months back, and so in the context of this thread you should now that Kotlin is natively supported since SonarQube 7.3 . (since then, SonarQube 7.4 also landed with native Ruby support, but that’s another topic). All open-source goodness by the way :heart:

It’s only fair to remind that all the same is available via SonarCloud (in case your Kotlin code is in GitHub/BitBucket/AzureDevops).

Last but not least, the same Kotlin rules that SonarQube now has built-in, are also available for on-the-fly inspection in IntelliJ. We provide them via SonarLint, which just received Kotlin support.

Again I took the liberty to give a focused product update here because the thread is clearly marked as SonarQube-oriented. I’m happy to share other insights if needed (and if any feedback, we’re also listening on our community forum.

4 Likes

How can I integrate SonarQube with my Kotlin project with gradle?