Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detektGenerateConfig ignores detekt.config paramenter #2565

Closed
BraisGabin opened this issue Mar 31, 2020 · 4 comments · Fixed by #3036
Closed

detektGenerateConfig ignores detekt.config paramenter #2565

BraisGabin opened this issue Mar 31, 2020 · 4 comments · Fixed by #3036
Labels
gradle-plugin improvement migration Marker to add a migration step in the changelog
Projects
Milestone

Comments

@BraisGabin
Copy link
Member

Expected Behavior

./gradlew detektGenerateConfig creates the config file in the defined config path defined in the configuration

detekt {
    config = files("$rootProjectDir/detekt-config.yml")
}

Observed Behavior

The config is ignored and the task creates it in the default path: config/detekt/detekt.yml

Steps to Reproduce

Configure the plugin like this:

detekt {
    config = files("$rootProjectDir/detekt-config.yml")
}

and then run: ./gradlew detektGenerateConfig

Your Environment

  • Version of detekt used: 1.7.2 (reproducible in 1.6.0 too)
  • Version of Gradle used (if applicable): 5.6.1
  • Operating System and version: macOS
@iAmMONK
Copy link

iAmMONK commented Apr 1, 2020

I had some problems with config as well. But this code fixed the issue for me:
config.from(files("${project.rootDir}/config/quality/detekt/default-config.yml"))

@arturbosch
Copy link
Member

Right, the cli respects the config parameter but the gradle plugin not.
So the fix is quite easy in the gradle plugin.
Not sure if this is a bug or feature. I would consider this for a 1.X.0 release as this will need a migration entry.

@arturbosch arturbosch added improvement migration Marker to add a migration step in the changelog labels Apr 1, 2020
@BraisGabin
Copy link
Member Author

Ok, I was trying to fix this but it's not that easy. We allow to add multiple paths in config. So, which one should be used?

@arturbosch
Copy link
Member

Let's go with the last one as it overwrites the properties of the preceding. E.g.: config1,config2 we would use config2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gradle-plugin improvement migration Marker to add a migration step in the changelog
Projects
Roadmap
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants