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

build(gradle): Add a "detektAll" convenience task #8892

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ jobs:
with:
gradle-home-cache-cleanup: true
- name: Check for Detekt Issues
run: ./gradlew detekt
- name: Check for Detekt Issues with type resolution
run: ./gradlew detektMain detektTestFixtures detektTest detektFunTest
run: ./gradlew detektAll
- name: Upload SARIF File
uses: github/codeql-action/upload-sarif@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3
if: always() # Upload even if the previous step failed.
Expand Down
7 changes: 7 additions & 0 deletions buildSrc/src/main/kotlin/ort-kotlin-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,13 @@ val mergeDetektReports = if (rootProject.tasks.findByName(mergeDetektReportsTask
}
}

val detekt = tasks.named<Detekt>("detekt")

tasks.withType<Detekt>().configureEach detekt@{
jvmTarget = maxKotlinJvmTarget.target

dependsOn(":detekt-rules:assemble")
if (this != detekt.get()) mustRunAfter(detekt)

exclude {
"/build/generated/" in it.file.absolutePath
Expand All @@ -160,6 +163,10 @@ tasks.withType<Detekt>().configureEach detekt@{
finalizedBy(mergeDetektReports)
}

tasks.register("detektAll") {
dependsOn(tasks.withType<Detekt>())
}

tasks.withType<KotlinCompile>().configureEach {
val hasSerializationPlugin = plugins.hasPlugin(libs.plugins.kotlinSerialization.get().pluginId)

Expand Down
Loading