Skip to content

Commit

Permalink
fixes detekt
Browse files Browse the repository at this point in the history
Signed-off-by: Allain Magyar <allain.magyar@iohk.io>
  • Loading branch information
amagyar-iohk committed Jun 27, 2024
1 parent 0b39188 commit d52884a
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 27 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
kotlin("jvm") version "1.8.21"
`java-library`
`maven-publish`
id("io.gitlab.arturbosch.detekt") version "1.23.0"
id("io.gitlab.arturbosch.detekt") version "1.23.6"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0-rc-1"
id("org.jetbrains.dokka") version "1.9.20"
signing
Expand Down
21 changes: 11 additions & 10 deletions detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ complexity:
threshold: 600
LongMethod:
active: true
threshold: 60
threshold: 120
LongParameterList:
active: true
functionThreshold: 6
Expand Down Expand Up @@ -167,11 +167,11 @@ complexity:
TooManyFunctions:
active: true
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**' ]
thresholdInFiles: 11
thresholdInClasses: 11
thresholdInInterfaces: 11
thresholdInObjects: 30
thresholdInEnums: 11
thresholdInFiles: 50
thresholdInClasses: 50
thresholdInInterfaces: 50
thresholdInObjects: 35
thresholdInEnums: 50
ignoreDeprecated: false
ignorePrivate: false
ignoreOverridden: false
Expand Down Expand Up @@ -215,8 +215,8 @@ empty-blocks:
EmptyForBlock:
active: true
EmptyFunctionBlock:
active: true
ignoreOverridden: false
active: false
ignoreOverridden: true
EmptyIfBlock:
active: true
EmptyInitBlock:
Expand Down Expand Up @@ -260,6 +260,7 @@ exceptions:
ignoredExceptionTypes:
- 'InterruptedException'
- 'MalformedURLException'
- 'JsonSyntaxException'
- 'NumberFormatException'
- 'ParseException'
- 'ConditionTimeoutException'
Expand Down Expand Up @@ -298,7 +299,7 @@ exceptions:
- 'Throwable'
allowedExceptionNameRegex: '_|(ignore|expected).*'
TooGenericExceptionThrown:
active: true
active: false
exceptionNames:
- 'Error'
- 'Exception'
Expand Down Expand Up @@ -633,7 +634,7 @@ style:
maxChainedCalls: 5
MaxLineLength:
active: true
maxLineLength: 120
maxLineLength: 140
excludePackageStatements: true
excludeImportStatements: true
excludeCommentStatements: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import net.thucydides.model.steps.StepFailure
import net.thucydides.model.steps.StepListener
import java.time.ZonedDateTime

class SerenityStepListener: StepListener {
class SerenityStepListener : StepListener {
data class Entry(
val keyword: String,
val stepText: String,
val arguments: List<String>,
val isSubStep: Boolean
)

companion object {
val stepList = mutableListOf<Entry>()
}
Expand All @@ -42,7 +43,13 @@ class SerenityStepListener: StepListener {
override fun skippedStepStarted(description: ExecutedStepDescription) {}
override fun stepFailed(failure: StepFailure) {}
override fun stepFailed(failure: StepFailure?, screenshotList: MutableList<ScreenshotAndHtmlSource>?, isInDataDrivenTest: Boolean) {}
override fun stepFailed(failure: StepFailure?, screenshotList: MutableList<ScreenshotAndHtmlSource>?, isInDataDrivenTest: Boolean, zonedDateTime: ZonedDateTime?) {}
override fun stepFailed(
failure: StepFailure?,
screenshotList: MutableList<ScreenshotAndHtmlSource>?,
isInDataDrivenTest: Boolean,
zonedDateTime: ZonedDateTime?
) {
}

override fun lastStepFailed(failure: StepFailure) {}
override fun stepIgnored() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ import kotlin.math.max
/**
* Adapted from PrettyFormatter to add messages from SerenityListener.
*
* @see
* <a href="https://github.com/cucumber/cucumber-jvm/blob/release/v7.17.0/cucumber-core/src/main/java/io/cucumber/core/plugin/PrettyFormatter.java">
* PrettyFormatter
* </a>
* Original source: [PrettyFormatter](https://github.com/cucumber/cucumber-jvm/blob/release/v7.17.0/cucumber-core/src/main/java/io/cucumber/core/plugin/PrettyFormatter.java)
*/

class SerenityWithCucumberFormatter(out: OutputStream?) : ConcurrentEventListener, ColorAware {
Expand Down Expand Up @@ -249,7 +246,7 @@ class SerenityWithCucumberFormatter(out: OutputStream?) : ConcurrentEventListene
return " "
}
val builder = StringBuilder(padding)
for (i in 0 until padding) {
repeat(padding) {
builder.append(" ")
}
return builder.toString()
Expand Down Expand Up @@ -304,10 +301,7 @@ class SerenityWithCucumberFormatter(out: OutputStream?) : ConcurrentEventListene
const val PLUGIN: String = "io.iohk.atala.automation.cucumber.plugins.SerenityWithCucumberFormatter"

fun relativize(uri: URI): URI {
if ("file" != uri.scheme) {
return uri
}
if (!uri.isAbsolute) {
if ("file" != uri.scheme || !uri.isAbsolute) {
return uri
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.iohk.atala.automation.serenity.ensure

import com.google.gson.Gson
import com.google.gson.JsonObject
import com.google.gson.JsonSyntaxException
import com.jayway.jsonpath.JsonPath
import io.iohk.atala.automation.restassured.CustomGsonObjectMapperFactory
import net.serenitybdd.annotations.Step
Expand Down Expand Up @@ -71,7 +72,7 @@ interface LastResponseInteraction: Interaction {
try {
gson.fromJson(json, A::class.java)
return true
} catch (e: Exception) {
} catch (e: JsonSyntaxException) {
return false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SerenityRestJson {
} else if (bodyJsonArray != null) {
this.body = bodyJsonArray!!
} else {
throw IllegalStateException("Response type is not JsonObject nor JsonArray")
error("Response type is not JsonObject nor JsonArray")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,19 @@ class Steps {
}

@When("some datatable")
fun someDataTable(dataTable: DataTable) {}
fun someDataTable(dataTable: DataTable) {
println(dataTable)
}

@When("some {}, {}, {} parameters")
fun someParameters(i1: Int, i2: Int, i3: Int) {}
fun someParameters(i1: Int, i2: Int, i3: Int) {
println("$i1, $i2, $i3")
}

@When("some {} example")
fun someExample(example: String) {}
fun someExample(example: String) {
println(example)
}

@Then("should pass")
fun shouldPass() {}
Expand Down

0 comments on commit d52884a

Please sign in to comment.