From 8ee135cf04b6613e11afc2c72e55a9c3a47503a9 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Tue, 3 Oct 2017 15:19:05 +0200 Subject: [PATCH] add kotlin to project --- Habitica/build.gradle | 616 +++++++++--------- .../{menu_task_form.xml => menu_save.xml} | 0 build.gradle | 26 +- detekt.yml | 325 +++++++++ 4 files changed, 654 insertions(+), 313 deletions(-) rename Habitica/res/menu/{menu_task_form.xml => menu_save.xml} (100%) create mode 100644 detekt.yml diff --git a/Habitica/build.gradle b/Habitica/build.gradle index 4a50e002f..cf261da75 100644 --- a/Habitica/build.gradle +++ b/Habitica/build.gradle @@ -1,310 +1,306 @@ -apply plugin: 'com.android.application' -apply plugin: 'io.fabric' -apply plugin: 'com.noveogroup.android.check' - -buildscript { - repositories { - mavenLocal() - mavenCentral() - maven { url 'https://maven.fabric.io/public' } - jcenter() - } - dependencies { - classpath 'io.fabric.tools:gradle:1.22.1' - classpath('com.noveogroup.android:check:1.2.3') { - exclude module: 'checkstyle' - exclude module: 'pmd-java' - } - classpath 'com.puppycrawl.tools:checkstyle:7.5' - classpath 'net.sourceforge.pmd:pmd-java:5.5.3' - } -} - -repositories { - mavenLocal() - mavenCentral() - maven { url "https://oss.sonatype.org/content/repositories/snapshots" } - maven { url 'https://maven.fabric.io/public' } - - // Material View Pager - maven { url "http://dl.bintray.com/florent37/maven" } - - // Markdown - maven { url "https://s3.amazonaws.com/repo.commonsware.com" } - - maven { url "https://jitpack.io" } -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - //Networking - implementation 'com.squareup.okhttp3:okhttp:3.7.0' - implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0' - //REST API handling - implementation('com.squareup.retrofit2:retrofit:2.2.0') { - exclude module: 'okhttp' - } - implementation 'com.squareup.retrofit2:converter-gson:2.2.0' - implementation 'com.squareup.retrofit2:adapter-rxjava:2.2.0' - - //Crash Logging - releaseImplementation('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') { - transitive = true - } - - // View Elements Binding :) - implementation 'com.jakewharton:butterknife:8.5.1' - annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' - - //Dependency Injection - implementation 'com.google.dagger:dagger:2.10' - annotationProcessor 'com.google.dagger:dagger-compiler:2.10' - compileOnly 'org.glassfish:javax.annotation:10.0-b28' - //App Compatibility and Material Design - implementation('com.mikepenz:materialdrawer:5.8.3@aar') { - transitive = true - } - implementation 'com.android.support:appcompat-v7:25.3.1' - implementation 'com.android.support:design:25.3.1' - implementation 'com.android.support:recyclerview-v7:25.3.1' - implementation 'com.android.support:preference-v14:25.3.1' - implementation 'com.android.support:multidex:1.0.1' - - //QR Code - implementation 'com.github.kenglxn.QRGen:android:2.2.0' - - // Emojis - implementation 'com.github.viirus:emoji-lib:0.0.3.4' - - // Markdown - implementation 'com.commonsware.cwac:anddown:0.3.0' - - // About View for all dependent Libraries, we are using - implementation('com.mikepenz:aboutlibraries:5.9.4@aar') { - transitive = true - } - - // a better fab alternative - implementation 'com.github.clans:fab:1.6.4' - - // ORM - annotationProcessor 'com.raizlabs.android:DBFlow-Compiler:2.2.1' - implementation "com.raizlabs.android:DBFlow-Core:2.2.1" - implementation "com.raizlabs.android:DBFlow:2.2.1" - - //Eventbus - implementation 'org.greenrobot:eventbus:3.0.0' - - // IAP Handling / Verification - implementation 'org.solovyev.android:checkout:0.9.3@aar' - - //Facebook - implementation('com.facebook.android:facebook-android-sdk:4.19.0') { - transitive = true - } - - implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar' - - // lodash/underscore - implementation 'com.github.javadev:underscore:1.23' - - //RxJava - implementation 'io.reactivex:rxandroid:1.2.1' - implementation 'io.reactivex:rxjava:1.2.0' - - //Analytics - implementation 'com.amplitude:android-sdk:2.13.3' - - // Fresco Image Management Library - implementation('com.facebook.fresco:fresco:1.3.0') { - exclude module: 'bolts-android' - } - implementation('com.facebook.fresco:animated-gif:1.3.0') { - exclude module: 'bolts-android' - } - //Tests - testImplementation "junit:junit:4.12" - testImplementation "org.assertj:assertj-core:1.7.0" - testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5' - testImplementation "org.robolectric:robolectric:3.2" - testImplementation 'org.robolectric:shadows-multidex:3.1' - testImplementation "org.robolectric:shadows-support-v4:3.1" - testImplementation "org.mockito:mockito-core:2.8.9" - - //Leak Detection - debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5' - releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5' - - //Push Notifications - implementation 'com.google.firebase:firebase-core:10.2.6' - implementation 'com.google.firebase:firebase-messaging:10.2.6' - - implementation 'com.google.android.gms:play-services-auth:10.2.6' - - implementation 'org.apmem.tools:layouts:1.10@aar' - - implementation 'com.roughike:bottom-bar:2.2.0' - - implementation(project(':seeds-sdk')) { - exclude group: 'com.google.android.gms' - exclude group: 'com.android.support', module: 'multidex' - } -} - -android { - compileSdkVersion 25 - buildToolsVersion "25.0.3" - - defaultConfig { - applicationId "com.habitrpg.android.habitica" - vectorDrawables.useSupportLibrary = true - buildConfigField "String", "STORE", "\"google\"" - } - - lintOptions { - abortOnError false - } - signingConfigs { - release - } - - buildTypes { - debug { - applicationIdSuffix ".debug" - debuggable true - multiDexEnabled true - // Disable fabric build ID generation for debug builds - ext.enableCrashlytics = false - ext.alwaysUpdateBuildId = false - resValue "string", "content_provider", "com.habitrpg.android.habitica.debug.fileprovider" - resValue "string", "app_name", "Habitica Debug" - } - release { - signingConfig signingConfigs.release - debuggable false - multiDexEnabled true - resValue "string", "content_provider", "com.habitrpg.android.habitica.fileprovider" - resValue "string", "app_name", "Habitica" - } - } - - flavorDimensions "default" - productFlavors { - dev { - } - - prod { - } - - amazon { - buildConfigField "String", "STORE", "\"amazon\"" - } - } - - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = ['src/main/java'] - resources.srcDirs = ['src/main/java'] - aidl.srcDirs = ['src/main/java'] - renderscript.srcDirs = ['src/main/java'] - res.srcDirs = ['res'] - assets.srcDirs = ['assets'] - } - robolectric { - manifest.srcFile 'AndroidManifestTesting.xml' - java.srcDir file('src/test/java/') - res.srcDirs = ['res'] - } - instrumentTest.setRoot('tests') - release { java.srcDirs = ['src/release/java'] } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - dexOptions { - preDexLibraries false - javaMaxHeapSize "6g" // Use gig increments depending on needs - } - - lintOptions { - disable 'UnusedResources','MissingTranslation','UnusedAttribute','InvalidPackage' - enable 'LogConditional','IconExpectedSize','MissingRegistered','TypographyQuotes' - } - - dataBinding { - enabled = true - } -} - -Properties props = new Properties() -def propFile = new File('signingrelease.properties') -if (propFile.canRead()) { - props.load(new FileInputStream(propFile)) - - if (props != null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') && - props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) { - android.signingConfigs.release.storeFile = file(props['STORE_FILE']) - android.signingConfigs.release.storePassword = props['STORE_PASSWORD'] - android.signingConfigs.release.keyAlias = props['KEY_ALIAS'] - android.signingConfigs.release.keyPassword = props['KEY_PASSWORD'] - } else { - println 'signing.properties found but some entries are missing' - android.buildTypes.release.signingConfig = null - } -} else { - println 'signing.properties not found' - android.buildTypes.release.signingConfig = null -} - -// Add Habitica Properties to buildConfigField -final File HRPG_PROPS_FILE = new File('habitica.properties') -if (HRPG_PROPS_FILE.canRead()) { - def Properties HRPG_PROPS = new Properties() - HRPG_PROPS.load(new FileInputStream(HRPG_PROPS_FILE)) - - if (HRPG_PROPS != null) { - android.buildTypes.all { buildType -> - HRPG_PROPS.any { property -> - buildType.buildConfigField "String", property.key, "\"${property.value}\"" - } - } - } else { - throw new InvalidUserDataException('habitica.properties found but some entries are missing') - } -} else { - throw new MissingResourceException('habitica.properties not found') -} - -// Add Habitica Resources to resources -final File HRPG_RES_FILE = new File('habitica.resources') -if (HRPG_RES_FILE.canRead()) { - def Properties HRPG_RES = new Properties() - HRPG_RES.load(new FileInputStream(HRPG_RES_FILE)) - - if (HRPG_RES != null) { - android.buildTypes.all { buildType -> - HRPG_RES.any { property -> - buildType.resValue "string", property.key, "\"${property.value}\"" - } - } - } else { - throw new InvalidUserDataException('habitica.resources found but some entries are missing') - } -} else { - throw new MissingResourceException('habitica.resources not found') -} - -tasks.whenTaskAdded { task -> - if (task.name == "lint") { - task.enabled = false - } -} - -check { findbugs { skip true } } - -apply plugin: 'com.android.application' //or apply plugin: 'java' -apply plugin: 'com.google.gms.google-services' \ No newline at end of file +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' +apply plugin: 'com.android.databinding' +apply plugin: 'io.fabric' +apply plugin: 'com.neenbedankt.android-apt' +apply plugin: 'com.noveogroup.android.check' +apply plugin: 'realm-android' + +buildscript { + repositories { + mavenLocal() + mavenCentral() + maven { url 'https://maven.fabric.io/public' } + jcenter() + } + dependencies { + classpath 'io.fabric.tools:gradle:1.21.6' + classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' + classpath('com.noveogroup.android:check:1.2.3') { + exclude module: 'checkstyle' + exclude module: 'pmd-java' + } + classpath 'com.puppycrawl.tools:checkstyle:7.5' + classpath 'net.sourceforge.pmd:pmd-java:5.5.3' + } +} + +repositories { + mavenLocal() + mavenCentral() + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } + maven { url 'https://maven.fabric.io/public' } + + // Material View Pager + maven { url "http://dl.bintray.com/florent37/maven" } + + // Markdown + maven { url "https://s3.amazonaws.com/repo.commonsware.com" } + + maven { url "https://jitpack.io" } + + maven { url "https://maven.google.com" } +} + +dependencies { + compile fileTree(include: ['*.jar'], dir: 'libs') + //Networking + compile 'com.squareup.okhttp3:okhttp:3.9.0' + compile 'com.squareup.okhttp3:logging-interceptor:3.9.0' + //REST API handling + compile('com.squareup.retrofit2:retrofit:2.3.0') { + exclude module: 'okhttp' + } + compile 'com.squareup.retrofit2:converter-gson:2.3.0' + compile 'com.squareup.retrofit2:adapter-rxjava:2.3.0' + //Crash Logging + releaseCompile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { + transitive = true; + } + // View Elements Binding :) + compile 'com.jakewharton:butterknife:8.8.1' + apt 'com.jakewharton:butterknife-compiler:8.8.1' + //Dependency Injection + compile 'com.google.dagger:dagger:2.11' + apt 'com.google.dagger:dagger-compiler:2.11' + provided 'org.glassfish:javax.annotation:10.0-b28' + //App Compatibility and Material Design + compile('com.mikepenz:materialdrawer:5.8.3@aar') { + transitive = true + } + compile 'com.android.support:appcompat-v7:26.1.0' + compile 'com.android.support:design:26.1.0' + compile 'com.android.support:recyclerview-v7:26.1.0' + compile 'com.android.support:preference-v14:26.1.0' + //QR Code + compile 'com.github.kenglxn.QRGen:android:2.2.0' + // Emojis + compile 'com.github.viirus:emoji-lib:0.0.5' + // Markdown + compile 'com.commonsware.cwac:anddown:0.4.0' + // About View for all dependent Libraries, we are using + compile('com.mikepenz:aboutlibraries:5.9.4@aar') { + transitive = true + } + // a better fab alternative + compile 'com.github.clans:fab:1.6.4' + //Eventbus + compile 'org.greenrobot:eventbus:3.0.0' + // IAP Handling / Verification + compile 'org.solovyev.android:checkout:1.0.1' + //Facebook + compile('com.facebook.android:facebook-android-sdk:4.19.0') { + transitive = true + } + compile 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar' + // lodash/underscore + compile 'com.github.javadev:underscore:1.23' + //RxJava + compile 'io.reactivex:rxandroid:1.2.1' + compile 'io.reactivex:rxjava:1.3.2' + //Analytics + compile 'com.amplitude:android-sdk:2.14.1' + // Fresco Image Management Library + compile('com.facebook.fresco:fresco:1.5.0') { + exclude module: 'bolts-android' + } + compile('com.facebook.fresco:animated-gif:1.5.0') { + exclude module: 'bolts-android' + } + //Tests + testCompile 'junit:junit:4.10' + testCompile 'org.assertj:assertj-core:1.7.0' + testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1' + testCompile 'org.robolectric:robolectric:3.3.2' + testCompile 'org.robolectric:shadows-multidex:3.3.2' + testCompile 'org.robolectric:shadows-support-v4:3.3.2' + testCompile 'org.mockito:mockito-core:2.8.9' + testCompile 'org.powermock:powermock-api-mockito2:1.7.0' + testCompile 'org.powermock:powermock-module-junit4-rule-agent:1.7.0' + testCompile 'org.powermock:powermock-module-junit4-rule:1.7.0' + testCompile 'org.powermock:powermock-module-junit4:1.7.0' + //Leak Detection + debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1' + releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1' + //Push Notifications + compile 'com.google.firebase:firebase-core:11.4.0' + compile 'com.google.firebase:firebase-messaging:11.4.0' + compile 'com.google.android.gms:play-services-auth:11.4.0' + compile 'org.apmem.tools:layouts:1.10@aar' + compile 'com.roughike:bottom-bar:2.3.1' + compile 'io.realm:android-adapters:2.1.0' + compile(project(':seeds-sdk')) { + exclude group: 'com.google.android.gms' + exclude group: 'com.android.support', module: 'multidex' + } + compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" +} + +android { + compileSdkVersion 26 + buildToolsVersion "26.0.1" + + defaultConfig { + applicationId "com.habitrpg.android.habitica" + vectorDrawables.useSupportLibrary = true + buildConfigField "String", "STORE", "\"google\"" + } + + lintOptions { + abortOnError false + } + signingConfigs { + release + } + + buildTypes { + debug { + applicationIdSuffix ".debug" + debuggable true + multiDexEnabled true + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + // Disable fabric build ID generation for debug builds + ext.enableCrashlytics = false + ext.alwaysUpdateBuildId = false + resValue "string", "content_provider", "com.habitrpg.android.habitica.debug.fileprovider" + resValue "string", "app_name", "Habitica Debug" + } + release { + signingConfig signingConfigs.release + debuggable false + multiDexEnabled false + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + resValue "string", "content_provider", "com.habitrpg.android.habitica.fileprovider" + resValue "string", "app_name", "Habitica" + } + } + + productFlavors { + dev { + minSdkVersion 21 + } + + prod { + } + + amazon { + buildConfigField "String", "STORE", "\"amazon\"" + } + } + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src/main/java'] + resources.srcDirs = ['src/main/java'] + aidl.srcDirs = ['src/main/java'] + renderscript.srcDirs = ['src/main/java'] + res.srcDirs = ['res'] + assets.srcDirs = ['assets'] + } + robolectric { + manifest.srcFile 'AndroidManifestTesting.xml' + java.srcDir file('src/test/java/') + res.srcDirs = ['res'] + } + instrumentTest.setRoot('tests') + release { java.srcDirs = ['src/release/java'] } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + dexOptions { + preDexLibraries false + javaMaxHeapSize "6g" // Use gig increments depending on needs + } + + lintOptions { + disable 'MissingTranslation','InvalidPackage' + enable 'LogConditional','IconExpectedSize','MissingRegistered','TypographyQuotes' + } + + splits { + abi { + enable true + reset() + include 'armeabi-v7a', 'arm64-v8a', 'mips', 'x86', 'x86_64' + universalApk true + } + } +} + +def Properties props = new Properties() +def propFile = new File('signingrelease.properties') +if (propFile.canRead()) { + props.load(new FileInputStream(propFile)) + + if (props != null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') && + props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) { + android.signingConfigs.release.storeFile = file(props['STORE_FILE']) + android.signingConfigs.release.storePassword = props['STORE_PASSWORD'] + android.signingConfigs.release.keyAlias = props['KEY_ALIAS'] + android.signingConfigs.release.keyPassword = props['KEY_PASSWORD'] + } else { + println 'signing.properties found but some entries are missing' + android.buildTypes.release.signingConfig = null + } +} else { + println 'signing.properties not found' + android.buildTypes.release.signingConfig = null +} + +// Add Habitica Properties to buildConfigField +final File HRPG_PROPS_FILE = new File('habitica.properties') +if (HRPG_PROPS_FILE.canRead()) { + def Properties HRPG_PROPS = new Properties() + HRPG_PROPS.load(new FileInputStream(HRPG_PROPS_FILE)) + + if (HRPG_PROPS != null) { + android.buildTypes.all { buildType -> + HRPG_PROPS.any { property -> + buildType.buildConfigField "String", property.key, "\"${property.value}\"" + } + } + } else { + throw new InvalidUserDataException('habitica.properties found but some entries are missing') + } +} else { + throw new MissingResourceException('habitica.properties not found') +} + +// Add Habitica Resources to resources +final File HRPG_RES_FILE = new File('habitica.resources') +if (HRPG_RES_FILE.canRead()) { + def Properties HRPG_RES = new Properties() + HRPG_RES.load(new FileInputStream(HRPG_RES_FILE)) + + if (HRPG_RES != null) { + android.buildTypes.all { buildType -> + HRPG_RES.any { property -> + buildType.resValue "string", property.key, "\"${property.value}\"" + } + } + } else { + throw new InvalidUserDataException('habitica.resources found but some entries are missing') + } +} else { + throw new MissingResourceException('habitica.resources not found') +} + +tasks.whenTaskAdded { task -> + if (task.name == "lint") { + task.enabled = false + } +} + +check { findbugs { skip true } } + +apply plugin: 'com.android.application' //or apply plugin: 'java' +apply plugin: 'me.tatarka.retrolambda' +apply plugin: 'com.google.gms.google-services' diff --git a/Habitica/res/menu/menu_task_form.xml b/Habitica/res/menu/menu_save.xml similarity index 100% rename from Habitica/res/menu/menu_task_form.xml rename to Habitica/res/menu/menu_save.xml diff --git a/build.gradle b/build.gradle index 5ef3a0842..c73556b04 100644 --- a/build.gradle +++ b/build.gradle @@ -1,19 +1,39 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { + ext.kotlin_version = '1.1.51' repositories { jcenter() - google() + maven { url "https://plugins.gradle.org/m2/" } } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0-alpha3' + classpath 'com.android.tools.build:gradle:2.3.3' + classpath 'com.android.databinding:dataBinder:1.0-rc4' + classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'com.google.gms:google-services:3.0.0' + classpath 'me.tatarka:gradle-retrolambda:3.3.1' + classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2' + classpath "io.realm:realm-gradle-plugin:3.7.2" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.0.RC4-3" } + + // Exclude the version that the android plugin depends on. + configurations.classpath.exclude group: 'com.android.tools.external.lombok' } +apply plugin: 'io.gitlab.arturbosch.detekt' + allprojects { repositories { jcenter() - google() + } +} + +detekt { + profile("main") { + input = "$projectDir/Habitica/src/main/java" + config = "$projectDir/detekt.yml" + output = "$projectDir/reports/detekt" } } \ No newline at end of file diff --git a/detekt.yml b/detekt.yml new file mode 100644 index 000000000..1e4a90556 --- /dev/null +++ b/detekt.yml @@ -0,0 +1,325 @@ +autoCorrect: true +failFast: false + +build: + warningThreshold: 5 + failThreshold: 10 + weights: + complexity: 2 + formatting: 1 + LongParameterList: 1 + comments: 1 + +processors: + active: true + exclude: + # - 'FunctionCountProcessor' + # - 'PropertyCountProcessor' + # - 'ClassCountProcessor' + # - 'PackageCountProcessor' + # - 'KtFileCountProcessor' + +console-reports: + active: true + exclude: + # - 'ProjectStatisticsReport' + # - 'ComplexityReport' + # - 'NotificationReport' + # - 'FindingsReport' + # - 'BuildFailureReport' + +output-reports: + active: true + exclude: + # - 'PlainOutputReport' + # - 'XmlOutputReport' + +potential-bugs: + active: true + DuplicateCaseInWhenExpression: + active: true + EqualsAlwaysReturnsTrueOrFalse: + active: false + EqualsWithHashCodeExist: + active: true + WrongEqualsTypeParameter: + active: false + ExplicitGarbageCollectionCall: + active: true + UnreachableCode: + active: true + LateinitUsage: + active: false + UnsafeCallOnNullableType: + active: true + UnsafeCast: + active: true + UselessPostfixExpression: + active: false + +performance: + active: true + ForEachOnRange: + active: true + SpreadOperator: + active: true + UnnecessaryTemporaryInstantiation: + active: true + +exceptions: + active: true + ExceptionRaisedInUnexpectedLocation: + active: false + methodNames: 'toString,hashCode,equals,finalize' + SwallowedException: + active: false + TooGenericExceptionCaught: + active: true + exceptions: + - ArrayIndexOutOfBoundsException + - Error + - Exception + - IllegalMonitorStateException + - IndexOutOfBoundsException + - InterruptedException + - NullPointerException + - RuntimeException + TooGenericExceptionThrown: + active: true + exceptions: + - Throwable + - ThrowError + - ThrowException + - ThrowNullPointerException + - ThrowRuntimeException + - ThrowThrowable + InstanceOfCheckForException: + active: false + IteratorNotThrowingNoSuchElementException: + active: false + PrintExceptionStackTrace: + active: false + RethrowCaughtException: + active: false + ReturnFromFinally: + active: false + ThrowingExceptionFromFinally: + active: false + ThrowingExceptionInMain: + active: false + ThrowingNewInstanceOfSameException: + active: false + +empty-blocks: + active: true + EmptyCatchBlock: + active: true + EmptyClassBlock: + active: true + EmptyDefaultConstructor: + active: true + EmptyDoWhileBlock: + active: true + EmptyElseBlock: + active: true + EmptyFinallyBlock: + active: true + EmptyForBlock: + active: true + EmptyFunctionBlock: + active: true + EmptyIfBlock: + active: true + EmptyInitBlock: + active: true + EmptySecondaryConstructor: + active: true + EmptyWhenBlock: + active: true + EmptyWhileBlock: + active: true + +complexity: + active: true + LongMethod: + threshold: 20 + LongParameterList: + threshold: 5 + LargeClass: + threshold: 150 + ComplexMethod: + threshold: 10 + TooManyFunctions: + threshold: 10 + ComplexCondition: + threshold: 3 + LabeledExpression: + active: false + StringLiteralDuplication: + active: true + threshold: 2 + ignoreAnnotation: true + excludeStringsWithLessThan5Characters: true + ignoreStringsRegex: '$^' + +code-smell: + active: true + FeatureEnvy: + threshold: 0.5 + weight: 0.45 + base: 0.5 + +formatting: + active: true + useTabs: true + Indentation: + active: false + indentSize: 4 + ConsecutiveBlankLines: + active: true + autoCorrect: true + MultipleSpaces: + active: true + autoCorrect: true + SpacingAfterComma: + active: true + autoCorrect: true + SpacingAfterKeyword: + active: true + autoCorrect: true + SpacingAroundColon: + active: true + autoCorrect: true + SpacingAroundCurlyBraces: + active: true + autoCorrect: true + SpacingAroundOperator: + active: true + autoCorrect: true + TrailingSpaces: + active: true + autoCorrect: true + UnusedImports: + active: true + autoCorrect: true + OptionalSemicolon: + active: true + autoCorrect: true + OptionalUnit: + active: true + autoCorrect: true + ExpressionBodySyntax: + active: false + autoCorrect: false + ExpressionBodySyntaxLineBreaks: + active: false + autoCorrect: false + OptionalReturnKeyword: + active: true + autoCorrect: false + +style: + active: true + ReturnCount: + active: true + max: 2 + NewLineAtEndOfFile: + active: false + OptionalAbstractKeyword: + active: true + OptionalWhenBraces: + active: false + EqualsNullCall: + active: true + ForbiddenComment: + active: true + values: 'TODO:,FIXME:,STOPSHIP:' + ForbiddenImport: + active: false + imports: '' + PackageDeclarationStyle: + active: false + ModifierOrder: + active: true + MagicNumber: + active: true + ignoreNumbers: '-1,0,1,2' + ignoreHashCodeFunction: false + ignorePropertyDeclaration: false + ignoreAnnotation: false + WildcardImport: + active: true + SafeCast: + active: true + MaxLineLength: + active: true + maxLineLength: 120 + excludePackageStatements: false + excludeImportStatements: false + PackageNaming: + active: true + packagePattern: '^[a-z]+(\.[a-z][a-z0-9]*)*$' + ClassNaming: + active: true + classPattern: '[A-Z$][a-zA-Z$]*' + EnumNaming: + active: true + enumEntryPattern: '^[A-Z$][a-zA-Z_$]*$' + FunctionNaming: + active: true + functionPattern: '^[a-z$][a-zA-Z$0-9]*$' + FunctionMaxLength: + active: true + maximumFunctionNameLength: 30 + FunctionMinLength: + active: true + minimumFunctionNameLength: 3 + VariableNaming: + active: true + variablePattern: '^(_)?[a-z$][a-zA-Z$0-9]*$' + ConstantNaming: + active: true + constantPattern: '^([A-Z_]*|serialVersionUID)$' + VariableMaxLength: + active: true + maximumVariableNameLength: 30 + VariableMinLength: + active: true + minimumVariableNameLength: 3 + ForbiddenClassName: + active: false + forbiddenName: '' + ProtectedMemberInFinalClass: + active: false + UnnecessaryParentheses: + active: false + DataClassContainsFunctions: + active: false + UseDataClass: + active: false + UnnecessaryAbstractClass: + active: false + +comments: + active: true + CommentOverPrivateMethod: + active: true + CommentOverPrivateProperty: + active: true + UndocumentedPublicClass: + active: false + searchInNestedClass: true + searchInInnerClass: true + searchInInnerObject: true + searchInInnerInterface: true + UndocumentedPublicFunction: + active: false + +# *experimental feature* +# Migration rules can be defined in the same config file or a new one +migration: + active: true + imports: + # your.package.Class: new.package.or.Class + # for example: + # io.gitlab.arturbosch.detekt.api.Rule: io.gitlab.arturbosch.detekt.rule.Rule