From c84cc831e8b8d6894ec59dfd1c9a5ec4f28871c2 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Tue, 6 Jun 2023 11:58:39 +0300 Subject: [PATCH] detektAll --- .../org/cqfn/diktat/plugin/maven/DiktatBaseMojo.kt | 10 ---------- .../cqfn/diktat/ruleset/rules/chapter3/LineLength.kt | 11 ----------- .../chapter4/VariableGenericTypeDeclarationRule.kt | 1 + .../org/cqfn/diktat/test/framework/util/TestUtils.kt | 3 ++- 4 files changed, 3 insertions(+), 22 deletions(-) diff --git a/diktat-maven-plugin/src/main/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojo.kt b/diktat-maven-plugin/src/main/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojo.kt index cda1c28e10..f7c125603d 100644 --- a/diktat-maven-plugin/src/main/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojo.kt +++ b/diktat-maven-plugin/src/main/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojo.kt @@ -8,7 +8,6 @@ import org.cqfn.diktat.ktlint.DiktatProcessorFactoryImpl import org.cqfn.diktat.ktlint.DiktatReporterFactoryImpl import org.cqfn.diktat.ruleset.rules.DiktatRuleSetFactoryImpl -import org.apache.maven.execution.MavenSession import org.apache.maven.plugin.AbstractMojo import org.apache.maven.plugin.Mojo import org.apache.maven.plugin.MojoExecutionException @@ -25,12 +24,6 @@ import kotlin.io.path.Path * Base [Mojo] for checking and fixing code using diktat */ abstract class DiktatBaseMojo : AbstractMojo() { - /** - * Flag that indicates whether to turn debug logging on - */ - @Parameter(property = "diktat.debug") - var debug = false - /** * Property that will be used if you need to publish the report to GitHub */ @@ -82,9 +75,6 @@ abstract class DiktatBaseMojo : AbstractMojo() { @Parameter(property = "diktat.excludes", defaultValue = "") lateinit var excludes: List - @Parameter(defaultValue = "\${session}", readonly = true) - private lateinit var mavenSession: MavenSession - /** * @param runner instance of [DiktatRunner] used in analysis * @param args arguments for [DiktatRunner] diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt index e0e7fa3073..ac4301c9b3 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/LineLength.kt @@ -774,19 +774,8 @@ class LineLength(configRules: List) : DiktatRule( } } - /** - * val text = "first part" + - * "second part" + - * "third part" - * STRING_PART_OFFSET equal to the left offset of first string part("first part") = - * white space + close quote (open quote removed by trim) + white space + plus sign - */ companion object { private const val MAX_LENGTH = 120L const val NAME_ID = "line-length" - private const val STRING_PART_OFFSET = 4 - private val propertyList = listOf(INTEGER_CONSTANT, LITERAL_STRING_TEMPLATE_ENTRY, FLOAT_CONSTANT, - CHARACTER_CONSTANT, REFERENCE_EXPRESSION, BOOLEAN_CONSTANT, LONG_STRING_TEMPLATE_ENTRY, - SHORT_STRING_TEMPLATE_ENTRY, NULL) } } diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter4/VariableGenericTypeDeclarationRule.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter4/VariableGenericTypeDeclarationRule.kt index 8076fc7715..9338c73b29 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter4/VariableGenericTypeDeclarationRule.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter4/VariableGenericTypeDeclarationRule.kt @@ -20,6 +20,7 @@ import org.jetbrains.kotlin.psi.KtProperty * Not recommended: val myVariable: Map = emptyMap() or val myVariable = emptyMap() * Recommended: val myVariable: Map = emptyMap() */ +@Suppress("ForbiddenComment") // FIXME: we now don't have access to return types, so we can perform this check only if explicit type is present, but should be able also if it's not. class VariableGenericTypeDeclarationRule(configRules: List) : DiktatRule( NAME_ID, diff --git a/diktat-test-framework/src/main/kotlin/org/cqfn/diktat/test/framework/util/TestUtils.kt b/diktat-test-framework/src/main/kotlin/org/cqfn/diktat/test/framework/util/TestUtils.kt index bda46c5714..6a90ac171f 100644 --- a/diktat-test-framework/src/main/kotlin/org/cqfn/diktat/test/framework/util/TestUtils.kt +++ b/diktat-test-framework/src/main/kotlin/org/cqfn/diktat/test/framework/util/TestUtils.kt @@ -315,7 +315,7 @@ fun retry( var lastError: Throwable? = null - for (i in 1..attempts) { + repeat(attempts) { try { return block() } catch (error: Throwable) { @@ -323,6 +323,7 @@ fun retry( } if (delayMillis > 0L) { + @Suppress("SleepInsteadOfDelay") Thread.sleep(delayMillis) } }