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

Sonar analysis fails because config file is not found in parent directory of root project #173

Open
yachoor opened this issue Oct 6, 2023 · 0 comments

Comments

@yachoor
Copy link

yachoor commented Oct 6, 2023

When analysing gradle project with submodules analysis fails for root project - the config file is being looked in a directory above project.

My project structure is:

project
├── app
│   └── build.gradle.kts
├── module1
│   └── build.gradle.kts
├── build.gradle.kts
├── config
│   └── detekt
│       └── detekt.yml
├── module2
│   └── build.gradle.kts
└── settings.gradle.kts

I set detekt.sonar.kotlin.config.path to config/detekt/detekt.yml, which works during analysis of app, module1 and module2, but fails for root project - I get an error: Configuration does not exist: <path-to-projects>\config\detekt\detekt.yml which is one directory above my project.

The logic in

if (Files.notExists(configFile) || supportedYamlEndings.any { path.toString().endsWith(it) }) {
and
if (Files.notExists(configFile) || supportedYamlEndings.any { path.toString().endsWith(it) }) {
seems wrong - if file does not exist or ends in .yml/.yaml resolve it in another directory, skipping valid existing files.

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

1 participant