beaniejoy / dongne-cafe-api

☕️ kotlin & spring boot application (toy project) / siren order service for local cafe
2 stars 1 forks source link

Apply kotlin lint #57

Closed beaniejoy closed 1 year ago

beaniejoy commented 1 year ago

ktlint rule disable 설정

[*.{kt,kts}]
ktlint_standard_import-ordering=disabled
ktlint_standard_trailing-comma-on-call-site=disabled
ktlint_standard_trailing-comma-on-declaration-site=disabled
ktlint_standard_comment-spacing=disabled
ktlint_standard_no-wildcard-imports=disabled
ktlint_standard_no-blank-lines-in-chained-method-calls=disabled
ktlint_standard_no-multi-spaces=disabled

위 방식대로 ktlint_[standard|experimental]_[rule-name] 필드명에 disabled 붙이면 lint 규칙에서 제외

build.gradle.kts 설정

plugins {
    id(Plugins.KTLINT).version(Version.KtLint.PLUGIN)
}

// allprojects
apply {
    plugin(Plugins.KTLINT)
}

// ktlint setting
ktlint {
    version.set(Version.KtLint.PINTEREST)

    reporters {
        reporter(ReporterType.JSON)
    }
}

// report directory location setting
tasks.withType<GenerateReportsTask> {
    reportsOutputDirectory.set(
        rootProject.layout.buildDirectory.dir("reports/ktlint/${project.name}")
    )
}