Skip to content

Commit d9dc87c

Browse files
fix #94: detekt fixes
1 parent 4feeab0 commit d9dc87c

File tree

7 files changed

+25
-22
lines changed

7 files changed

+25
-22
lines changed

config/detekt/detekt.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
complexity:
22
CognitiveComplexMethod:
33
active: true
4-
threshold: 15
4+
allowedComplexity: 15
55
ComplexCondition:
66
active: true
7-
threshold: 4
7+
allowedConditions: 4
88
NestedScopeFunctions:
99
active: true
10-
threshold: 1
10+
allowedDepth: 1
1111
functions:
1212
- 'kotlin.apply'
1313
- 'kotlin.run'
@@ -16,11 +16,14 @@ complexity:
1616
- 'kotlin.also'
1717
LongParameterList:
1818
active: true
19-
functionThreshold: 6
20-
constructorThreshold: 10
19+
allowedFunctionParameters: 6
20+
allowedConstructorParameters: 10
2121
ignoreDefaultParameters: true
2222
ignoreDataClasses: true
2323
ignoreAnnotatedParameter: [ Column ]
24+
LargeClass:
25+
active: true
26+
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**' ]
2427

2528
exceptions:
2629
NotImplementedDeclaration:
@@ -40,9 +43,6 @@ naming:
4043
BooleanPropertyNaming:
4144
active: true
4245
allowedPattern: '^(is|has|are)'
43-
FunctionMinLength:
44-
active: true
45-
minimumFunctionNameLength: 2
4646
NonBooleanPropertyPrefixedWithIs:
4747
active: true
4848

@@ -100,17 +100,18 @@ style:
100100
allowedPatterns: ''
101101
NewLineAtEndOfFile:
102102
active: false
103-
SpacingBetweenPackageAndImports:
104-
active: true
105103
TrailingWhitespace:
106104
active: true
107-
UnusedImports:
105+
UnusedImport:
108106
active: true
107+
additionalOperatorSet: []
109108
ReturnCount:
110109
active: true
111110
max: 3
112111
excludedFunctions:
113112
- 'equals'
114113
excludeLabeled: false
115114
excludeReturnFromLambda: true
116-
excludeGuardClauses: true
115+
excludeGuardClauses: true
116+
WildcardImport:
117+
active: true

src/main/kotlin/br/com/webbudget/domain/services/financial/RecurringMovementService.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ class RecurringMovementService(
2626
val externalId = requireNotNull(recurringMovement.externalId) { EXTERNAL_ID_IS_NULL }
2727

2828
recurringMovementRepository.findByExternalIdAndState(externalId, ENDED)
29-
?.let { throw BusinessException("Recurring movement isn't active", "recurring-movement.errors.invalid-state") }
29+
?.let {
30+
throw BusinessException("Recurring movement isn't active", "recurring-movement.errors.invalid-state")
31+
}
3032

3133
return recurringMovementRepository.merge(recurringMovement)
3234
}

src/test/kotlin/br/com/webbudget/controllers/UserAccountControllerUTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class UserAccountControllerUTest : BaseControllerIntegrationTest() {
5959
content = body
6060
with(csrf())
6161
}.andExpect {
62-
status { isUnprocessableEntity() }
62+
status { isUnprocessableContent() }
6363
}
6464
}
6565

@@ -134,7 +134,7 @@ class UserAccountControllerUTest : BaseControllerIntegrationTest() {
134134
content = body
135135
with(csrf())
136136
}.andExpect {
137-
status { isUnprocessableEntity() }
137+
status { isUnprocessableContent() }
138138
}
139139
}
140140

@@ -177,7 +177,7 @@ class UserAccountControllerUTest : BaseControllerIntegrationTest() {
177177
content = body
178178
with(csrf())
179179
}.andExpect {
180-
status { isUnprocessableEntity() }
180+
status { isUnprocessableContent() }
181181
}
182182
}
183183

src/test/kotlin/br/com/webbudget/controllers/advice/ValidationExceptionController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ValidationExceptionController {
2929
throw MethodArgumentNotValidException(methodParameter, bindingResult)
3030
}
3131

32-
@Suppress("UnusedPrivateMember")
32+
@Suppress("UnusedPrivateMember", "UnusedParameter")
3333
fun theMethod(theParameter: String) {
3434
println("Dummy method")
3535
}

src/test/kotlin/br/com/webbudget/controllers/financial/PeriodMovementControllerUTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class PeriodMovementControllerUTest : BaseControllerIntegrationTest() {
206206
contentType = MediaType.APPLICATION_JSON
207207
content = JsonPayload("period-movement/unprocessable")
208208
}.andExpect {
209-
status { isUnprocessableEntity() }
209+
status { isUnprocessableContent() }
210210
}.andReturn()
211211
.response
212212
.contentAsString
@@ -236,7 +236,7 @@ class PeriodMovementControllerUTest : BaseControllerIntegrationTest() {
236236
contentType = MediaType.APPLICATION_JSON
237237
content = JsonPayload("period-movement/unprocessable")
238238
}.andExpect {
239-
status { isUnprocessableEntity() }
239+
status { isUnprocessableContent() }
240240
}.andReturn()
241241
.response
242242
.contentAsString

src/test/kotlin/br/com/webbudget/controllers/financial/RecurringMovementControllerUTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class RecurringMovementControllerUTest : BaseControllerIntegrationTest() {
189189
contentType = MediaType.APPLICATION_JSON
190190
content = JsonPayload("recurring-movement/unprocessable")
191191
}.andExpect {
192-
status { isUnprocessableEntity() }
192+
status { isUnprocessableContent() }
193193
}.andReturn()
194194
.response
195195
.contentAsString
@@ -218,7 +218,7 @@ class RecurringMovementControllerUTest : BaseControllerIntegrationTest() {
218218
contentType = MediaType.APPLICATION_JSON
219219
content = JsonPayload("recurring-movement/unprocessable")
220220
}.andExpect {
221-
status { isUnprocessableEntity() }
221+
status { isUnprocessableContent() }
222222
}.andReturn()
223223
.response
224224
.contentAsString

src/test/kotlin/br/com/webbudget/controllers/registration/ClassificationControllerUTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class ClassificationControllerUTest : BaseControllerIntegrationTest() {
9898
contentType = MediaType.APPLICATION_JSON
9999
content = JsonPayload("movement-class/invalid")
100100
}.andExpect {
101-
status { isUnprocessableEntity() }
101+
status { isUnprocessableContent() }
102102
}.andReturn()
103103
.response
104104
.contentAsString

0 commit comments

Comments
 (0)