detekt / sonar-detekt

SonarQube plugin for Kotlin
https://detekt.dev
GNU Lesser General Public License v3.0
493 stars 52 forks source link

Detekt start analyze java and kotlin file in build/.gradle dir #145

Closed Monax111 closed 3 years ago

Monax111 commented 3 years ago

sonarqube.gradle.plugin - 3.3 Sonar server Community Edition Version 8.5.1 (build 38104) gradle - 7.1.1 run in gitlab 14.1.0

I think that problem in function:

io.gitlab.arturbosch.detekt.sonar.sensor.DetektConfiguration.createSpec() 

then evaluate inputPaths field

inputPaths = listOf(baseDir)

I have one-module project. If i apply sonar plugin, baseDir = rootDir. In root dir gradle create very many cache/tmp file. This base dir map to property pathsToAnalyze in function createCompilerConfiguration . Because of this javaFiles contains all file(include cache/tmp file)

image

Full log for this situation

I suggest change

inputPaths = configuration.get("sonar.sources")

this improvement allows you to configure detekt only for sources file

Monax111 commented 3 years ago

@cortinico could you see this problem?

cortinico commented 3 years ago

I suggest change

Don't you mind sending a PR?

Monax111 commented 3 years ago

I try, but I've never done this before in open source projects.

cortinico commented 3 years ago

No problem. Just try and if you get stuck let us know :)

Monax111 commented 3 years ago

I create commit, but can't push on branch feature/145. I need correct permission?

ERROR: Permission to detekt/sonar-kotlin.git denied to Monax111.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
cortinico commented 3 years ago

I need correct permission?

You would need to create a fork first. And push your branch to your fork. You can find a guide here https://docs.github.com/en/get-started/quickstart/fork-a-repo

Monax111 commented 3 years ago

Well, I think this is a very strange way, but I did it)

Monax111 commented 3 years ago

Hi, what i must do, for merge PR? Because of this problem, we have many builds which throw OutOfMemory:metaspce. I would like to quickly deliver these changes to our infrastructure

cortinico commented 3 years ago

Hi, what i must do, for merge PR? Because of this problem, we have many builds which throw OutOfMemory:metaspce. I would like to quickly deliver these changes to our infrastructure

There seems to be failures on the CI. Let's fix them and we can merge it. Once it's merged, we would need to wait for a new release. If you have urgency, the best would be to make your own release and use the local artifact in your sonar instance.

Monax111 commented 3 years ago

Let's fix them and we can merge it I fix failures, Can you start CI again ?

cortinico commented 3 years ago

Yup now it's merged 👍

Monax111 commented 3 years ago

Can You explain, how i can add my custom release to my sonar instance? Some instruction? or guide?

cortinico commented 3 years ago

Can You explain, how i can add my custom release to my sonar instance? Some instruction? or guide?

The instructions are basically the one listed here https://github.com/detekt/sonar-kotlin#building-from-source