mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-21 13:19:02 +00:00
add kotlin to project
This commit is contained in:
parent
12b2462819
commit
591fff8aa9
4 changed files with 342 additions and 0 deletions
|
|
@ -1,4 +1,6 @@
|
|||
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'
|
||||
|
|
@ -132,6 +134,7 @@ dependencies {
|
|||
exclude group: 'com.google.android.gms'
|
||||
exclude group: 'com.android.support', module: 'multidex'
|
||||
}
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
|
|||
14
build.gradle
14
build.gradle
|
|
@ -1,8 +1,10 @@
|
|||
// 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()
|
||||
maven { url "https://plugins.gradle.org/m2/" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
|
|
@ -12,14 +14,26 @@ buildscript {
|
|||
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()
|
||||
}
|
||||
}
|
||||
|
||||
detekt {
|
||||
profile("main") {
|
||||
input = "$projectDir/Habitica/src/main/java"
|
||||
config = "$projectDir/detekt.yml"
|
||||
output = "$projectDir/reports/detekt"
|
||||
}
|
||||
}
|
||||
325
detekt.yml
Normal file
325
detekt.yml
Normal file
|
|
@ -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
|
||||
Loading…
Reference in a new issue