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

Adding Detekt in the project #216

Merged
merged 14 commits into from
Jan 28, 2024
2 changes: 1 addition & 1 deletion .github/workflows/build_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
- name: Build app and run unit tests
uses: gradle/gradle-command-action@v2
with:
arguments: ktlintCheck assembleStandardRelease testReleaseUnitTest
arguments: detekt assembleStandardRelease testReleaseUnitTest
AntsyLich marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion .github/workflows/build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Build app and run unit tests
uses: gradle/gradle-command-action@v2
with:
arguments: ktlintCheck assembleStandardRelease testReleaseUnitTest
arguments: detekt assembleStandardRelease testReleaseUnitTest

# Sign APK and create release for tags

Expand Down
1 change: 0 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ dependencies {
implementation(compose.ui.util)
implementation(compose.accompanist.webview)
implementation(compose.accompanist.systemuicontroller)
lintChecks(compose.lintchecks)

implementation(androidx.paging.runtime)
implementation(androidx.paging.compose)
Expand Down
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ subprojects {
}

plugins.withType<BasePlugin> {
plugins.apply("tachiyomi.lint")

plugins.apply("detekt")
configure<BaseExtension> {
compileSdkVersion(AndroidConfig.compileSdk)
defaultConfig {
Expand Down
3 changes: 2 additions & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ plugins {
}

dependencies {
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
AntsyLich marked this conversation as resolved.
Show resolved Hide resolved
implementation(androidxLibs.gradle)
implementation(kotlinLibs.gradle)
implementation(libs.ktlint)
implementation(libs.detekt.gradlePlugin)
implementation(gradleApi())
}

Expand Down
47 changes: 47 additions & 0 deletions buildSrc/src/main/kotlin/detekt.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import org.gradle.accessors.dm.LibrariesForLibs

plugins {
id("io.gitlab.arturbosch.detekt")
}

val libs = the<LibrariesForLibs>()
dependencies {
detektPlugins(libs.detekt.rules.formatting)
detektPlugins(libs.detekt.rules.compose)
}

private val configFile = files("$rootDir/config/detekt/detekt.yml")
private val baselineFile = file("$rootDir/config/detekt/baseline.xml")
private val kotlinFiles = "**/*.kt"
private val resourceFiles = "**/resources/**"
private val buildFiles = "**/build/**"
private val generatedFiles = "**/generated/**"
private val scriptsFiles = "**/*.kts"

detekt {
buildUponDefaultConfig = true
parallel = true
autoCorrect = false
ignoreFailures = false
config.setFrom(configFile)
baseline = file(baselineFile)
}

tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
include(kotlinFiles)
exclude(resourceFiles, buildFiles, generatedFiles, scriptsFiles)
reports {
html.required.set(true)
xml.required.set(false)
txt.required.set(false)
}
}

tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
jvmTarget = JavaVersion.VERSION_17.toString()
}
tasks.withType<DetektCreateBaselineTask>().configureEach {
jvmTarget = JavaVersion.VERSION_17.toString()
}
22 changes: 0 additions & 22 deletions buildSrc/src/main/kotlin/tachiyomi.lint.gradle.kts

This file was deleted.

1,167 changes: 1,167 additions & 0 deletions config/detekt/baseline.xml

Large diffs are not rendered by default.

Loading