From 99a72fc7f430c1647bc083b3dccb219876597b87 Mon Sep 17 00:00:00 2001 From: Colin Lee Date: Wed, 30 Jan 2019 10:29:45 -0600 Subject: [PATCH] Add detekt, ktlint, and upgrade Gradle wrapper --- build.gradle | 34 ++++++++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index ec85cb52e..40c911965 100644 --- a/build.gradle +++ b/build.gradle @@ -14,6 +14,10 @@ buildscript { } } +plugins { + id("io.gitlab.arturbosch.detekt").version("1.0.0.RC9.2") +} + allprojects { repositories { google() @@ -30,3 +34,33 @@ allprojects { task clean(type: Delete) { delete rootProject.buildDir } + +detekt { + // The version number is duplicated, please refer to plugins block for more details + version = "1.0.0.RC9.2" + input = files("$projectDir/app") + config = files("$projectDir/config/detekt.yml") + filters = ".*test.*,.*/resources/.*,.*/tmp/.*" + + reports { + html { + enabled = true + destination = file("$projectDir/build/reports/detekt.html") + } + } +} + +configurations { + ktlint +} + +dependencies { + ktlint "com.github.shyiko:ktlint:0.24.0" +} + +task ktlint(type: JavaExec, group: "verification") { + description = "Check Kotlin code style." + classpath = configurations.ktlint + main = "com.github.shyiko.ktlint.Main" + args "app/**/*.kt" +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9a4163a4f..f73107db5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists