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

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

Closed
Monax111 opened this issue Sep 14, 2021 · 13 comments
Closed

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

Monax111 opened this issue Sep 14, 2021 · 13 comments

Comments

@Monax111
Copy link

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
Copy link
Author

@cortinico could you see this problem?

@cortinico
Copy link
Member

I suggest change

Don't you mind sending a PR?

@Monax111
Copy link
Author

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

@cortinico
Copy link
Member

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

@Monax111
Copy link
Author

Monax111 commented Sep 16, 2021

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
Copy link
Member

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
Copy link
Author

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

@Monax111
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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

@cortinico
Copy link
Member

Yup now it's merged 👍

@Monax111
Copy link
Author

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

@cortinico
Copy link
Member

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

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

No branches or pull requests

2 participants