Skip to content

Commit

Permalink
#4 [setup] Added detekt with default config
Browse files Browse the repository at this point in the history
  • Loading branch information
vityaman committed Mar 16, 2024
1 parent 36d93c7 commit aaff7f9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
paths:
- ".github/workflows/*"
- ".markdownlint.yaml"
- "config/.markdownlint.yaml"
- "**/*.md"
jobs:
lint:
Expand All @@ -15,6 +15,6 @@ jobs:
- name: Run Markdownlint
uses: nosborn/github-action-markdown-cli@v3.3.0
with:
config_file: .markdownlint.yaml
config_file: config/.markdownlint.yaml
files: "**/*.md"
dot: true
File renamed without changes.
3 changes: 3 additions & 0 deletions config/detekt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
config:
validation: true
warningsAsErrors: true
27 changes: 27 additions & 0 deletions gateway/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask

Expand All @@ -6,6 +8,7 @@ plugins {
id("io.spring.dependency-management") version "1.1.4"
id("org.openapi.generator") version "5.3.0"
id("org.jlleitschuh.gradle.ktlint") version "12.1.0"
id("io.gitlab.arturbosch.detekt") version "1.23.5"
kotlin("jvm") version "1.9.22"
kotlin("plugin.spring") version "1.9.22"
}
Expand Down Expand Up @@ -38,6 +41,7 @@ dependencies {
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.projectreactor:reactor-test")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.3")
}

tasks.withType<KotlinCompile> {
Expand Down Expand Up @@ -110,3 +114,26 @@ ktlint {
tasks.runKtlintCheckOverMainSourceSet {
dependsOn(tasks.getByName(generateControllers))
}

detekt {
buildUponDefaultConfig = true
allRules = false
config.setFrom(file("${layout.projectDirectory}/../config/detekt.yml"))
}

tasks.withType<Detekt>().configureEach {
reports {
html.required = true
txt.required = true
sarif.required = true
md.required = true
}
}

tasks.withType<Detekt>().configureEach {
jvmTarget = "21"
}

tasks.withType<DetektCreateBaselineTask>().configureEach {
jvmTarget = "21"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import org.springframework.boot.runApplication
class GatewayApplication

fun main(args: Array<String>) {
runApplication<GatewayApplication>(*args)
runApplication<GatewayApplication>(args = args)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ import org.springframework.boot.test.context.SpringBootTest
@SpringBootTest
class GatewayApplicationTests {
@Test
fun contextLoads() {
}
fun contextLoads() = Unit
}

0 comments on commit aaff7f9

Please sign in to comment.