Skip to content
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
15 changes: 14 additions & 1 deletion .github/workflows/pr_tests.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: PR Unit Tests

on:
pull_request:
types: [opened, reopened, synchronize]
types: [ opened, reopened, synchronize ]

permissions:
contents: read
Expand Down Expand Up @@ -33,6 +33,19 @@ jobs:
restore-keys: |
gradle-${{ runner.os }}-

- name: Run Detekt
run: ./gradlew --no-daemon --console=plain :core:detekt
- name: Show Detekt summary
if: always()
run: |
SUMMARY_MD=core/build/reports/detekt/detekt.md
if [ -f "$SUMMARY_MD" ]; then
echo -e "## Detekt Report\n" >> "$GITHUB_STEP_SUMMARY"
cat "$SUMMARY_MD" >> "$GITHUB_STEP_SUMMARY"
else
echo "Detekt report not found."
fi

- name: Run unit tests
run: ./gradlew --no-daemon jvmTest

Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
alias(libs.plugins.android.library).apply(false)
alias(libs.plugins.compose.hotreload) apply false
alias(libs.plugins.nexus.publish)
alias(libs.plugins.detekt).apply(false)
}

nexusPublishing {
Expand Down
29 changes: 29 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@file:Suppress("UnstableApiUsage")
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)

import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.compose.internal.utils.getLocalProperty
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
Expand All @@ -12,6 +13,8 @@ plugins {
alias(libs.plugins.compose.hotreload)
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.android.library)
alias(libs.plugins.detekt)

id("maven-publish")
id("signing")
}
Expand Down Expand Up @@ -124,7 +127,33 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
}
val detektSourceDirs = listOf(
"src/commonMain/kotlin",
"src/cmpMain/kotlin",
"src/androidMain/kotlin",
"src/jvmMain/kotlin",
"src/iosMain/kotlin",
"src/webMain/kotlin"
).map(::file).filter(File::exists)

detekt {
buildUponDefaultConfig = true
config.setFrom(files(rootProject.file("detekt.yml")))
ignoreFailures = true
parallel = true
source.setFrom(detektSourceDirs)
baseline = file("$projectDir/detekt-baseline.xml")
}

tasks.withType<Detekt>().configureEach {
jvmTarget = JvmTarget.JVM_17.target
reports {
html.required.set(true)
xml.required.set(true)
txt.required.set(true)
sarif.required.set(false)
}
}
val javadocJar = tasks.create<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
Expand Down
7 changes: 7 additions & 0 deletions core/detekt-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues/>
<CurrentIssues>

</CurrentIssues>
</SmellBaseline>
35 changes: 35 additions & 0 deletions detekt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
build:
maxIssues: 500 # Change number of issues allowed as per need

config:
validation: true
warningsAsErrors: false
checkExhaustiveness: false
# when writing own rules with new properties, exclude the property path e.g.: ['my_rule_set', '.*>.*>[my_property]']

processors:
active: true
exclude:
- 'DetektProgressListener'
# - 'KtFileCountProcessor'
# - 'PackageCountProcessor'
# - 'ClassCountProcessor'
# - 'FunctionCountProcessor'
# - 'PropertyCountProcessor'
# - 'ProjectComplexityProcessor'
# - 'ProjectCognitiveComplexityProcessor'
# - 'ProjectLLOCProcessor'
# - 'ProjectCLOCProcessor'
# - 'ProjectLOCProcessor'
# - 'ProjectSLOCProcessor'
# - 'LicenseHeaderLoaderExtension'

console-reports:
active: true
# exclude:
# - 'ProjectStatisticsReport'
# - 'ComplexityReport'
# - 'NotificationReport'
# - 'IssuesReport'
# - 'FileBasedIssuesReport'
# - 'LiteIssuesReport'
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ compose = "1.9.0"

hot-reload = "1.0.0-rc01"
nexusPublishPlugin = "2.0.0-rc-1"
detekt = "1.23.8"
activity-core = "1.10.1"
lucide = "1.0.0"
window = "1.4.0"
Expand Down Expand Up @@ -39,4 +40,5 @@ compose-hotreload = { id = "org.jetbrains.compose.hot-reload", version.ref = "ho
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPublishPlugin" }
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPublishPlugin" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }