Skip to content

Commit

Permalink
fix detekt rules
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentlauvlwj committed Aug 22, 2023
1 parent 24c03d0 commit f609d95
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/ktorm.base.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ dependencies {
}

detekt {
source.from("src/main/kotlin")
config.from("${project.rootDir}/detekt.yml")
source.setFrom("src/main/kotlin")
config.setFrom("${project.rootDir}/detekt.yml")
}

java {
Expand Down
42 changes: 20 additions & 22 deletions detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ complexity:
active: true
threshold: 12
includeStaticDeclarations: false
ComplexMethod:
CyclomaticComplexMethod:
active: true
threshold: 20
ignoreSingleWhenExpression: true
ignoreSimpleWhenEntries: true
LabeledExpression:
active: true
ignoredLabels: ""
ignoredLabels: []
LargeClass:
active: true
threshold: 600
Expand Down Expand Up @@ -131,7 +131,7 @@ exceptions:
active: true
ExceptionRaisedInUnexpectedLocation:
active: true
methodNames: 'toString,hashCode,equals,finalize'
methodNames: ['toString', 'hashCode', 'equals', 'finalize']
InstanceOfCheckForException:
active: true
NotImplementedDeclaration:
Expand All @@ -144,14 +144,14 @@ exceptions:
active: true
SwallowedException:
active: true
ignoredExceptionTypes: 'InterruptedException,NumberFormatException,ParseException,MalformedURLException'
ignoredExceptionTypes: ['InterruptedException', 'NumberFormatException', 'ParseException', 'MalformedURLException']
ThrowingExceptionFromFinally:
active: true
ThrowingExceptionInMain:
active: true
ThrowingExceptionsWithoutMessageOrCause:
active: true
exceptions: 'IllegalArgumentException,IllegalStateException,IOException'
exceptions: ['IllegalArgumentException', 'IllegalStateException', 'IOException']
ThrowingNewInstanceOfSameException:
active: true
TooGenericExceptionCaught:
Expand Down Expand Up @@ -195,7 +195,6 @@ formatting:
active: true
autoCorrect: false
indentSize: 4
continuationIndentSize: 4
MaximumLineLength:
active: false
maxLineLength: 120
Expand Down Expand Up @@ -284,7 +283,7 @@ naming:
enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*'
ForbiddenClassName:
active: false
forbiddenName: ''
forbiddenName: []
FunctionMaxLength:
active: true
maximumFunctionNameLength: 64
Expand All @@ -295,12 +294,10 @@ naming:
active: true
functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
excludeClassPattern: '$^'
ignoreOverridden: true
FunctionParameterNaming:
active: true
parameterPattern: '[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true
MatchingDeclarationName:
active: true
MemberNameEqualsClassName:
Expand Down Expand Up @@ -330,7 +327,6 @@ naming:
variablePattern: '[a-z][A-Za-z0-9]*'
privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true

performance:
active: true
Expand All @@ -345,8 +341,6 @@ performance:

potential-bugs:
active: true
DuplicateCaseInWhenExpression:
active: true
EqualsAlwaysReturnsTrueOrFalse:
active: true
EqualsWithHashCodeExist:
Expand Down Expand Up @@ -382,7 +376,7 @@ style:
active: true
DataClassContainsFunctions:
active: false
conversionFunctionPrefix: 'as'
conversionFunctionPrefix: ['as']
EqualsNullCall:
active: true
EqualsOnSignatureLine:
Expand All @@ -394,31 +388,33 @@ style:
includeLineWrapping: false
ForbiddenComment:
active: true
values: 'TODO:,FIXME:,STOPSHIP:'
comments: ['FIXME:', 'STOPSHIP:', 'TODO:']
ForbiddenImport:
active: false
imports: ''
imports: []
ForbiddenVoid:
active: true
FunctionOnlyReturningConstant:
active: true
ignoreOverridableFunction: true
excludedFunctions: 'describeContents'
excludedFunctions: ['describeContents']
LoopWithTooManyJumpStatements:
active: true
maxJumpCount: 2
MagicNumber:
active: true
ignoreNumbers: '-1,0,1,2,3,60'
ignoreNumbers: ['-1', '0', '1', '2', '3', '60']
ignoreHashCodeFunction: true
ignorePropertyDeclaration: false
ignoreConstantDeclaration: true
ignoreCompanionObjectPropertyDeclaration: true
ignoreAnnotation: false
ignoreNamedArgument: true
ignoreEnums: false
MandatoryBracesIfStatements:
BracesOnIfStatements:
active: true
singleLine: 'never'
multiLine: 'always'
MaxLineLength:
active: true
maxLineLength: 120
Expand All @@ -439,8 +435,10 @@ style:
active: true
OptionalUnit:
active: true
OptionalWhenBraces:
active: false
BracesOnWhenStatements:
active: true
singleLine: 'never'
multiLine: 'consistent'
PreferToOverPairSyntax:
active: false
ProtectedMemberInFinalClass:
Expand All @@ -450,7 +448,7 @@ style:
ReturnCount:
active: false
max: 2
excludedFunctions: "equals"
excludedFunctions: ["equals"]
excludeLabeled: false
excludeReturnFromLambda: true
SafeCast:
Expand Down Expand Up @@ -496,4 +494,4 @@ style:
active: true
WildcardImport:
active: false
excludeImports: 'java.util.*,kotlinx.android.synthetic.*'
excludeImports: ['java.util.*', 'kotlinx.android.synthetic.*']

0 comments on commit f609d95

Please sign in to comment.