From a34c5136830c5aee40989aa8974234c07c7343d0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 22 Jun 2022 14:41:59 +0000 Subject: [PATCH] Update Ktlint to v0.46.1 (#1374) * Support ktlint v0.46.* (#1379) * enabled K2 compiler where it's require (after v0.46.0) * supported removed classes and fields Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .../common/config/rules/RulesConfigReader.kt | 7 ++ diktat-gradle-plugin/build.gradle.kts | 2 +- .../plugin/gradle/DiktatJavaExecTaskBase.kt | 2 +- .../plugin/gradle/DiktatJavaExecTaskTest.kt | 5 +- diktat-maven-plugin/pom.xml | 5 ++ .../diktat/plugin/maven/DiktatBaseMojo.kt | 23 +++--- .../cqfn/diktat/plugin/maven/DiktatMojo.kt | 5 +- .../maven/DiktatMavenPluginIntegrationTest.kt | 2 +- diktat-rules/pom.xml | 1 + .../ruleset/rules/DiktatRuleSetProvider.kt | 10 +-- .../cqfn/diktat/ruleset/utils/AstNodeUtils.kt | 11 ++- .../diktat/ruleset/utils/SequenceUtils.kt | 18 ----- .../chapter1/IdentifierNamingWarnTest.kt | 2 +- .../ruleset/chapter1/MethodNamingWarnTest.kt | 2 +- .../ruleset/chapter1/PackageNamingWarnTest.kt | 2 +- .../chapter2/CommentsFormattingTest.kt | 2 +- .../ruleset/chapter2/HeaderCommentRuleTest.kt | 6 +- .../ruleset/chapter2/KdocCommentsWarnTest.kt | 2 +- .../ruleset/chapter2/KdocFormattingTest.kt | 2 +- .../ruleset/chapter2/KdocMethodsTest.kt | 2 +- .../chapter2/KdocParamPresentWarnTest.kt | 2 +- .../chapter2/comments/CommentedCodeTest.kt | 2 +- .../chapter3/AnnotationNewLineRuleWarnTest.kt | 2 +- .../chapter3/BlockStructureBracesWarnTest.kt | 2 +- .../BooleanExpressionsRuleWarnTest.kt | 62 +++++++------- .../ruleset/chapter3/BracesRuleWarnTest.kt | 2 +- .../ClassLikeStructuresOrderRuleWarnTest.kt | 2 +- .../CollapseIfStatementsRuleWarnTest.kt | 36 ++++----- .../chapter3/ConsecutiveSpacesRuleWarnTest.kt | 2 +- .../chapter3/DebugPrintRuleWarnTest.kt | 2 +- .../ruleset/chapter3/EmptyBlockWarnTest.kt | 2 +- .../chapter3/EnumsSeparatedWarnTest.kt | 2 +- .../ruleset/chapter3/FileSizeWarnTest.kt | 2 +- .../ruleset/chapter3/FileStructureRuleTest.kt | 2 +- .../ruleset/chapter3/LineLengthWarnTest.kt | 2 +- .../chapter3/LocalVariablesWarnTest.kt | 2 +- .../LongNumericalValuesSeparatedWarnTest.kt | 2 +- .../chapter3/MagicNumberRuleWarnTest.kt | 2 +- .../MultipleModifiersSequenceWarnTest.kt | 2 +- .../chapter3/NullableTypeRuleWarnTest.kt | 2 +- .../chapter3/RangeConventionalRuleWarnTest.kt | 2 +- .../SingleLineStatementsRuleWarnTest.kt | 2 +- .../ruleset/chapter3/SortRuleWarnTest.kt | 2 +- .../chapter3/StringConcatenationWarnTest.kt | 2 +- .../chapter3/StringTemplateRuleWarnTest.kt | 2 +- .../ruleset/chapter3/TrailingCommaWarnTest.kt | 2 +- .../chapter3/WhenMustHaveElseWarnTest.kt | 2 +- .../chapter3/files/BlankLinesWarnTest.kt | 2 +- .../chapter3/files/NewlinesRuleWarnTest.kt | 80 +++++++++---------- .../files/TopLevelOrderRuleWarnTest.kt | 2 +- .../spaces/IndentationRuleWarnTest.kt | 2 +- .../chapter3/spaces/WhiteSpaceRuleWarnTest.kt | 2 +- .../chapter4/AccurateCalculationsWarnTest.kt | 2 +- .../ruleset/chapter4/NoVarRuleWarnTest.kt | 2 +- .../chapter4/NullChecksRuleWarnTest.kt | 2 +- .../ruleset/chapter4/SmartCastRuleWarnTest.kt | 2 +- .../ruleset/chapter4/TypeAliasRuleWarnTest.kt | 2 +- ...iableGenericTypeDeclarationRuleWarnTest.kt | 2 +- .../ruleset/chapter5/AsyncAndSyncRuleTest.kt | 8 +- .../chapter5/AvoidNestedFunctionsWarnTest.kt | 2 +- .../CheckInverseMethodRuleWarnTest.kt | 10 +-- .../ruleset/chapter5/CustomLabelsTest.kt | 6 +- .../chapter5/FunctionArgumentsSizeWarnTest.kt | 2 +- .../chapter5/FunctionLengthWarnTest.kt | 2 +- .../ruleset/chapter5/LambdaLengthWarnTest.kt | 2 +- .../chapter5/LambdaParameterOrderWarnTest.kt | 2 +- .../chapter5/NestedFunctionBlockWarnTest.kt | 2 +- .../OverloadingArgumentsFunctionWarnTest.kt | 2 +- .../ParameterNameInOuterLambdaRuleWarnTest.kt | 2 +- .../chapter6/AbstractClassesWarnTest.kt | 10 +-- .../chapter6/AvoidUtilityClassWarnTest.kt | 2 +- .../chapter6/CompactInitializationWarnTest.kt | 4 +- .../chapter6/CustomGetterSetterWarnTest.kt | 2 +- .../chapter6/DataClassesRuleWarnTest.kt | 2 +- .../EmptyPrimaryConstructorWarnTest.kt | 2 +- .../ExtensionFunctionsInFileWarnTest.kt | 10 +-- .../ExtensionFunctionsSameNameWarnTest.kt | 2 +- .../ImplicitBackingPropertyWarnTest.kt | 2 +- .../ruleset/chapter6/InlineClassesWarnTest.kt | 8 +- .../PropertyAccessorFieldsWarnTest.kt | 2 +- .../ruleset/chapter6/RunInScriptWarnTest.kt | 48 +++++------ .../chapter6/SingleConstructorRuleWarnTest.kt | 4 +- .../chapter6/SingleInitRuleWarnTest.kt | 10 +-- .../chapter6/StatelessClassesRuleWarnTest.kt | 2 +- .../TrivialPropertyAccessorsWarnTest.kt | 2 +- .../ruleset/chapter6/UseLastIndexWarnTest.kt | 2 +- .../chapter6/UselessSupertypeWarnTest.kt | 2 +- .../diktat/ruleset/smoke/DiktatSmokeTest.kt | 2 +- .../utils/SuppressAnnotatedExpressionTest.kt | 2 +- .../cqfn/diktat/ruleset/utils/SuppressTest.kt | 2 +- .../diktat/util/DiktatRuleSetProvider4Test.kt | 2 +- .../org/cqfn/diktat/util/DiktatRuleTest.kt | 2 +- .../org/cqfn/diktat/util/LintTestBase.kt | 3 - .../org/cqfn/diktat/util/SuppressingTest.kt | 2 +- .../kotlin/org/cqfn/diktat/util/TestUtils.kt | 8 -- pom.xml | 2 +- 96 files changed, 263 insertions(+), 277 deletions(-) delete mode 100644 diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/SequenceUtils.kt diff --git a/diktat-common/src/main/kotlin/org/cqfn/diktat/common/config/rules/RulesConfigReader.kt b/diktat-common/src/main/kotlin/org/cqfn/diktat/common/config/rules/RulesConfigReader.kt index 652de14739..5432ce05b6 100644 --- a/diktat-common/src/main/kotlin/org/cqfn/diktat/common/config/rules/RulesConfigReader.kt +++ b/diktat-common/src/main/kotlin/org/cqfn/diktat/common/config/rules/RulesConfigReader.kt @@ -32,6 +32,13 @@ const val DIKTAT_COMMON = "DIKTAT_COMMON" */ const val DIKTAT = "diktat" +/** + * this constant will be used everywhere in the code to mark usage of Diktat ruleset + */ +const val DIKTAT_RULE_SET_ID = "diktat-ruleset" +const val DIKTAT_ANALYSIS_CONF = "diktat-analysis.yml" +const val DIKTAT_CONF_PROPERTY = "diktat.config.path" + /** * This interface represents individual inspection in rule set. */ diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index 17b938481d..218b9abf72 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -34,7 +34,7 @@ val jacocoVersion = project.properties.getOrDefault("jacocoVersion", "0.8.7") as dependencies { implementation(kotlin("gradle-plugin-api")) - implementation("org.cqfn.diktat:diktat-rules:$diktatVersion") { + implementation("org.cqfn.diktat:diktat-common:$diktatVersion") { exclude("org.jetbrains.kotlin", "kotlin-compiler-embeddable") exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8") exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk7") diff --git a/diktat-gradle-plugin/src/main/kotlin/org/cqfn/diktat/plugin/gradle/DiktatJavaExecTaskBase.kt b/diktat-gradle-plugin/src/main/kotlin/org/cqfn/diktat/plugin/gradle/DiktatJavaExecTaskBase.kt index b34f9c4d14..95e7df7d2f 100644 --- a/diktat-gradle-plugin/src/main/kotlin/org/cqfn/diktat/plugin/gradle/DiktatJavaExecTaskBase.kt +++ b/diktat-gradle-plugin/src/main/kotlin/org/cqfn/diktat/plugin/gradle/DiktatJavaExecTaskBase.kt @@ -1,9 +1,9 @@ package org.cqfn.diktat.plugin.gradle +import org.cqfn.diktat.common.config.rules.DIKTAT_CONF_PROPERTY import org.cqfn.diktat.plugin.gradle.DiktatGradlePlugin.Companion.DIKTAT_CHECK_TASK import org.cqfn.diktat.plugin.gradle.DiktatGradlePlugin.Companion.DIKTAT_FIX_TASK import org.cqfn.diktat.plugin.gradle.DiktatGradlePlugin.Companion.MIN_JVM_REQUIRES_ADD_OPENS -import org.cqfn.diktat.ruleset.rules.DIKTAT_CONF_PROPERTY import generated.DIKTAT_VERSION import generated.KTLINT_VERSION diff --git a/diktat-gradle-plugin/src/test/kotlin/org/cqfn/diktat/plugin/gradle/DiktatJavaExecTaskTest.kt b/diktat-gradle-plugin/src/test/kotlin/org/cqfn/diktat/plugin/gradle/DiktatJavaExecTaskTest.kt index 1d6069d870..f9b6ab1d00 100644 --- a/diktat-gradle-plugin/src/test/kotlin/org/cqfn/diktat/plugin/gradle/DiktatJavaExecTaskTest.kt +++ b/diktat-gradle-plugin/src/test/kotlin/org/cqfn/diktat/plugin/gradle/DiktatJavaExecTaskTest.kt @@ -1,6 +1,7 @@ package org.cqfn.diktat.plugin.gradle -import org.cqfn.diktat.ruleset.rules.DIKTAT_CONF_PROPERTY +import org.cqfn.diktat.common.config.rules.DIKTAT_CONF_PROPERTY + import org.gradle.api.Project import org.gradle.testfixtures.ProjectBuilder import org.junit.jupiter.api.AfterEach @@ -207,7 +208,7 @@ class DiktatJavaExecTaskTest { } private fun combinePathParts(vararg parts: String) = parts.joinToString(File.separator) - + companion object { private const val DIKTAT_CHECK_TASK = "diktatCheck" } diff --git a/diktat-maven-plugin/pom.xml b/diktat-maven-plugin/pom.xml index b2142bc795..55b2b6d49c 100644 --- a/diktat-maven-plugin/pom.xml +++ b/diktat-maven-plugin/pom.xml @@ -138,6 +138,11 @@ + + + -Xuse-k2 + + org.apache.maven.plugins 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 1d91663d30..bd081e7798 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 @@ -1,3 +1,7 @@ +@file:Suppress( + "Deprecation" +) + package org.cqfn.diktat.plugin.maven import org.cqfn.diktat.ruleset.rules.DiktatRuleSetProvider @@ -7,8 +11,8 @@ import com.pinterest.ktlint.core.LintError import com.pinterest.ktlint.core.Reporter import com.pinterest.ktlint.core.RuleExecutionException import com.pinterest.ktlint.core.RuleSet -import com.pinterest.ktlint.core.api.FeatureInAlphaState import com.pinterest.ktlint.core.internal.CurrentBaseline +import com.pinterest.ktlint.core.internal.containsLintError import com.pinterest.ktlint.core.internal.loadBaseline import com.pinterest.ktlint.reporter.baseline.BaselineReporter import com.pinterest.ktlint.reporter.html.HtmlReporter @@ -94,7 +98,6 @@ abstract class DiktatBaseMojo : AbstractMojo() { /** * @param params instance of [KtLint.ExperimentalParams] used in analysis */ - @OptIn(FeatureInAlphaState::class) abstract fun runAction(params: KtLint.ExperimentalParams) /** @@ -210,7 +213,7 @@ abstract class DiktatBaseMojo : AbstractMojo() { .forEach { file -> log.debug("Checking file $file") try { - reporterImpl.before(file.path) + reporterImpl.before(file.absolutePath) checkFile( file, lintErrors, @@ -220,7 +223,7 @@ abstract class DiktatBaseMojo : AbstractMojo() { ), ruleSets ) - reporterImpl.after(file.path) + reporterImpl.after(file.absolutePath) } catch (e: RuleExecutionException) { log.error("Unhandled exception during rule execution: ", e) throw MojoExecutionException("Unhandled exception during rule execution", e) @@ -228,7 +231,6 @@ abstract class DiktatBaseMojo : AbstractMojo() { } } - @OptIn(FeatureInAlphaState::class) private fun checkFile(file: File, lintErrors: MutableList, baselineErrors: List, @@ -237,18 +239,13 @@ abstract class DiktatBaseMojo : AbstractMojo() { val text = file.readText() val params = KtLint.ExperimentalParams( - fileName = file.relativeTo(mavenProject.basedir).path, + fileName = file.absolutePath, text = text, ruleSets = ruleSets, - userData = mapOf("file_path" to file.path), script = file.extension.equals("kts", ignoreCase = true), cb = { lintError, isCorrected -> - if (baselineErrors.none { - // ktlint's BaselineReporter stores only these fields - it.line == lintError.line && it.col == lintError.col && - it.ruleId == lintError.ruleId - }) { - reporterImpl.onLintError(file.path, lintError, isCorrected) + if (!baselineErrors.containsLintError(lintError)) { + reporterImpl.onLintError(file.absolutePath, lintError, isCorrected) lintErrors.add(lintError) } }, diff --git a/diktat-maven-plugin/src/main/kotlin/org/cqfn/diktat/plugin/maven/DiktatMojo.kt b/diktat-maven-plugin/src/main/kotlin/org/cqfn/diktat/plugin/maven/DiktatMojo.kt index 1e200dcc9c..b5a12697ae 100644 --- a/diktat-maven-plugin/src/main/kotlin/org/cqfn/diktat/plugin/maven/DiktatMojo.kt +++ b/diktat-maven-plugin/src/main/kotlin/org/cqfn/diktat/plugin/maven/DiktatMojo.kt @@ -38,12 +38,11 @@ class DiktatFixMojo : DiktatBaseMojo() { @OptIn(FeatureInAlphaState::class) override fun runAction(params: KtLint.ExperimentalParams) { val fileName = params.fileName - val filePath = params.userData["file_path"] ?: error("File path should be provided") - val fileContent = File(filePath).readText(charset("UTF-8")) + val fileContent = File(fileName).readText(charset("UTF-8")) val formattedText = KtLint.format(params) if (fileContent != formattedText) { log.info("Original and formatted content differ, writing to $fileName...") - File(filePath).writeText(formattedText, charset("UTF-8")) + File(fileName).writeText(formattedText, charset("UTF-8")) } } } diff --git a/diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatMavenPluginIntegrationTest.kt b/diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatMavenPluginIntegrationTest.kt index 493776dde8..43548a1012 100644 --- a/diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatMavenPluginIntegrationTest.kt +++ b/diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatMavenPluginIntegrationTest.kt @@ -75,7 +75,7 @@ class DiktatMavenPluginIntegrationTest { with(SoftAssertions()) { try { - assertThat(mavenLog).containsPattern("""Original and formatted content differ, writing to [:\w/\\]+Test\.kt\.\.\.""") + assertThat(mavenLog).containsPattern("""Original and formatted content differ, writing to [:\w/\\-]+Test\.kt\.\.\.""") assertThat(mavenLog).containsPattern("There are \\d+ lint errors") assertThat(mavenLog).contains("[MISSING_KDOC_TOP_LEVEL]") } finally { diff --git a/diktat-rules/pom.xml b/diktat-rules/pom.xml index e96be60b80..20ad0efe42 100644 --- a/diktat-rules/pom.xml +++ b/diktat-rules/pom.xml @@ -133,6 +133,7 @@ -Xinline-classes + -Xuse-k2 diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt index 07e2eaf4ea..6686f78fd0 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt @@ -1,6 +1,9 @@ package org.cqfn.diktat.ruleset.rules +import org.cqfn.diktat.common.config.rules.DIKTAT_ANALYSIS_CONF import org.cqfn.diktat.common.config.rules.DIKTAT_COMMON +import org.cqfn.diktat.common.config.rules.DIKTAT_CONF_PROPERTY +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.common.config.rules.RulesConfigReader import org.cqfn.diktat.ruleset.constants.Warnings @@ -87,13 +90,6 @@ import org.slf4j.LoggerFactory import java.io.File -/** - * this constant will be used everywhere in the code to mark usage of Diktat ruleset - */ -const val DIKTAT_RULE_SET_ID = "diktat-ruleset" -const val DIKTAT_ANALYSIS_CONF = "diktat-analysis.yml" -const val DIKTAT_CONF_PROPERTY = "diktat.config.path" - /** * [RuleSetProvider] that provides diKTat ruleset. * By default it is expected to have diktat-analysis.yml configuration in the root folder where 'ktlint' is run diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt index d5f51945eb..be13f1b3fb 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt @@ -783,7 +783,7 @@ fun ASTNode.findAllNodesWithConditionOnLine( * @return name of the file [this] node belongs to */ fun ASTNode.getFilePath(): String = getRootNode().also { - require(it.elementType == FILE) { "Root node type is not FILE, but file_path is present in user_data only in FILE nodes" } + require(it.elementType == FILE) { "Root node type is not FILE, but ${KtLint.FILE_PATH_USER_DATA_KEY} is present in user_data only in FILE nodes" } }.getUserData(KtLint.FILE_PATH_USER_DATA_KEY).let { requireNotNull(it) { "File path is not present in user data" } } @@ -833,6 +833,15 @@ fun ASTNode.takeByChainOfTypes(vararg types: IElementType): ASTNode? { return node } +private fun Sequence.takeWhileInclusive(pred: (T) -> Boolean): Sequence { + var shouldContinue = true + return takeWhile { + val result = shouldContinue + shouldContinue = pred(it) + result + } +} + private fun Collection.containSuppressWithName(name: String) = this.any { it.shortName.toString() == (Suppress::class.simpleName) && diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/SequenceUtils.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/SequenceUtils.kt deleted file mode 100644 index bcd537586f..0000000000 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/SequenceUtils.kt +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Utility methods to work with sequences - */ - -package org.cqfn.diktat.ruleset.utils - -/** - * @param pred a predicate - * @return filtered sequence - */ -fun Sequence.takeWhileInclusive(pred: (T) -> Boolean): Sequence { - var shouldContinue = true - return takeWhile { - val result = shouldContinue - shouldContinue = pred(it) - result - } -} diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/IdentifierNamingWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/IdentifierNamingWarnTest.kt index 028ce860a9..9db41db5b4 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/IdentifierNamingWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/IdentifierNamingWarnTest.kt @@ -1,5 +1,6 @@ package org.cqfn.diktat.ruleset.chapter1 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.BACKTICKS_PROHIBITED import org.cqfn.diktat.ruleset.constants.Warnings.CLASS_NAME_INCORRECT @@ -14,7 +15,6 @@ import org.cqfn.diktat.ruleset.constants.Warnings.OBJECT_NAME_INCORRECT import org.cqfn.diktat.ruleset.constants.Warnings.VARIABLE_HAS_PREFIX import org.cqfn.diktat.ruleset.constants.Warnings.VARIABLE_NAME_INCORRECT import org.cqfn.diktat.ruleset.constants.Warnings.VARIABLE_NAME_INCORRECT_FORMAT -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/MethodNamingWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/MethodNamingWarnTest.kt index 0e0b8f1990..288c70cec7 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/MethodNamingWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/MethodNamingWarnTest.kt @@ -1,9 +1,9 @@ package org.cqfn.diktat.ruleset.chapter1 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.FUNCTION_BOOLEAN_PREFIX import org.cqfn.diktat.ruleset.constants.Warnings.FUNCTION_NAME_INCORRECT_CASE import org.cqfn.diktat.ruleset.constants.Warnings.TYPEALIAS_NAME_INCORRECT_CASE -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackageNamingWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackageNamingWarnTest.kt index a870421b1a..60ddd1e26a 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackageNamingWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackageNamingWarnTest.kt @@ -1,5 +1,6 @@ package org.cqfn.diktat.ruleset.chapter1 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.INCORRECT_PACKAGE_SEPARATOR import org.cqfn.diktat.ruleset.constants.Warnings.PACKAGE_NAME_INCORRECT_CASE @@ -7,7 +8,6 @@ import org.cqfn.diktat.ruleset.constants.Warnings.PACKAGE_NAME_INCORRECT_PATH import org.cqfn.diktat.ruleset.constants.Warnings.PACKAGE_NAME_INCORRECT_PREFIX import org.cqfn.diktat.ruleset.constants.Warnings.PACKAGE_NAME_INCORRECT_SYMBOLS import org.cqfn.diktat.ruleset.constants.Warnings.PACKAGE_NAME_MISSING -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter1.PackageNaming import org.cqfn.diktat.util.LintTestBase import org.cqfn.diktat.util.TEST_FILE_NAME diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/CommentsFormattingTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/CommentsFormattingTest.kt index 52a63d0240..758f87243e 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/CommentsFormattingTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/CommentsFormattingTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter2 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.constants.Warnings.IF_ELSE_COMMENTS -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.CommentsFormatting import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/HeaderCommentRuleTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/HeaderCommentRuleTest.kt index 5c2be5081e..1b030758ea 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/HeaderCommentRuleTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/HeaderCommentRuleTest.kt @@ -1,12 +1,12 @@ package org.cqfn.diktat.ruleset.chapter2 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.constants.Warnings.HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE import org.cqfn.diktat.ruleset.constants.Warnings.HEADER_MISSING_OR_WRONG_COPYRIGHT import org.cqfn.diktat.ruleset.constants.Warnings.HEADER_NOT_BEFORE_PACKAGE import org.cqfn.diktat.ruleset.constants.Warnings.HEADER_WRONG_FORMAT -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter2.comments.HeaderCommentRule import org.cqfn.diktat.util.LintTestBase @@ -478,7 +478,7 @@ class HeaderCommentRuleTest : LintTestBase(::HeaderCommentRule) { @Tag(WarningNames.HEADER_NOT_BEFORE_PACKAGE) fun `header KDoc in gradle script`() { lintMethod( - """ + """ |version = "0.1.0-SNAPSHOT" | """.trimMargin(), @@ -491,7 +491,7 @@ class HeaderCommentRuleTest : LintTestBase(::HeaderCommentRule) { @Tag(WarningNames.HEADER_NOT_BEFORE_PACKAGE) fun `header KDoc in kts script`() { lintMethod( - """ + """ |val version = "0.1.0-SNAPSHOT" | """.trimMargin(), diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocCommentsWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocCommentsWarnTest.kt index 29c3bf3e3f..060b786e24 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocCommentsWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocCommentsWarnTest.kt @@ -1,5 +1,6 @@ package org.cqfn.diktat.ruleset.chapter2 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_EXTRA_PROPERTY import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_NO_CLASS_BODY_PROPERTIES_IN_HEADER @@ -7,7 +8,6 @@ import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_NO_CONSTRUCTOR_PROPERTY import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_NO_CONSTRUCTOR_PROPERTY_WITH_COMMENT import org.cqfn.diktat.ruleset.constants.Warnings.MISSING_KDOC_CLASS_ELEMENTS import org.cqfn.diktat.ruleset.constants.Warnings.MISSING_KDOC_TOP_LEVEL -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocComments import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocFormattingTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocFormattingTest.kt index cf581a9ca9..4d29b705b9 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocFormattingTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocFormattingTest.kt @@ -1,5 +1,6 @@ package org.cqfn.diktat.ruleset.chapter2 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_EMPTY_KDOC @@ -10,7 +11,6 @@ import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_NO_NEWLINES_BETWEEN_BASIC import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_NO_NEWLINE_AFTER_SPECIAL_TAGS import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_WRONG_SPACES_AFTER_TAG import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_WRONG_TAGS_ORDER -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocFormatting import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocMethodsTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocMethodsTest.kt index 412311f41f..d4166a1965 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocMethodsTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocMethodsTest.kt @@ -1,13 +1,13 @@ package org.cqfn.diktat.ruleset.chapter2 import org.cqfn.diktat.common.config.rules.DIKTAT_COMMON +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_TRIVIAL_KDOC_ON_FUNCTION import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_WITHOUT_PARAM_TAG import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_WITHOUT_RETURN_TAG import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_WITHOUT_THROWS_TAG import org.cqfn.diktat.ruleset.constants.Warnings.MISSING_KDOC_ON_FUNCTION -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocMethods import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocParamPresentWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocParamPresentWarnTest.kt index 40231a66cc..a44168ec7a 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocParamPresentWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocParamPresentWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter2 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.KDOC_WITHOUT_PARAM_TAG import org.cqfn.diktat.ruleset.constants.Warnings.MISSING_KDOC_ON_FUNCTION -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocMethods import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/comments/CommentedCodeTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/comments/CommentedCodeTest.kt index fced63982e..04aad9c13b 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/comments/CommentedCodeTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/comments/CommentedCodeTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter2.comments +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.COMMENTED_OUT_CODE -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter2.comments.CommentsRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/AnnotationNewLineRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/AnnotationNewLineRuleWarnTest.kt index ec415a75b0..8fb9cd572c 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/AnnotationNewLineRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/AnnotationNewLineRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.AnnotationNewLineRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BlockStructureBracesWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BlockStructureBracesWarnTest.kt index 40fbfdde83..23d4eed513 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BlockStructureBracesWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BlockStructureBracesWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.BRACES_BLOCK_STRUCTURE_ERROR -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.BlockStructureBraces import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BooleanExpressionsRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BooleanExpressionsRuleWarnTest.kt index 380c25171b..e03919276c 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BooleanExpressionsRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BooleanExpressionsRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.BooleanExpressionsRule import org.cqfn.diktat.ruleset.utils.KotlinParser import org.cqfn.diktat.util.LintTestBase @@ -26,17 +26,17 @@ class BooleanExpressionsRuleWarnTest : LintTestBase(::BooleanExpressionsRule) { | if (some != null && some != null && some == null) { | goo() | } - | + | | if (some != null && some == 7) { - | + | | } - | + | | if (a > 3 && b > 3 && a > 3) { - | + | | } - | + | | if (a && a && b > 4) { - | + | | } |} """.trimMargin(), @@ -53,23 +53,23 @@ class BooleanExpressionsRuleWarnTest : LintTestBase(::BooleanExpressionsRule) { """ |fun foo() { | if (some != null && (some != null || a > 5)) { - | + | | } - | + | | if (a > 5 || (a > 5 && b > 6)) { - | + | | } - | + | | if (!!(a > 5 && q > 6)) { - | + | | } - | + | | if (a > 5 && false) { - | + | | } - | + | | if (a > 5 || (!(a > 5) && b > 5)) { - | + | | } |} """.trimMargin(), @@ -88,11 +88,11 @@ class BooleanExpressionsRuleWarnTest : LintTestBase(::BooleanExpressionsRule) { """ |fun foo() { | if ((a > 5 || b > 5) && (a > 5 || c > 5)) { - | + | | } - | + | | if (a > 5 && b > 5 || a > 5 && c > 5) { - | + | | } |} """.trimMargin(), @@ -108,11 +108,11 @@ class BooleanExpressionsRuleWarnTest : LintTestBase(::BooleanExpressionsRule) { """ |fun foo() { | if ((a > 5 || b > 5) && (a > 5 || c > 5) && (a > 5 || d > 5)) { - | + | | } - | + | | if (a > 5 && b > 5 || a > 5 && c > 5 || a > 5 || d > 5) { - | + | | } |} """.trimMargin(), @@ -128,7 +128,7 @@ class BooleanExpressionsRuleWarnTest : LintTestBase(::BooleanExpressionsRule) { """ |fun foo() { | if (a.and(b)) { - | + | | } |} """.trimMargin() @@ -233,31 +233,31 @@ class BooleanExpressionsRuleWarnTest : LintTestBase(::BooleanExpressionsRule) { fun foo() { // nested boolean expressions in lambdas if (currentProperty.nextSibling { it.elementType == PROPERTY } == nextProperty) {} - + if (rightSide != null && leftSide != null && rightSide.size == leftSide.size && rightSide.zip(leftSide).all { (first, second) -> first.text == second.text }) {} - + // nested lambda with if-else if (currentProperty.nextSibling { if (it.elementType == PROPERTY) true else false } == nextProperty) {} - + // nested boolean expressions in lambdas with multi-line expressions if (node.elementType == TYPE_REFERENCE && node .parents() .map { it.elementType } .none { it == SUPER_TYPE_LIST || it == TYPEALIAS }) {} - + // binary expression with boolean literal if (result?.flag == true) {} - + if (leftOffset + binaryText.length > wrongBinaryExpression.maximumLineLength && index != 0) {} - + // with in and !in if (!isImportOrPackage && previousNonWhiteSpaceNode in acc.last()) {} if (node.elementType == LABEL_QUALIFIER && node.text !in labels && node.treeParent.elementType in stopWords) {} - + if ((node.treeNext.elementType == RBRACE) xor (node.treePrev.elementType == LBRACE)) {} - + if (listOfNodesBeforeNestedIf.any { it.elementType !in allowedTypes } || listOfNodesAfterNestedIf.any { it.elementType !in allowedTypes }) { return null diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BracesRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BracesRuleWarnTest.kt index c8dc5b66f4..48a9431890 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BracesRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BracesRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.NO_BRACES_IN_CONDITIONALS_AND_LOOPS -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.BracesInConditionalsAndLoopsRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ClassLikeStructuresOrderRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ClassLikeStructuresOrderRuleWarnTest.kt index 04b73a94d7..00de7a6892 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ClassLikeStructuresOrderRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ClassLikeStructuresOrderRuleWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.BLANK_LINE_BETWEEN_PROPERTIES import org.cqfn.diktat.ruleset.constants.Warnings.WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.ClassLikeStructuresOrderRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/CollapseIfStatementsRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/CollapseIfStatementsRuleWarnTest.kt index 9b06788799..d8c5fe53d6 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/CollapseIfStatementsRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/CollapseIfStatementsRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.COLLAPSE_IF_STATEMENTS -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.CollapseIfStatementsRule import org.cqfn.diktat.util.LintTestBase @@ -30,7 +30,7 @@ class CollapseIfStatementsRuleWarnTest : LintTestBase(::CollapseIfStatementsRule | } else { | print("some text") | } - |} + |} """.trimMargin(), LintError(3, 10, ruleId, "${COLLAPSE_IF_STATEMENTS.warnText()} avoid using redundant nested if-statements", true) ) @@ -47,11 +47,11 @@ class CollapseIfStatementsRuleWarnTest : LintTestBase(::CollapseIfStatementsRule | firstAction() | secondAction() | } - | } + | } | if (cond3) { | secondAction() | } - |} + |} """.trimMargin(), LintError(3, 10, ruleId, "${COLLAPSE_IF_STATEMENTS.warnText()} avoid using redundant nested if-statements", true) ) @@ -64,11 +64,11 @@ class CollapseIfStatementsRuleWarnTest : LintTestBase(::CollapseIfStatementsRule """ |fun foo () { | if (true) { - | + | | if (true) { | doSomething() | } - | } + | } |} """.trimMargin(), LintError(4, 10, ruleId, "${COLLAPSE_IF_STATEMENTS.warnText()} avoid using redundant nested if-statements", true) @@ -167,7 +167,7 @@ class CollapseIfStatementsRuleWarnTest : LintTestBase(::CollapseIfStatementsRule | } | // comment 3 | } - |} + |} """.trimMargin(), LintError(7, 10, ruleId, "${COLLAPSE_IF_STATEMENTS.warnText()} avoid using redundant nested if-statements", true) ) @@ -283,7 +283,7 @@ class CollapseIfStatementsRuleWarnTest : LintTestBase(::CollapseIfStatementsRule | if (true) { | doSomething() | } - | } + | } |} """.trimMargin() ) @@ -305,7 +305,7 @@ class CollapseIfStatementsRuleWarnTest : LintTestBase(::CollapseIfStatementsRule | } else { | secondAction() | } - |} + |} """.trimMargin(), ) } @@ -328,7 +328,7 @@ class CollapseIfStatementsRuleWarnTest : LintTestBase(::CollapseIfStatementsRule | } else { | secondAction() | } - |} + |} """.trimMargin() ) } @@ -400,9 +400,9 @@ class CollapseIfStatementsRuleWarnTest : LintTestBase(::CollapseIfStatementsRule | if (true) { | if (true) { | doSomething() - | } + | } | } - | } + | } |} """.trimMargin(), LintError(3, 10, ruleId, "${COLLAPSE_IF_STATEMENTS.warnText()} avoid using redundant nested if-statements", true), @@ -426,9 +426,9 @@ class CollapseIfStatementsRuleWarnTest : LintTestBase(::CollapseIfStatementsRule | } | } | } - | } + | } | } - | } + | } |} """.trimMargin(), LintError(3, 10, ruleId, "${COLLAPSE_IF_STATEMENTS.warnText()} avoid using redundant nested if-statements", true), @@ -473,7 +473,7 @@ class CollapseIfStatementsRuleWarnTest : LintTestBase(::CollapseIfStatementsRule | if (true) { | if (true) { | fun3() - | } + | } | } | } else { | fun4() @@ -495,11 +495,11 @@ class CollapseIfStatementsRuleWarnTest : LintTestBase(::CollapseIfStatementsRule | firstAction() | secondAction() | } - | } + | } | if (cond4) { | secondAction() | } - |} + |} """.trimMargin(), LintError(3, 10, ruleId, "${COLLAPSE_IF_STATEMENTS.warnText()} avoid using redundant nested if-statements", true), ) @@ -520,7 +520,7 @@ class CollapseIfStatementsRuleWarnTest : LintTestBase(::CollapseIfStatementsRule | secondAction() | } | } - |} + |} """.trimMargin() ) } diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ConsecutiveSpacesRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ConsecutiveSpacesRuleWarnTest.kt index 8d01a0758b..3ae0d5a7a5 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ConsecutiveSpacesRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ConsecutiveSpacesRuleWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.TOO_MANY_CONSECUTIVE_SPACES -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.ConsecutiveSpacesRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/DebugPrintRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/DebugPrintRuleWarnTest.kt index b146e9089f..e460036f46 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/DebugPrintRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/DebugPrintRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.DebugPrintRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EmptyBlockWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EmptyBlockWarnTest.kt index aaf3028045..e846c948d2 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EmptyBlockWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EmptyBlockWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.EMPTY_BLOCK_STRUCTURE_ERROR -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.EmptyBlock import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EnumsSeparatedWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EnumsSeparatedWarnTest.kt index 2faa7e28da..1c2cc672ec 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EnumsSeparatedWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EnumsSeparatedWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.ENUMS_SEPARATED -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.EnumsSeparated import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileSizeWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileSizeWarnTest.kt index 68c337d756..cd578e1b8e 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileSizeWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileSizeWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.files.FileSize import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileStructureRuleTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileStructureRuleTest.kt index 14e934eff7..7d423a3db0 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileStructureRuleTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileStructureRuleTest.kt @@ -1,5 +1,6 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.constants.Warnings.FILE_CONTAINS_ONLY_COMMENTS @@ -7,7 +8,6 @@ import org.cqfn.diktat.ruleset.constants.Warnings.FILE_INCORRECT_BLOCKS_ORDER import org.cqfn.diktat.ruleset.constants.Warnings.FILE_NO_BLANK_LINE_BETWEEN_BLOCKS import org.cqfn.diktat.ruleset.constants.Warnings.FILE_UNORDERED_IMPORTS import org.cqfn.diktat.ruleset.constants.Warnings.FILE_WILDCARD_IMPORTS -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.files.FileStructureRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LineLengthWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LineLengthWarnTest.kt index fb92dec786..286927ec54 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LineLengthWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LineLengthWarnTest.kt @@ -2,9 +2,9 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.LONG_LINE -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.LineLength import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LocalVariablesWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LocalVariablesWarnTest.kt index a89837437b..51f59e574f 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LocalVariablesWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LocalVariablesWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.identifiers.LocalVariablesRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LongNumericalValuesSeparatedWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LongNumericalValuesSeparatedWarnTest.kt index 0c5dee6dc6..f564afc014 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LongNumericalValuesSeparatedWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LongNumericalValuesSeparatedWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.LongNumericalValuesSeparatedRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MagicNumberRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MagicNumberRuleWarnTest.kt index f20990bcde..ec73e59b55 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MagicNumberRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MagicNumberRuleWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.MAGIC_NUMBER -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.MagicNumberRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MultipleModifiersSequenceWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MultipleModifiersSequenceWarnTest.kt index 518318a9aa..8a672bce7a 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MultipleModifiersSequenceWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MultipleModifiersSequenceWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.WRONG_MULTIPLE_MODIFIERS_ORDER -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.MultipleModifiersSequence import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/NullableTypeRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/NullableTypeRuleWarnTest.kt index 3054c07f7d..a0de2c05eb 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/NullableTypeRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/NullableTypeRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.NULLABLE_PROPERTY_TYPE -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.NullableTypeRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/RangeConventionalRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/RangeConventionalRuleWarnTest.kt index 57d278cdda..bef1ae0013 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/RangeConventionalRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/RangeConventionalRuleWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.RangeConventionalRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleWarnTest.kt index 3a065a2209..482de292d4 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.MORE_THAN_ONE_STATEMENT_PER_LINE -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.SingleLineStatementsRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SortRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SortRuleWarnTest.kt index 782949ddab..75bddc621b 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SortRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SortRuleWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.WRONG_DECLARATIONS_ORDER -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.SortRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringConcatenationWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringConcatenationWarnTest.kt index 94fe33df76..baaa48efa0 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringConcatenationWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringConcatenationWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.StringConcatenationRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringTemplateRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringTemplateRuleWarnTest.kt index 464f588431..1f53b01d40 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringTemplateRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringTemplateRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.StringTemplateFormatRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/TrailingCommaWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/TrailingCommaWarnTest.kt index d69136d7b8..ca06598ba0 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/TrailingCommaWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/TrailingCommaWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.TRAILING_COMMA -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.TrailingCommaRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/WhenMustHaveElseWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/WhenMustHaveElseWarnTest.kt index b1060056b2..a41baac3ba 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/WhenMustHaveElseWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/WhenMustHaveElseWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.WhenMustHaveElseRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/BlankLinesWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/BlankLinesWarnTest.kt index 190508eb80..51bc63d232 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/BlankLinesWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/BlankLinesWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3.files +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.TOO_MANY_BLANK_LINES -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.files.BlankLinesRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/NewlinesRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/NewlinesRuleWarnTest.kt index f4b4ffdba9..9fff0a58bd 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/NewlinesRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/NewlinesRuleWarnTest.kt @@ -1,10 +1,10 @@ package org.cqfn.diktat.ruleset.chapter3.files +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.COMPLEX_EXPRESSION import org.cqfn.diktat.ruleset.constants.Warnings.REDUNDANT_SEMICOLON import org.cqfn.diktat.ruleset.constants.Warnings.WRONG_NEWLINES -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.files.NewlinesRule import org.cqfn.diktat.util.LintTestBase @@ -46,7 +46,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | A, | B | ; - | + | | fun foo() {}; | val a = 0; | val b = if (condition) { bar(); baz()} else qux @@ -102,9 +102,9 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | condition2 | val plus = x + | y - | + | | obj!! - | + | | obj | .foo() | obj @@ -129,7 +129,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | // this isn't an expression | val plus = x | + y - | + | | obj. | foo() | obj?. @@ -156,10 +156,10 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { |fun foo() { | true xor | false - | + | | true | .xor(false) - | + | | (true xor | false) | @@ -175,9 +175,9 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { lintMethod( """ |fun foo() { - | (true + | (true | xor false) - | + | | (true | xor | false) @@ -197,12 +197,12 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | (true xor false | or true | ) - | - | (true + | + | (true | xor false | or true | ) - | + | | (true | xor | false @@ -369,7 +369,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { lintMethod( """ |fun foo( - | a: Int, + | a: Int, | b: Int, | c: Int | ) { @@ -457,7 +457,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | val b = list.map { elem: Type -> | foo(elem) | } - | val c = list.map { + | val c = list.map { | bar(elem) | } | val d = list.map { elem -> bar(elem) } @@ -478,7 +478,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | elem -> | foo(elem) | } - | val b = list.map { elem: Type + | val b = list.map { elem: Type | -> | foo(elem) | } @@ -553,7 +553,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { |class Example(val a: Int, | val b: Int) { | fun foo(a: Int) { } - | + | | fun bar( | a: Int, | b: Int @@ -573,7 +573,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | |class Example(val a: Int, val b: Int) { | fun foo(a: Int) { } - | + | | fun bar( | a: Int, b: Int | ) { } @@ -614,7 +614,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | } | .foo() | .bar() - | + | | allProperties?.filter { | predicate(it) | } @@ -623,7 +623,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | .let { | it.some() | } - | + | | allProperties | ?.filter { | predicate(it) @@ -632,7 +632,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | .bar() | .let { | mutableListOf().also { - | + | | } | } |} @@ -649,19 +649,19 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | allProperties.filter { predicate(it) } | .foo() | .bar() - | + | | allProperties?.filter { predicate(it) } | .foo() | .bar() - | + | | list.foo() | .bar() | .filter { | baz() | } - | + | | list.filter { - | + | | } | .map(::foo).filter { | bar() @@ -680,7 +680,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { """ |class Foo(val arg1: Int, arg2: Int) { } | - |class Foo(val arg1: Int, arg2: Int, arg3: Int) { + |class Foo(val arg1: Int, arg2: Int, arg3: Int) { | constructor(arg1: Int, arg2: String, arg3: String) : this(arg1, 0, 0) { } |} | @@ -732,8 +732,8 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { fun `should not raise warning on value arguments`() { lintMethod( """ - |class SomeRule(configRules: List) : Rule("id", - |configRules, + |class SomeRule(configRules: List) : Rule("id", + |configRules, |listOf("foo", "baz") |) { | @@ -747,8 +747,8 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { fun `should not raise warning on list params`() { lintMethod( """ - |class SomeRule(configRules: List) : Rule("id", - |configRules, + |class SomeRule(configRules: List) : Rule("id", + |configRules, |listOf("foo", "baz", "triple", "bar") |) { | @@ -781,7 +781,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | FooBase(), | BazInterface, | BazSuperclass { } - | + | |class Foo : FooBase(), BazInterface, | BazSuperclass { } | @@ -933,10 +933,10 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | z.goo() | ?: | goo() - | + | | x.goo() | ?:goo() - | + | | y.ds()?:gh() |} """.trimMargin(), @@ -987,9 +987,9 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | .bar() | .goo() | .qwe()!! - | + | | goo()!!.gre() - | + | | bfr()!!.qwe().foo().qwe().dg() |} | @@ -1015,7 +1015,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | .bar() | .goo()!! | .qwe() - | + | | val x = foo | .bar!! | .baz @@ -1064,11 +1064,11 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { lintMethod( """ |fun foo() { - | foo.qwe() + | foo.qwe() | ?: bar.baz() - | foo + | foo | ?: bar().qwe() - | foo + | foo | ?: bar().qwe().qwe() | foo | .qwe() ?: qwe().qwe() @@ -1097,8 +1097,8 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) { | ?: bar | .bar() | .qux() - | - | + | + | | foo.bar() | .baz() | .qux() diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/TopLevelOrderRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/TopLevelOrderRuleWarnTest.kt index e4ea8063cb..ec84b2030f 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/TopLevelOrderRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/TopLevelOrderRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3.files +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.TOP_LEVEL_ORDER -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.files.TopLevelOrderRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleWarnTest.kt index 66ef42b840..a263e82c89 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter3.spaces +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.WRONG_INDENTATION -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.files.IndentationRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/WhiteSpaceRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/WhiteSpaceRuleWarnTest.kt index 107489b267..600f050db9 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/WhiteSpaceRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/WhiteSpaceRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter3.spaces +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.WRONG_WHITESPACE -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.files.WhiteSpaceRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/AccurateCalculationsWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/AccurateCalculationsWarnTest.kt index ec7d3014e4..bf5da3910c 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/AccurateCalculationsWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/AccurateCalculationsWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter4 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.FLOAT_IN_ACCURATE_CALCULATIONS -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter4.calculations.AccurateCalculationsRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NoVarRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NoVarRuleWarnTest.kt index a443c8772f..fc954509ae 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NoVarRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NoVarRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter4 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter4.ImmutableValNoVarRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NullChecksRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NullChecksRuleWarnTest.kt index 679bef21e3..53b025b464 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NullChecksRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NullChecksRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter4 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter4.NullChecksRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/SmartCastRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/SmartCastRuleWarnTest.kt index 2475a0d824..300cd4648f 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/SmartCastRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/SmartCastRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter4 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter4.SmartCastRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/TypeAliasRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/TypeAliasRuleWarnTest.kt index 5d15adcde1..c3fd6297d7 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/TypeAliasRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/TypeAliasRuleWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter4 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.TYPE_ALIAS -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter4.TypeAliasRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/VariableGenericTypeDeclarationRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/VariableGenericTypeDeclarationRuleWarnTest.kt index 7a7a1cb6a4..d48aa0aee6 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/VariableGenericTypeDeclarationRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/VariableGenericTypeDeclarationRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter4 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter4.VariableGenericTypeDeclarationRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AsyncAndSyncRuleTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AsyncAndSyncRuleTest.kt index b4d9fb6e15..469294936d 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AsyncAndSyncRuleTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AsyncAndSyncRuleTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter5 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.RUN_BLOCKING_INSIDE_ASYNC -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter5.AsyncAndSyncRule import org.cqfn.diktat.util.LintTestBase @@ -22,14 +22,14 @@ class AsyncAndSyncRuleTest : LintTestBase(::AsyncAndSyncRule) { | GlobalScope.launch { | c.addAndGet(i) | } - | + | | GlobalScope.async { | n | } - | + | | GlobalScope.async { | runBlocking { - | + | | } | } |} diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AvoidNestedFunctionsWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AvoidNestedFunctionsWarnTest.kt index 4cf0b0ca81..248e915dd2 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AvoidNestedFunctionsWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AvoidNestedFunctionsWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter5 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter5.AvoidNestedFunctionsRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CheckInverseMethodRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CheckInverseMethodRuleWarnTest.kt index 11014791ea..17ab8bba16 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CheckInverseMethodRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CheckInverseMethodRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter5 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter5.CheckInverseMethodRule import org.cqfn.diktat.util.LintTestBase @@ -20,7 +20,7 @@ class CheckInverseMethodRuleWarnTest : LintTestBase(::CheckInverseMethodRule) { """ |fun some() { | if (list.isEmpty()) { - | // some cool logic + | // some cool logic | } |} """.trimMargin() @@ -34,7 +34,7 @@ class CheckInverseMethodRuleWarnTest : LintTestBase(::CheckInverseMethodRule) { """ |fun some() { | if (!list.isEmpty()) { - | // some cool logic + | // some cool logic | } |} """.trimMargin(), @@ -49,7 +49,7 @@ class CheckInverseMethodRuleWarnTest : LintTestBase(::CheckInverseMethodRule) { """ |fun some() { | if (! list.isEmpty()) { - | // some cool logic + | // some cool logic | } |} """.trimMargin(), @@ -64,7 +64,7 @@ class CheckInverseMethodRuleWarnTest : LintTestBase(::CheckInverseMethodRule) { """ |fun some() { | if (! /*cool comment*/ list.isEmpty()) { - | // some cool logic + | // some cool logic | } |} """.trimMargin(), diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CustomLabelsTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CustomLabelsTest.kt index 1457fb37b5..95d0440526 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CustomLabelsTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CustomLabelsTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter5 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.CUSTOM_LABEL -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter5.CustomLabel import org.cqfn.diktat.util.LintTestBase @@ -23,7 +23,7 @@ class CustomLabelsTest : LintTestBase(::CustomLabel) { q.forEach { return@qwe } - } + } q.forEachIndexed { index, i -> return@forEachIndexed } @@ -61,7 +61,7 @@ class CustomLabelsTest : LintTestBase(::CustomLabel) { break@qq } } - + q.forEach outer@ { it.forEach { if(it == 21) diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/FunctionArgumentsSizeWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/FunctionArgumentsSizeWarnTest.kt index 7a6c6b28c7..cbe78faacf 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/FunctionArgumentsSizeWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/FunctionArgumentsSizeWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter5 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.TOO_MANY_PARAMETERS -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter5.FunctionArgumentsSize import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/FunctionLengthWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/FunctionLengthWarnTest.kt index d19d0e9975..35b67631bc 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/FunctionLengthWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/FunctionLengthWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter5 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.TOO_LONG_FUNCTION -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter5.FunctionLength import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/LambdaLengthWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/LambdaLengthWarnTest.kt index 13edc70d27..f1c3cdd249 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/LambdaLengthWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/LambdaLengthWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter5 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter5.LambdaLengthRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/LambdaParameterOrderWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/LambdaParameterOrderWarnTest.kt index ae4284d47b..8cc527f53c 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/LambdaParameterOrderWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/LambdaParameterOrderWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter5 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.LAMBDA_IS_NOT_LAST_PARAMETER -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter5.LambdaParameterOrder import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/NestedFunctionBlockWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/NestedFunctionBlockWarnTest.kt index a031349938..92a733494f 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/NestedFunctionBlockWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/NestedFunctionBlockWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter5 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.NESTED_BLOCK -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter5.NestedFunctionBlock import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/OverloadingArgumentsFunctionWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/OverloadingArgumentsFunctionWarnTest.kt index 0f8b5e2975..2cc1e3b593 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/OverloadingArgumentsFunctionWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/OverloadingArgumentsFunctionWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter5 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.WRONG_OVERLOADING_FUNCTION_ARGUMENTS -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter5.OverloadingArgumentsFunction import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/ParameterNameInOuterLambdaRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/ParameterNameInOuterLambdaRuleWarnTest.kt index c71028e8e1..dda19c367f 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/ParameterNameInOuterLambdaRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/ParameterNameInOuterLambdaRuleWarnTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.ruleset.chapter5 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter5.ParameterNameInOuterLambdaRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AbstractClassesWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AbstractClassesWarnTest.kt index 4367429656..21f2176031 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AbstractClassesWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AbstractClassesWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.classes.AbstractClassesRule import org.cqfn.diktat.util.LintTestBase @@ -20,7 +20,7 @@ class AbstractClassesWarnTest : LintTestBase(::AbstractClassesRule) { """ |abstract class Some(val a: Int = 5) { | abstract fun func() {} - | + | | fun another() {} |} """.trimMargin() @@ -47,7 +47,7 @@ class AbstractClassesWarnTest : LintTestBase(::AbstractClassesRule) { """ |class Some(val a: Int = 5) { | fun func() {} - | + | | inner abstract class Inner { | fun another() | } @@ -68,7 +68,7 @@ class AbstractClassesWarnTest : LintTestBase(::AbstractClassesRule) { | */ | @get:Rule | var coroutineTestRule = CoroutineTestRule() - | + | | /** | * Run test | * @@ -95,7 +95,7 @@ class AbstractClassesWarnTest : LintTestBase(::AbstractClassesRule) { |abstract class BaseUsesProcessor() { | // Store uses by file | abstract val a: String - | + | | fun foo() {} |} """.trimMargin() diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AvoidUtilityClassWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AvoidUtilityClassWarnTest.kt index 570736ed16..0f18e6312e 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AvoidUtilityClassWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AvoidUtilityClassWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.AVOID_USING_UTILITY_CLASS -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.AvoidUtilityClass import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CompactInitializationWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CompactInitializationWarnTest.kt index 51c31111b7..e5eae7488e 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CompactInitializationWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CompactInitializationWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.COMPACT_OBJECT_INITIALIZATION -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.classes.CompactInitialization import org.cqfn.diktat.util.LintTestBase @@ -61,7 +61,7 @@ class CompactInitializationWarnTest : LintTestBase(::CompactInitialization) { | httpClient.url = "http://example.com" | // setting port | httpClient.port = "8080" - | + | | // setting timeout to 100 | httpClient.timeout = 100 | httpClient.doRequest() diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CustomGetterSetterWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CustomGetterSetterWarnTest.kt index 61808208ab..ef8b1db3fd 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CustomGetterSetterWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CustomGetterSetterWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.CustomGetterSetterRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/DataClassesRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/DataClassesRuleWarnTest.kt index 841b447d28..51e14efaf7 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/DataClassesRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/DataClassesRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.classes.DataClassesRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/EmptyPrimaryConstructorWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/EmptyPrimaryConstructorWarnTest.kt index 2a2665c0cd..9f131203c9 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/EmptyPrimaryConstructorWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/EmptyPrimaryConstructorWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.EMPTY_PRIMARY_CONSTRUCTOR -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.AvoidEmptyPrimaryConstructor import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/ExtensionFunctionsInFileWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/ExtensionFunctionsInFileWarnTest.kt index e6e64ff8f3..4cdff48e26 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/ExtensionFunctionsInFileWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/ExtensionFunctionsInFileWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.ExtensionFunctionsInFileRule import org.cqfn.diktat.util.LintTestBase @@ -86,9 +86,9 @@ class ExtensionFunctionsInFileWarnTest : LintTestBase(::ExtensionFunctionsInFile lintMethod( """ |class Some { - | + | | fun Some.str() { - | + | | } |} """.trimMargin() @@ -102,7 +102,7 @@ class ExtensionFunctionsInFileWarnTest : LintTestBase(::ExtensionFunctionsInFile """ |class Some { | fun foo() { - | + | | } |} | @@ -120,7 +120,7 @@ class ExtensionFunctionsInFileWarnTest : LintTestBase(::ExtensionFunctionsInFile """ |class Some { | fun foo() { - | + | | } |} | diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/ExtensionFunctionsSameNameWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/ExtensionFunctionsSameNameWarnTest.kt index 3bef0ef506..4760b91db4 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/ExtensionFunctionsSameNameWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/ExtensionFunctionsSameNameWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.ExtensionFunctionsSameNameRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/ImplicitBackingPropertyWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/ImplicitBackingPropertyWarnTest.kt index 7980a0487a..9433e0e937 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/ImplicitBackingPropertyWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/ImplicitBackingPropertyWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.ImplicitBackingPropertyRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/InlineClassesWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/InlineClassesWarnTest.kt index f57f1f19a4..e1e7a57700 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/InlineClassesWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/InlineClassesWarnTest.kt @@ -1,9 +1,9 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.common.config.rules.DIKTAT_COMMON +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.INLINE_CLASS_CAN_BE_USED -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.classes.InlineClassesRule import org.cqfn.diktat.util.LintTestBase @@ -173,7 +173,7 @@ class InlineClassesWarnTest : LintTestBase(::InlineClassesRule) { lintMethod( """ |class LocalCommandExecutor internal constructor(private val command: String) { - | + | |} """.trimMargin(), rulesConfigList = rulesConfigListSameVersion @@ -186,7 +186,7 @@ class InlineClassesWarnTest : LintTestBase(::InlineClassesRule) { lintMethod( """ |class LocalCommandExecutor public constructor(private val command: String) { - | + | |} """.trimMargin(), LintError(1, 1, ruleId, "${INLINE_CLASS_CAN_BE_USED.warnText()} class LocalCommandExecutor", false), @@ -200,7 +200,7 @@ class InlineClassesWarnTest : LintTestBase(::InlineClassesRule) { lintMethod( """ |class LocalCommandExecutor @Inject constructor(private val command: String) { - | + | |} """.trimMargin(), LintError(1, 1, ruleId, "${INLINE_CLASS_CAN_BE_USED.warnText()} class LocalCommandExecutor", false), diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/PropertyAccessorFieldsWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/PropertyAccessorFieldsWarnTest.kt index 9610a85a96..b488e8a577 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/PropertyAccessorFieldsWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/PropertyAccessorFieldsWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.WRONG_NAME_OF_VARIABLE_INSIDE_ACCESSOR -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.PropertyAccessorFields import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/RunInScriptWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/RunInScriptWarnTest.kt index 4b3fd01c36..440dbdf3dd 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/RunInScriptWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/RunInScriptWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.RUN_IN_SCRIPT -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.RunInScript import org.cqfn.diktat.util.LintTestBase @@ -19,12 +19,12 @@ class RunInScriptWarnTest : LintTestBase(::RunInScript) { lintMethod( """ class A {} - + fun foo() { } - + diktat {} - + diktat({}) foo/*df*/() @@ -33,16 +33,16 @@ class RunInScriptWarnTest : LintTestBase(::RunInScript) { 10 ) println("hello") - + w.map { it -> it } - + tasks.register("a") { dependsOn("b") doFirst { generateCodeStyle(file("rootDir/guide"), file("rootDir/../wp")) } } - + """.trimMargin(), LintError(10, 17, ruleId, "${RUN_IN_SCRIPT.warnText()} foo/*df*/()", true), LintError(12, 17, ruleId, "${RUN_IN_SCRIPT.warnText()} foo( //dfdg...", true), @@ -61,12 +61,12 @@ class RunInScriptWarnTest : LintTestBase(::RunInScript) { run { println("hello") } - + run{println("hello")} - + val task = tasks.register("a") { } - + """.trimMargin(), fileName = "src/main/kotlin/org/cqfn/diktat/Example.kts" ) @@ -80,9 +80,9 @@ class RunInScriptWarnTest : LintTestBase(::RunInScript) { custom { println("hello") } - + oneMore{println("hello")} - + another { println("hello") } @@ -97,16 +97,16 @@ class RunInScriptWarnTest : LintTestBase(::RunInScript) { lintMethod( """ class A {} - + fun foo() { } - + if(true) { goo() } - + diktat {} - + diktat({}) foo/*df*/() @@ -115,16 +115,16 @@ class RunInScriptWarnTest : LintTestBase(::RunInScript) { 10 ) println("hello") - + w.map { it -> it } - + (tasks.register("a") { dependsOn("b") doFirst { generateCodeStyle(file("rootDir/guide"), file("rootDir/../wp")) } }) - + """.trimMargin(), LintError(6, 17, ruleId, "${RUN_IN_SCRIPT.warnText()} if(true) {...", true), fileName = "src/main/kotlin/org/cqfn/diktat/builds.gradle.kts" @@ -137,13 +137,13 @@ class RunInScriptWarnTest : LintTestBase(::RunInScript) { lintMethod( """ version = "0.1.0-SNAPSHOT" - + diktat {} - + diktat({}) foo/*df*/() - + foo().goo() """.trimMargin(), fileName = "src/main/kotlin/org/cqfn/diktat/builds.gradle.kts" @@ -156,9 +156,9 @@ class RunInScriptWarnTest : LintTestBase(::RunInScript) { lintMethod( """ version = "0.1.0-SNAPSHOT" - + diktat {} - + diktat({}) foo/*df*/() diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleConstructorRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleConstructorRuleWarnTest.kt index 72faf205ee..fe9f1b8066 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleConstructorRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleConstructorRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.SINGLE_CONSTRUCTOR_SHOULD_BE_PRIMARY -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.classes.SingleConstructorRule import org.cqfn.diktat.util.LintTestBase @@ -30,7 +30,7 @@ class SingleConstructorRuleWarnTest : LintTestBase(::SingleConstructorRule) { fun `should suggest to convert single constructor to primary`() { lintMethod( """ - |class Test { + |class Test { | var a: Int | | constructor(a: Int) { diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleInitRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleInitRuleWarnTest.kt index 184c959e6d..ebde70f1b6 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleInitRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleInitRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.classes.SingleInitRule import org.cqfn.diktat.util.LintTestBase @@ -32,9 +32,9 @@ class SingleInitRuleWarnTest : LintTestBase(::SingleInitRule) { """ |class Example { | init { println("Lorem ipsum") } - | + | | val foo = 0 - | + | | init { println("Dolor sit amet") } |} """.trimMargin(), @@ -66,11 +66,11 @@ class SingleInitRuleWarnTest : LintTestBase(::SingleInitRule) { |class A { | var a: String | var c: String - | + | | init { | val b: String = "a" | a = b - | + | | val d: String = "c" | c = foo(d) | } diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/StatelessClassesRuleWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/StatelessClassesRuleWarnTest.kt index ca32b442ac..17f9ffe53b 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/StatelessClassesRuleWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/StatelessClassesRuleWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.classes.StatelessClassesRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/TrivialPropertyAccessorsWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/TrivialPropertyAccessorsWarnTest.kt index 863467bbec..7ef6e71bf7 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/TrivialPropertyAccessorsWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/TrivialPropertyAccessorsWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.TrivialPropertyAccessors import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UseLastIndexWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UseLastIndexWarnTest.kt index 875ccf1d13..444b3eee2b 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UseLastIndexWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UseLastIndexWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.UseLastIndex import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UselessSupertypeWarnTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UselessSupertypeWarnTest.kt index 03e47e26f4..45aaf6f58b 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UselessSupertypeWarnTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UselessSupertypeWarnTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.chapter6 +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings.USELESS_SUPERTYPE -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter6.UselessSupertype import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSmokeTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSmokeTest.kt index d92fd08eb2..d0578e8a0a 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSmokeTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSmokeTest.kt @@ -1,6 +1,7 @@ package org.cqfn.diktat.ruleset.smoke import org.cqfn.diktat.common.config.rules.DIKTAT_COMMON +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.common.config.rules.RulesConfigReader import org.cqfn.diktat.ruleset.constants.Warnings @@ -13,7 +14,6 @@ import org.cqfn.diktat.ruleset.constants.Warnings.MISSING_KDOC_CLASS_ELEMENTS import org.cqfn.diktat.ruleset.constants.Warnings.MISSING_KDOC_ON_FUNCTION import org.cqfn.diktat.ruleset.constants.Warnings.MISSING_KDOC_TOP_LEVEL import org.cqfn.diktat.ruleset.constants.Warnings.WRONG_INDENTATION -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.DiktatRuleSetProvider import org.cqfn.diktat.ruleset.rules.chapter1.FileNaming import org.cqfn.diktat.ruleset.rules.chapter2.comments.CommentsRule diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/utils/SuppressAnnotatedExpressionTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/utils/SuppressAnnotatedExpressionTest.kt index e796002588..0dad0f35d3 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/utils/SuppressAnnotatedExpressionTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/utils/SuppressAnnotatedExpressionTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.utils +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.CollapseIfStatementsRule import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/utils/SuppressTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/utils/SuppressTest.kt index e9e9bb8b55..8cfbd3f781 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/utils/SuppressTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/utils/SuppressTest.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.utils +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.constants.Warnings -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming import org.cqfn.diktat.util.LintTestBase diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/DiktatRuleSetProvider4Test.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/DiktatRuleSetProvider4Test.kt index e937a6cb00..4cc3705dfd 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/DiktatRuleSetProvider4Test.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/DiktatRuleSetProvider4Test.kt @@ -4,9 +4,9 @@ package org.cqfn.diktat.util +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.common.config.rules.RulesConfigReader -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.DiktatRuleSetProvider import org.cqfn.diktat.ruleset.rules.OrderedRuleSet.Companion.delegatee diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/DiktatRuleTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/DiktatRuleTest.kt index eaf055b381..5dce75a75d 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/DiktatRuleTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/DiktatRuleTest.kt @@ -1,9 +1,9 @@ package org.cqfn.diktat.util +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.BLANK_LINE_BETWEEN_PROPERTIES import org.cqfn.diktat.ruleset.constants.Warnings.WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter3.ClassLikeStructuresOrderRule import com.pinterest.ktlint.core.LintError diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/LintTestBase.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/LintTestBase.kt index 9c56f17992..8c0d888083 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/LintTestBase.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/LintTestBase.kt @@ -5,7 +5,6 @@ import org.cqfn.diktat.common.config.rules.RulesConfig import com.pinterest.ktlint.core.KtLint import com.pinterest.ktlint.core.LintError import com.pinterest.ktlint.core.Rule -import com.pinterest.ktlint.core.api.FeatureInAlphaState import org.intellij.lang.annotations.Language /** @@ -43,7 +42,6 @@ open class LintTestBase(private val ruleSupplier: (rulesConfigList: List? = null, @@ -60,7 +58,6 @@ open class LintTestBase(private val ruleSupplier: (rulesConfigList: List lintErrors += lintError }, - userData = mapOf("file_path" to actualFileName) ) ) diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/SuppressingTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/SuppressingTest.kt index 1c0ad14c66..dfd122210a 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/SuppressingTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/SuppressingTest.kt @@ -1,8 +1,8 @@ package org.cqfn.diktat.util +import org.cqfn.diktat.common.config.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.constants.Warnings.IDENTIFIER_LENGTH -import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming import com.pinterest.ktlint.core.LintError diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/TestUtils.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/TestUtils.kt index f46bea499a..42d8374497 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/TestUtils.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/TestUtils.kt @@ -12,7 +12,6 @@ import com.pinterest.ktlint.core.LintError import com.pinterest.ktlint.core.Rule import com.pinterest.ktlint.core.RuleSet import com.pinterest.ktlint.core.RuleSetProvider -import com.pinterest.ktlint.core.VisitorProvider import com.pinterest.ktlint.core.api.FeatureInAlphaState import org.assertj.core.api.Assertions import org.assertj.core.api.SoftAssertions @@ -81,7 +80,6 @@ internal fun List.assertEquals(vararg expectedLintErrors: LintError) * @param cb callback to be called on unhandled [LintError]s * @return formatted code */ -@OptIn(FeatureInAlphaState::class) @Suppress("LAMBDA_IS_NOT_LAST_PARAMETER") internal fun format(ruleSetProviderRef: (rulesConfigList: List?) -> RuleSetProvider, @Language("kotlin") text: String, @@ -97,13 +95,7 @@ internal fun format(ruleSetProviderRef: (rulesConfigList: List?) -> fileName = fileName.removeSuffix("_copy"), script = fileName.removeSuffix("_copy").endsWith("kts"), cb = cb, - userData = mapOf("file_path" to fileName.removeSuffix("_copy")), - ), - VisitorProvider( - ruleSets = ruleSets, debug = true, - // setting this to `true` breaks smoke test - isUnitTestContext = false, ) ) } diff --git a/pom.xml b/pom.xml index 4249f28777..f327d1973c 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ true official 1.3.3 - 0.45.2 + 0.46.1 5.8.2 31.1-jre 1.7.36