Skip to content

Commit 6837f05

Browse files
committed
chore: fix detekt issues
1 parent edb782a commit 6837f05

File tree

29 files changed

+443
-337
lines changed

29 files changed

+443
-337
lines changed

.detekt/config.yml

Lines changed: 132 additions & 183 deletions
Large diffs are not rendered by default.

.github/workflows/android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
${{ runner.os }}-gradle-
3131
3232
- name: Run Detekt
33-
run: ./gradlew detektAll
33+
run: ./gradlew detekt
3434
ktlint:
3535
runs-on: ubuntu-latest
3636

app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
kotlinParcelize
55
kotlinKapt
66
daggerHilt
7+
jacoco
78
}
89

910
android {

build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
@file:Suppress("UNUSED_VARIABLE")
3+
24
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
35

46
buildscript {
@@ -14,9 +16,10 @@ buildscript {
1416
}
1517
}
1618

19+
plugins.apply(ScriptsPlugins.gitHooks)
20+
1721
plugins {
1822
buildSrcVersions
19-
quality
2023
}
2124

2225
allprojects {
@@ -25,8 +28,7 @@ allprojects {
2528
jcenter()
2629
}
2730

28-
plugins.apply(GradlePluginId.detekt)
29-
plugins.apply(GradlePluginId.ktlint)
31+
plugins.apply(ScriptsPlugins.quality)
3032

3133
tasks.withType<KotlinCompile>().configureEach {
3234
kotlinOptions.freeCompilerArgs +=

buildSrc/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ plugins {
33
`kotlin-dsl-precompiled-script-plugins`
44
}
55

6+
kotlinDslPluginOptions {
7+
experimentalWarning.set(false)
8+
}
9+
610
repositories {
711
jcenter()
812
maven("https://plugins.gradle.org/m2/")
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
object BuildTasksGroups {
2+
const val ANDROID = "android"
3+
const val BUILD = "build"
4+
const val BUILD_SETUP = "build setup"
5+
const val CLEANUP = "cleanup"
6+
const val DOCUMENTATION = "documentation"
7+
const val FORMATTING = "formatting"
8+
const val GIT_HOOKS = "git hooks"
9+
const val HELP = "help"
10+
const val INSTALL = "install"
11+
const val OTHER = "other"
12+
const val REPORTING = "reporting"
13+
const val VERIFICATION = "verification"
14+
const val QUALITY = "quality"
15+
}

buildSrc/src/main/kotlin/ScriptsPlugins.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ object ScriptsPlugins {
22
const val androidLibrary = "commonscripts.android-library"
33
const val kotlinLibrary = "commonscripts.kotlin-library"
44
const val quality = "commonscripts.quality"
5+
const val gitHooks = "commonscripts.git-hooks"
56
}

buildSrc/src/main/kotlin/commonscripts/android-library.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ plugins {
55
`android-library` apply false
66
`kotlin-android` apply false
77
`kotlin-parcelize` apply false
8-
id("com.vanniktech.android.junit.jacoco")
98
}
109

1110
android {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package commonscripts
2+
3+
import utils.isLinuxOrMacOs
4+
5+
tasks {
6+
register<Copy>("copyGitHooks") {
7+
description = "Copies the git hooks from scripts/git-hooks to the .git folder."
8+
group = BuildTasksGroups.GIT_HOOKS
9+
from("$rootDir/scripts/git-hooks/") {
10+
include("**/*.sh")
11+
rename("(.*).sh", "$1")
12+
}
13+
into("$rootDir/.git/hooks")
14+
}
15+
16+
register<Exec>("installGitHooks") {
17+
description = "Installs the pre-commit git hooks from scripts/git-hooks."
18+
group = BuildTasksGroups.GIT_HOOKS
19+
workingDir(rootDir)
20+
commandLine("chmod")
21+
args("-R", "+x", ".git/hooks/")
22+
dependsOn(named("copyGitHooks"))
23+
onlyIf {
24+
isLinuxOrMacOs()
25+
}
26+
doLast {
27+
logger.info("Git hooks installed successfully.")
28+
}
29+
}
30+
31+
register<Delete>("deleteGitHooks") {
32+
description = "Delete the pre-commit git hooks."
33+
group = BuildTasksGroups.GIT_HOOKS
34+
delete(fileTree(".git/hooks/"))
35+
}
36+
37+
afterEvaluate {
38+
tasks["clean"].dependsOn(tasks.named("installGitHooks"))
39+
}
40+
}

buildSrc/src/main/kotlin/commonscripts/kotlin-library.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ package commonscripts
22

33
plugins {
44
kotlin apply false
5-
id("com.vanniktech.android.junit.jacoco") apply false
65
}
76

87
dependencies {
98
implementation(Libs.kotlin_stdlib)
10-
}
9+
}

0 commit comments

Comments
 (0)