diff --git a/README.md b/README.md index 75772aad5..7326ee28f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,27 @@ ![Build Status](https://www.bitrise.io/app/4cbfc6308f5c80e5/status.svg?token=FXilfAPD1nT8M1QzlfBNqA&branch=kotlin) # Android Templates: Kotlin -- Our optimized Android templates used in our kotlin android projects \ No newline at end of file +- Our optimized Android templates used in our kotlin android projects + +### Setup +- Clone the project +- Checkout our main development branch `kotlin` +- Run the project with Android Studio + + +### Linter and static code analysis + +1. Check Style: + +``` +$ ./gradlew checkStyle +``` + +Report is located at: `./app/build/reports/checkstyle/` + +2. Detekt + +``` +$ ./gradlew detekt +``` + +Report is located at: `./build/reports/detekt.html` diff --git a/build.gradle b/build.gradle index fc2be7522..e0fd7d552 100644 --- a/build.gradle +++ b/build.gradle @@ -62,7 +62,7 @@ buildscript { } plugins { - id "io.gitlab.arturbosch.detekt" version "1.0.0.RC6-3" + id "io.gitlab.arturbosch.detekt" version "1.14.0" } allprojects { @@ -79,12 +79,28 @@ task clean(type: Delete) { } detekt { - profile("main") { - input = "$projectDir" - config = "$project.rootDir/detekt-config.yml" - filters = ".*test.*,.*/resources/.*,.*/tmp/.*" - output = "${project.buildDir}/reports/detekt/" - parallel = true - disableDefaultRuleSets = false + toolVersion = "1.14.0" + + input = files("app/src/main/java", "app/src/main/kotlin", "data/src/main/kotlin", "data/src/main/java") + parallel = false + config = files("detekt-config.yml") + buildUponDefaultConfig = false + disableDefaultRuleSets = false + + debug = false + ignoreFailures = false + + ignoredBuildTypes = ["release"] + ignoredFlavors = ["production"] + + reports { + xml { + enabled = true + destination = file("build/reports/detekt.xml") + } + html { + enabled = true + destination = file("build/reports/detekt.html") + } } } diff --git a/detekt-config.yml b/detekt-config.yml index 9d0b1acd2..e7a9acd61 100644 --- a/detekt-config.yml +++ b/detekt-config.yml @@ -1,24 +1,3 @@ -autoCorrect: true -failFast: false - -test-pattern: # Configure exclusions for test sources - active: true - patterns: # Test file regexes - - '.*/test/.*' - - '.*Test.kt' - - '.*Spec.kt' - exclude-rule-sets: - - 'comments' - exclude-rules: - - 'NamingRules' - - 'WildcardImport' - - 'MagicNumber' - - 'MaxLineLength' - - 'LateinitUsage' - - 'StringLiteralDuplication' - - 'SpreadOperator' - - 'TooManyFunctions' - build: maxIssues: 10 weights: @@ -172,7 +151,7 @@ exceptions: active: false TooGenericExceptionCaught: active: true - exceptions: + exceptionNames: - ArrayIndexOutOfBoundsException - Error - Exception @@ -183,7 +162,7 @@ exceptions: - Throwable TooGenericExceptionThrown: active: true - exceptions: + exceptionNames: - Error - Exception - NullPointerException @@ -326,8 +305,6 @@ style: active: false OptionalAbstractKeyword: active: true - OptionalReturnKeyword: - active: false OptionalUnit: active: false OptionalWhenBraces: