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
8 changes: 3 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
plugins {
id("org.sonarqube") version "3.0"
kotlin("jvm") version app.web.drjackycv.buildsrc.Depends.Versions.kotlinVersion
id("org.sonarqube") version app.web.drjackycv.buildsrc.Depends.Versions.sonarqubeVersion
detekt
}

buildscript {
Expand Down Expand Up @@ -32,7 +34,3 @@ allprojects {
maven("https://plugins.gradle.org/m2/")
}
}

tasks.register<Delete>("clean") {
delete(rootProject.buildDir)
}
5 changes: 5 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ plugins {

repositories {
jcenter()
gradlePluginPortal()
}

dependencies {
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0-RC1")
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object Depends {
const val testCoreVersion = "1.2.0"
const val testExtJunitVersion = "1.1.1"
const val sonarqubeVersion = "3.0"

const val detektVersion = "1.15.0-RC1"
}

object ClassPaths {
Expand All @@ -61,6 +61,8 @@ object Depends {
"com.google.dagger:hilt-android-gradle-plugin:${Versions.hiltVersion}"
const val sonarqube_gradle_plugin =
"org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:${Versions.sonarqubeVersion}"
const val detekt_gradle_plugin =
"io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${Versions.detektVersion}"
}

object Libraries {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import io.gitlab.arturbosch.detekt.extensions.DetektExtension

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

val analysisDir = file(projectDir)
val baselineFile = file("$rootDir/config/detekt/baseline.xml")
val configFile = file("$rootDir/config/detekt/detekt.yml")
//val statisticsConfigFile = file("$rootDir/config/detekt/statistics.yml")

val kotlinFiles = "**/*.kt"
val kotlinScriptFiles = "**/*.kts"
val resourceFiles = "**/resources/**"
val buildFiles = "**/build/**"

detekt {
toolVersion = app.web.drjackycv.buildsrc.Depends.Versions.detektVersion
buildUponDefaultConfig = true
baseline = baselineFile
config = files("config/detekt/detekt.yml")
input = objects.fileCollection().from(
DetektExtension.DEFAULT_SRC_DIR_JAVA,
"src/test/java",
DetektExtension.DEFAULT_SRC_DIR_KOTLIN,
"src/test/kotlin"
)
reports {
html.enabled = true
html.destination = file("$projectDir/build/detekt/report.html")
xml.enabled = true
xml.destination = file("$projectDir/build/detekt/report.xml")
txt.enabled = true
txt.destination = file("$projectDir/build/detekt/report.txt")
}
}

dependencies {
detektPlugins(app.web.drjackycv.buildsrc.Depends.ClassPaths.detekt_gradle_plugin)
}

val detektFormat by tasks.registering(Detekt::class) {
description = "Formats whole project."
parallel = true
disableDefaultRuleSets = true
buildUponDefaultConfig = true
autoCorrect = true
setSource(analysisDir)
// config.setFrom(listOf(statisticsConfigFile, configFile))
include(kotlinFiles)
include(kotlinScriptFiles)
exclude(resourceFiles)
exclude(buildFiles)
baseline.set(baselineFile)
reports {
xml.enabled = true
html.enabled = true
txt.enabled = true
}
}

val detektAll by tasks.registering(Detekt::class) {
description = "Runs the whole project at once."
parallel = true
buildUponDefaultConfig = true
setSource(analysisDir)
// config.setFrom(listOf(statisticsConfigFile, configFile))
include(kotlinFiles)
include(kotlinScriptFiles)
exclude(resourceFiles)
exclude(buildFiles)
baseline.set(baselineFile)
reports {
xml.enabled = true
html.enabled = true
txt.enabled = true
}
}

val detektProjectBaseline by tasks.registering(DetektCreateBaselineTask::class) {
description = "Overrides current baseline."
buildUponDefaultConfig.set(true)
ignoreFailures.set(true)
parallel.set(true)
setSource(analysisDir)
// config.setFrom(listOf(statisticsConfigFile, configFile))
include(kotlinFiles)
include(kotlinScriptFiles)
exclude(resourceFiles)
exclude(buildFiles)
baseline.set(baselineFile)
}
17 changes: 17 additions & 0 deletions config/detekt/argsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-i
.
-b
./config/detekt/baseline.xml
-ex
**/resources/**,**/detekt*/build/**,**/buildSrc/build/**
--build-upon-default-config
-c
./config/detekt/detekt.yml
-r
html:./build/detekt-report.html
-r
xml:./build/detekt-report.xml
-r
txt:./build/detekt-report.txt
-p
./build/detekt-formatting.jar
7 changes: 7 additions & 0 deletions config/detekt/baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues />
<CurrentIssues>
<ID>LargeClass:UnusedPrivateMemberSpec.kt$UnusedPrivateMemberSpec : Spek</ID>
</CurrentIssues>
</SmellBaseline>
Loading