Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@3flex
Copy link
Member

@3flex 3flex commented Jul 31, 2022

Fixes #5097

Before this change, this task:

tasks.register("customDetektConfig", io.gitlab.arturbosch.detekt.DetektGenerateConfigTask::class) {
    config.setFrom("custom/location.yml")
    doLast {
        logger.warn("Configured path: ${config.asPath}")
    }
}

Would produce this output:

> Task :detekt-api:customDetektConfig
Skipping config file generation; file already exists at C:\<projectPath>\config\detekt\detekt.yml
Configured path: C:\<projectPath>\detekt-api\custom\location.yml

You can see the task was setting the config path and despite what was configured in the build file, the config wasn't being calculated correctly by the task.

With this PR, it will successfully generate the file:

> Task :detekt-api:customDetektConfig
Successfully copied default config to C:\<projectPath>\detekt-api\custom\location.yml
Configured path: C:\<projectPath>\detekt-api\custom\location.yml

And subsequent invocations will product the expected output:

> Task :detekt-api:customDetektConfig
Skipping config file generation; file already exists at C:\<projectPath>\detekt-api\custom\location.yml
Configured path: C:\<projectPath>\detekt-api\custom\location.yml

@cortinico cortinico added this to the 1.22.0 milestone Jul 31, 2022
@cortinico cortinico merged commit 9b5e12a into detekt:main Jul 31, 2022
@3flex 3flex deleted the 5097-fix branch July 31, 2022 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DetektGenerateConfigTask does not respect custom config locations in 1.21.0

4 participants