Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

How to work with the official Sonar plugin #131

Closed
afaucogney opened this issue Sep 10, 2020 · 3 comments
Closed

How to work with the official Sonar plugin #131

afaucogney opened this issue Sep 10, 2020 · 3 comments
Labels

Comments

@afaucogney
Copy link

I use detekt to run with the IDE, then with Danger for the MR comments and also in Sonar.
Today I push the configuration with those 2 gradle lines of the sonar plugin.

        property "detekt.sonar.kotlin.config.path", "${rootProject.projectDir}/base/test-kit/config/detekt/detekt-config.yml"
        property "sonar.kotlin.detekt.reportPaths", "${project.buildDir}/reports/detekt/detekt-report.xml"

I just installed for a new projet Sonar 8.x with the new detekt plugin delivered by Sonar MarketPlace. From this project readme, this feel that there is 2 plugins.

Before I did used any detekt plugin.

What are the usage of both ?

How to keep the same config, that either in IDE, MR or Sonar, the dev get same errors ?

@arturbosch
Copy link
Member

Hi @afaucogney,

I guess you have two options:

  1. Either use the official sonarqube Kotlin plugin and publish detekt reports via `property "sonar.kotlin.detekt.reportPaths", "${project.buildDir}/reports/detekt/detekt-report.xml".
  2. Or use both our and sonarqube's plugin together with a joint quality profile and detekt.sonar.kotlin.config.path.

Does this answer your question?

@afaucogney
Copy link
Author

Thanks supporting me.

What is the advantage of one solution against the other.

I mean, until now, I was not using any detekt independent sonar plugin, just the sonar kotil plugin. By this way, issues are directly managed by my project.

I did some trial with the official detekt plugin, but it complaints about non existing rules at import step, because of version difference.

I like the way to manage all my rules with detekt inside my project, but why will I loose to not use the detekt sonar plugin !

@arturbosch
Copy link
Member

arturbosch commented Oct 1, 2020

Hi,

TBH I haven't used the official plugin to upload detekt findings.
Our plugin deduplicates some issues also found by KtLint (detekt-formatting) which the official would not do I think.

Did you find any more reasons to choose one over the other?

I just published sonar-detekt 2.3.0 (will appear in the marketplace in a few days or download it now via GitHub). It will be compatible with detekt 1.14.1 so newer rules can be imported into sonarqube.

Feel free to reopen if you have more questions!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants