Skip to content

detekt works as expected only after clean project was made #3397

Answered by cortinico
Den-Rimus asked this question in Q&A
Discussion options

You must be logged in to vote

Can it be configured to run every time?

Yes, you can achieve this using the --rerun-tasks flag when running detekt so ./gradlew detektMain --rerun-tasks.
That would have the side effect of rerunning all the tasks, not only detekt (so can be quite expensive).

As an alternative, you should be able to update your build.gradle.kts you posted with:

tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
        outputs.upToDateWhen { false }
}

That will cause only Detekt to re-run every time.

As a side note, please note that this is the intended behavior. Detekt doesn't re-run as the analysis was already executed and you have the reports already available in the build folder.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Den-Rimus
Comment options

Answer selected by Den-Rimus
Comment options

You must be logged in to vote
1 reply
@Den-Rimus
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants