티스토리 뷰

공부

[CI] ktlint & detekt

승가비 2022. 7. 22. 21:11
728x90
# lint-klint-and-detekt.yaml

name: lint-klint-and-detekt

on:
  pull_request:
    branches:
      - main
  workflow_dispatch:

jobs:
  lint-klint-and-detekt:
    runs-on: [ self-hosted, Linux, X64 ]
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: run
        working-directory: package
        run: ./gradlew build
# build.gradle.kts

import io.gitlab.arturbosch.detekt.Detekt

group = "com.tistory.seunggabi"
description = "seunggabi"

plugins {
    kotlin("jvm")
    id("io.gitlab.arturbosch.detekt")
    id("org.jlleitschuh.gradle.ktlint")
}

allprojects {
    repositories {
        mavenCentral()
    }

    apply {
        plugin("io.gitlab.arturbosch.detekt")
        plugin("org.jlleitschuh.gradle.ktlint")
    }

    ktlint {
        debug.set(false)
        verbose.set(true)
        android.set(false)
        outputToConsole.set(true)
        ignoreFailures.set(false)
        enableExperimentalRules.set(true)
        filter {
            exclude("**/generated/**")
            include("**/kotlin/**")
        }
    }

    detekt {
        config = rootProject.files("./detekt.yaml")
        autoCorrect = true
    }
}

tasks.withType<Detekt>().configureEach {
    reports {
        html.required.set(true)
        html.outputLocation.set(file("build/reports/detekt.html"))
    }
}
# gradle.properties

kotlinVersion=1.7.10
kotlinxVersion=1.6.4
springBootVersion=2.7.1
mortarVersion=1.0.4
ktlintVersion=10.3.0
detektVersion=1.20.0
jacksonVersion=2.13.3
rootProject.name = "seunggabi"

pluginManagement {
    val kotlinVersion: String by settings
    val springBootVersion: String by settings
    val mortarVersion: String by settings
    val ktlintVersion: String by settings
    val detektVersion: String by settings

    plugins {
        id("se.ohou.mortar.plugin") version mortarVersion
        id("org.jlleitschuh.gradle.ktlint") version ktlintVersion
        id("io.gitlab.arturbosch.detekt") version detektVersion

        id("org.springframework.boot") version springBootVersion
        id("org.jetbrains.dokka") version kotlinVersion

        kotlin("jvm") version kotlinVersion
        kotlin("plugin.spring") version kotlinVersion
        kotlin("plugin.jpa") version kotlinVersion apply false
        kotlin("plugin.allopen") version kotlinVersion apply false
        kotlin("plugin.noarg") version kotlinVersion apply false
    }

    repositories {
        gradlePluginPortal()
    }
}
728x90

'공부' 카테고리의 다른 글

Kubernetes helm  (0) 2022.07.31
`Docker Container` vs `Virtual Machine`  (0) 2022.07.31
[github] auto-author-assign  (0) 2022.07.22
[MacOSX] ISO 8601 format  (0) 2022.07.20
[Presto] DATE_ADD, DATE_DIFF  (0) 2022.07.20
댓글
댓글쓰기 폼