Revision control

Copy as Markdown

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'
build:
maxIssues: 0
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
InvalidLoopCondition:
active: false
WrongEqualsTypeParameter:
active: false
IteratorHasNextCallsNextMethod:
active: false
ExplicitGarbageCollectionCall:
active: true
UnconditionalJumpStatementInLoop:
active: false
IteratorNotThrowingNoSuchElementException:
active: false
UnreachableCode:
active: true
LateinitUsage:
active: false
excludeAnnotatedProperties: ''
ignoreOnClassesPattern: ''
UnsafeCallOnNullableType:
active: false
UnsafeCast:
active: false
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
- Throwable
TooGenericExceptionThrown:
active: true
exceptions:
- Error
- Exception
- NullPointerException
- RuntimeException
- Throwable
InstanceOfCheckForException:
active: false
NotImplementedDeclaration:
active: false
ThrowingExceptionsWithoutMessageOrCause:
active: false
exceptions: 'IllegalArgumentException,IllegalStateException,IOException'
PrintStackTrace:
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
EmptyKtFile:
active: true
EmptySecondaryConstructor:
active: true
EmptyWhenBlock:
active: true
EmptyWhileBlock:
active: true
complexity:
active: true
LongMethod:
active: true
threshold: 20
NestedBlockDepth:
active: true
threshold: 4
LongParameterList:
active: true
threshold: 10
LargeClass:
active: true
threshold: 150
ComplexInterface:
active: false
threshold: 10
includeStaticDeclarations: false
ComplexMethod:
active: false
threshold: 10
MethodOverloading:
active: false
threshold: 5
TooManyFunctions:
active: false
thresholdInFiles: 10
thresholdInClasses: 10
thresholdInInterfaces: 10
thresholdInObjects: 10
thresholdInEnums: 10
ComplexCondition:
active: false
threshold: 3
LabeledExpression:
active: false
StringLiteralDuplication:
active: false
threshold: 2
ignoreAnnotation: true
excludeStringsWithLessThan5Characters: true
ignoreStringsRegex: '$^'
code-smell:
active: true
FeatureEnvy:
threshold: 0.5
weight: 0.45
base: 0.5
style:
active: true
ReturnCount:
active: false
max: 3
ThrowsCount:
active: true
max: 2
NewLineAtEndOfFile:
active: true
OptionalAbstractKeyword:
active: true
OptionalWhenBraces:
active: false
CollapsibleIfStatements:
active: false
EqualsNullCall:
active: false
ForbiddenComment:
active: false
values: 'TODO:,FIXME:,STOPSHIP:'
ForbiddenImport:
active: false
imports: ''
SpacingBetweenPackageAndImports:
active: false
LoopWithTooManyJumpStatements:
active: false
maxJumpCount: 1
MethodNameEqualsClassName:
active: false
ignoreOverriddenFunction: true
ModifierOrder:
active: true
MagicNumber:
active: false # Has more false positives than value
ignoreNumbers: '-1,0,1,2'
ignoreHashCodeFunction: false
ignorePropertyDeclaration: false
ignoreConstantDeclaration: true
ignoreCompanionObjectPropertyDeclaration: true
ignoreAnnotation: false
ignoreNamedArgument: true
ignoreEnums: false
WildcardImport:
active: false // ktlint checks for this
excludeImports: 'java.util.*,kotlinx.android.synthetic.*'
SafeCast:
active: true
MaxLineLength:
active: true
maxLineLength: 140
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: false
maximumFunctionNameLength: 30
FunctionMinLength:
active: false
minimumFunctionNameLength: 3
VariableNaming:
active: true
variablePattern: '^(_)?[a-z$][a-zA-Z$0-9]*$'
ConstantNaming:
active: true
constantPattern: '^([A-Z_]*|serialVersionUID)$'
VariableMaxLength:
active: false
maximumVariableNameLength: 30
VariableMinLength:
active: false
minimumVariableNameLength: 3
ForbiddenClassName:
active: false
forbiddenName: ''
ProtectedMemberInFinalClass:
active: false
SerialVersionUIDInSerializableClass:
active: false
UnnecessaryParentheses:
active: false
UnnecessaryInheritance:
active: false
UtilityClassWithPublicConstructor:
active: false
DataClassContainsFunctions:
active: false
conversionFunctionPrefix: 'to'
UseDataClass:
active: false
UnnecessaryAbstractClass:
active: false
OptionalUnit:
active: false
OptionalReturnKeyword:
active: false
ExpressionBodySyntax:
active: false
UnusedImports:
active: false
NestedClassesVisibility:
active: false
RedundantVisibilityModifierRule:
active: false
FunctionOnlyReturningConstant:
active: false
ignoreOverridableFunction: true
excludedFunctions: 'describeContents'
comments:
active: true
CommentOverPrivateFunction:
active: false
CommentOverPrivateProperty:
active: false
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