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

Plugin configuration questions #166

Open
4rthurRousseau opened this issue May 24, 2023 · 1 comment
Open

Plugin configuration questions #166

4rthurRousseau opened this issue May 24, 2023 · 1 comment

Comments

@4rthurRousseau
Copy link

4rthurRousseau commented May 24, 2023

Hello team !

My team and I are working on multiple Java / Kotlin Android projects with a mix of Jetpack Compose and traditional Android projects. We recently integrated the sonar-kotlin plugin (version 2.5.0) into our SonarQube and so far, everything is running perfectly, but now that we're trying to meet different requirements on some projects, wer're having questions / issues about the plugin configuration.

Issues with "Non-Detekt" projects :

Some of our Kotlin projects do not use Detekt and we do not plan on integrating it. However, we have been experiencing crashes in these projects since the day we started specifying the Detekt configuration YAML path in the plugin configuration.

FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':sonarqube'.
Configuration does not exist: /home/jenkins/agent/workspace/[REMOVED]/detekt-configuration.yaml

Is there a way to only use the Detekt configuration if it is present in the project, preventing crashes on projects that do not use Detekt ?

Configuration overlapping :

We have specified a path for "detekt.sonar.kotlin.config.path" in the plugin configuration. We are curious about how the rules defined in the YAML file of each project interact with the rules imported during the plugin addition. What is the impact of this setting and how does it work in conjunction with the predefined Detekt rules ?

Modifying rules for specific projects :

Our aim is to keep all the rules configured at the quality profile level, but we would like to modify some rules for certain projects that use Jetpack Compose (https://detekt.dev/docs/introduction/compose/). We noticed that Detekt offers a "--build-upon-default-config" flag which allows us to specify only the rules we wish to modify. Is it possible to "emulate" this behavior using the Sonar-Kotlin plugin ?

Your advice and support would be greatly appreciated. Thanks a lot for your work on Detekt and its Sonar plugin !

@schalkms
Copy link
Member

schalkms commented Jun 5, 2023

Hello!
Thanks for the kind words. Sorry for the late reply.

ad) Configuration overlapping :
#131 and this forum might shed some light into this point.

ad) Modifying rules for specific projects :
Detekt allows to pass multiple config files as seen here. The suggestion would be to select the passed configuration files depending on the current environment.

--config, -c
      Path to the config file (path/to/config.yml). Multiple configuration 
      files can be specified with ',' or ';' as separator.

BR

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