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

Incorrect detekt.yaml path resolving for nested modules. #51

Open
nikitin-da opened this issue Dec 22, 2017 · 1 comment
Open

Incorrect detekt.yaml path resolving for nested modules. #51

nikitin-da opened this issue Dec 22, 2017 · 1 comment

Comments

@nikitin-da
Copy link

We have following project structure:

app
modules/module1
modules/module2
detekt.yaml

Setting /detekt.yaml as configuration path in Sonar/Kotlin/Detekt results in following error:

Provided path '/…/ca4c5a47ac213f623228/modules/detekt.yaml' does not exist

Because tryFindDetektConfigurationFile looks for file in module directory, then if not found looks on directory above which doesn't work if module is nested deeper.

https://github.com/arturbosch/sonar-kotlin/blob/30125207e3c45142d0f89b2515c8174fd80204a6/src/main/kotlin/io/gitlab/arturbosch/detekt/sonar/sensor/DetektConfiguration.kt#L49-L67

Ideal solution would be to support "absolute" path that starts with / and do something like:

if (path.startsWith("/")) {
  configFile = File(rootProjectPath, path)
} else {
  configFile = File(baseDir, path)
}

Where rootProjectPath is absolute path to the root of the project.

@arturbosch
Copy link
Member

arturbosch commented Dec 23, 2017

Yeah your right. I forgot to support absolute paths. As sonar treats each module as the root in a Sensor it is hard to find the config file so I wrote about this limitation in the readme.
Do you might to file a PR for this? :)

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

No branches or pull requests

2 participants