From 27897f02460b8261c538178274427e3107f70d9d Mon Sep 17 00:00:00 2001 From: Peter Trifanov Date: Mon, 28 Dec 2020 18:47:08 +0300 Subject: [PATCH 01/50] Use gradle for project build ### What's done: * First WIP --- build.gradle.kts | 18 ++++++++++++++++++ {info/buildSrc => buildSrc}/build.gradle.kts | 0 {info/buildSrc => buildSrc}/gradle.properties | 0 .../src/main/kotlin/JunitConfiguration.kt | 15 +++++++++++++++ buildSrc/src/main/kotlin/Versions.kt | 8 ++++++++ .../generation/docs/FullDocGenerator.kt | 0 .../docs/GenerationAvailableRules.kt | 0 .../diktat/generation/docs/GenerationDocs.kt | 0 .../cqfn/diktat/generation/docs/LatexUtils.kt | 0 .../generation/docs/WarningsTableGenerator.kt | 0 diktat-common/build.gradle.kts | 14 ++++++++++++++ diktat-gradle-plugin/build.gradle.kts | 2 +- diktat-rules/build.gradle.kts | 10 ++++++++++ diktat-test-framework/build.gradle.kts | 16 ++++++++++++++++ .../wrapper/gradle-wrapper.jar | Bin .../wrapper/gradle-wrapper.properties | 0 diktat-gradle-plugin/gradlew => gradlew | 0 .../gradlew.bat => gradlew.bat | 0 settings.gradle.kts | 5 +++++ 19 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 build.gradle.kts rename {info/buildSrc => buildSrc}/build.gradle.kts (100%) rename {info/buildSrc => buildSrc}/gradle.properties (100%) create mode 100644 buildSrc/src/main/kotlin/JunitConfiguration.kt create mode 100644 buildSrc/src/main/kotlin/Versions.kt rename {info/buildSrc => buildSrc}/src/main/kotlin/org/cqfn/diktat/generation/docs/FullDocGenerator.kt (100%) rename {info/buildSrc => buildSrc}/src/main/kotlin/org/cqfn/diktat/generation/docs/GenerationAvailableRules.kt (100%) rename {info/buildSrc => buildSrc}/src/main/kotlin/org/cqfn/diktat/generation/docs/GenerationDocs.kt (100%) rename {info/buildSrc => buildSrc}/src/main/kotlin/org/cqfn/diktat/generation/docs/LatexUtils.kt (100%) rename {info/buildSrc => buildSrc}/src/main/kotlin/org/cqfn/diktat/generation/docs/WarningsTableGenerator.kt (100%) create mode 100644 diktat-common/build.gradle.kts create mode 100644 diktat-rules/build.gradle.kts create mode 100644 diktat-test-framework/build.gradle.kts rename {diktat-gradle-plugin/gradle => gradle}/wrapper/gradle-wrapper.jar (100%) rename {diktat-gradle-plugin/gradle => gradle}/wrapper/gradle-wrapper.properties (100%) rename diktat-gradle-plugin/gradlew => gradlew (100%) mode change 100755 => 100644 rename diktat-gradle-plugin/gradlew.bat => gradlew.bat (100%) mode change 100755 => 100644 create mode 100644 settings.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000000..d8bfd421fc --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + kotlin("jvm") version Versions.Kotlin apply false + id("org.cqfn.diktat.diktat-gradle-plugin") version Versions.Diktat +} + +allprojects { + repositories { + jcenter() + } +} + +// diktat config is TODO +diktat { + inputs = files("**/src/main/kotlin/**/*.kt", + "**/src/test/kotlin/**/*.kt", + "buildSrc/**/*.kt") + excludes = files("**/resources/**/*.kt", "**/target/**/*.kt") +} \ No newline at end of file diff --git a/info/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts similarity index 100% rename from info/buildSrc/build.gradle.kts rename to buildSrc/build.gradle.kts diff --git a/info/buildSrc/gradle.properties b/buildSrc/gradle.properties similarity index 100% rename from info/buildSrc/gradle.properties rename to buildSrc/gradle.properties diff --git a/buildSrc/src/main/kotlin/JunitConfiguration.kt b/buildSrc/src/main/kotlin/JunitConfiguration.kt new file mode 100644 index 0000000000..0a5f91caf0 --- /dev/null +++ b/buildSrc/src/main/kotlin/JunitConfiguration.kt @@ -0,0 +1,15 @@ +import org.gradle.api.Project +import org.gradle.api.tasks.testing.Test +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.withType + +fun Project.configureJunit() { + this.dependencies { + add("testImplementation", "org.junit.jupiter:junit-jupiter:${Versions.Junit}") + add("testImplementation", "org.assertj:assertj-core:${Versions.Assert4J}") + } + + tasks.withType { + useJUnitPlatform() + } +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt new file mode 100644 index 0000000000..2fea82740f --- /dev/null +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -0,0 +1,8 @@ +object Versions { + const val Kotlin = "1.4.21" + const val Serialization = "1.0.1" + const val Slf4j = "1.7.30" + const val Junit = "5.7.0" + const val Assert4J = "3.18.0" + const val Diktat = "0.1.7" +} diff --git a/info/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/FullDocGenerator.kt b/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/FullDocGenerator.kt similarity index 100% rename from info/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/FullDocGenerator.kt rename to buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/FullDocGenerator.kt diff --git a/info/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/GenerationAvailableRules.kt b/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/GenerationAvailableRules.kt similarity index 100% rename from info/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/GenerationAvailableRules.kt rename to buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/GenerationAvailableRules.kt diff --git a/info/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/GenerationDocs.kt b/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/GenerationDocs.kt similarity index 100% rename from info/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/GenerationDocs.kt rename to buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/GenerationDocs.kt diff --git a/info/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/LatexUtils.kt b/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/LatexUtils.kt similarity index 100% rename from info/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/LatexUtils.kt rename to buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/LatexUtils.kt diff --git a/info/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/WarningsTableGenerator.kt b/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/WarningsTableGenerator.kt similarity index 100% rename from info/buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/WarningsTableGenerator.kt rename to buildSrc/src/main/kotlin/org/cqfn/diktat/generation/docs/WarningsTableGenerator.kt diff --git a/diktat-common/build.gradle.kts b/diktat-common/build.gradle.kts new file mode 100644 index 0000000000..f10252cdf6 --- /dev/null +++ b/diktat-common/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + kotlin("jvm") + kotlin("plugin.serialization") version Versions.Kotlin +} + +dependencies { + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:${Versions.Serialization}") + implementation("com.charleskorn.kaml:kaml:0.26.0") + implementation("commons-cli:commons-cli:1.4") + implementation("org.slf4j:slf4j-api:${Versions.Slf4j}") + implementation("org.slf4j:slf4j-log4j12:${Versions.Slf4j}") +} + +configureJunit() diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index ca92fc0640..602f7b0813 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -3,7 +3,7 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurr plugins { `java-gradle-plugin` - kotlin("jvm") version "1.4.21" + kotlin("jvm") jacoco id("pl.droidsonroids.jacoco.testkit") version "1.0.7" } diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts new file mode 100644 index 0000000000..0cba055efd --- /dev/null +++ b/diktat-rules/build.gradle.kts @@ -0,0 +1,10 @@ +plugins { + kotlin("jvm") +} + +dependencies { + implementation(project(":diktat-common")) + testImplementation(project(":diktat-test-framework")) +} + +configureJunit() diff --git a/diktat-test-framework/build.gradle.kts b/diktat-test-framework/build.gradle.kts new file mode 100644 index 0000000000..f8d65983b5 --- /dev/null +++ b/diktat-test-framework/build.gradle.kts @@ -0,0 +1,16 @@ +plugins { + kotlin("jvm") + kotlin("plugin.serialization") version Versions.Kotlin +} + +dependencies { + implementation(project(":diktat-common")) + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:${Versions.Serialization}") + implementation("commons-cli:commons-cli:1.4") + implementation("commons-io:commons-io:2.8.0") + implementation("org.slf4j:slf4j-api:${Versions.Slf4j}") + implementation("org.slf4j:slf4j-log4j12:${Versions.Slf4j}") + implementation("io.github.java-diff-utils:java-diff-utils:4.9") +} + +configureJunit() diff --git a/diktat-gradle-plugin/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from diktat-gradle-plugin/gradle/wrapper/gradle-wrapper.jar rename to gradle/wrapper/gradle-wrapper.jar diff --git a/diktat-gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from diktat-gradle-plugin/gradle/wrapper/gradle-wrapper.properties rename to gradle/wrapper/gradle-wrapper.properties diff --git a/diktat-gradle-plugin/gradlew b/gradlew old mode 100755 new mode 100644 similarity index 100% rename from diktat-gradle-plugin/gradlew rename to gradlew diff --git a/diktat-gradle-plugin/gradlew.bat b/gradlew.bat old mode 100755 new mode 100644 similarity index 100% rename from diktat-gradle-plugin/gradlew.bat rename to gradlew.bat diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000000..379ed4ee79 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,5 @@ +include("diktat-common") +include("diktat-test-framework") +include("diktat-rules") +include("diktat-gradle-plugin") +include("info") \ No newline at end of file From c22b18b0749997345b779ed1717072c5b70776fb Mon Sep 17 00:00:00 2001 From: Peter Trifanov Date: Wed, 13 Jan 2021 10:31:16 +0300 Subject: [PATCH 02/50] Use gradle for project build ### What's done: * WIP --- build.gradle.kts | 1 + buildSrc/src/main/kotlin/Versions.kt | 4 +++- diktat-common/build.gradle.kts | 2 +- diktat-gradle-plugin/build.gradle.kts | 26 ++++++++------------------ 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d8bfd421fc..4747547fbc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ plugins { kotlin("jvm") version Versions.Kotlin apply false + kotlin("plugin.serialization") version Versions.Kotlin apply false id("org.cqfn.diktat.diktat-gradle-plugin") version Versions.Diktat } diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 2fea82740f..89dc6b8a1b 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -4,5 +4,7 @@ object Versions { const val Slf4j = "1.7.30" const val Junit = "5.7.0" const val Assert4J = "3.18.0" - const val Diktat = "0.1.7" + const val KtLint = "0.39.0" + const val Diktat = "0.3.0" + const val Jacoco = "0.8.6" } diff --git a/diktat-common/build.gradle.kts b/diktat-common/build.gradle.kts index f10252cdf6..1fa3aa7257 100644 --- a/diktat-common/build.gradle.kts +++ b/diktat-common/build.gradle.kts @@ -1,6 +1,6 @@ plugins { kotlin("jvm") - kotlin("plugin.serialization") version Versions.Kotlin + kotlin("plugin.serialization") } dependencies { diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index 602f7b0813..da0fe90d1f 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -9,31 +9,21 @@ plugins { } repositories { - flatDir { - // to use snapshot diktat without necessary installing - dirs("../diktat-rules/target") - } - mavenLocal() // to use snapshot diktat mavenCentral() jcenter() } -// default value is needed for correct gradle loading in IDEA; actual value from maven is used during build -val ktlintVersion = project.properties.getOrDefault("ktlintVersion", "0.39.0") as String -val diktatVersion = project.version.takeIf { it.toString() != Project.DEFAULT_VERSION } ?: "0.1.7" -val junitVersion = project.properties.getOrDefault("junitVersion", "5.7.0") as String -val jacocoVersion = project.properties.getOrDefault("jacocoVersion", "0.8.6") as String dependencies { implementation(kotlin("gradle-plugin-api")) - implementation("com.pinterest.ktlint:ktlint-core:$ktlintVersion") { + implementation("com.pinterest.ktlint:ktlint-core:${Versions.KtLint}") { exclude("com.pinterest.ktlint", "ktlint-ruleset-standard") } - implementation("com.pinterest.ktlint:ktlint-reporter-plain:$ktlintVersion") - implementation("org.cqfn.diktat:diktat-rules:$diktatVersion") + implementation("com.pinterest.ktlint:ktlint-reporter-plain:${Versions.KtLint}") + implementation(project(":diktat-rules")) - testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion") + testImplementation("org.junit.jupiter:junit-jupiter-api:${Versions.Junit}") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Versions.Junit}") } val generateVersionsFile by tasks.registering { @@ -47,8 +37,8 @@ val generateVersionsFile by tasks.registering { """ package generated - internal const val DIKTAT_VERSION = "$diktatVersion" - internal const val KTLINT_VERSION = "$ktlintVersion" + internal const val DIKTAT_VERSION = "$version" + internal const val KTLINT_VERSION = "${Versions.KtLint}" """.trimIndent() ) @@ -86,7 +76,7 @@ val jacocoMergeTask by tasks.register("jacocoMerge") tasks.withType { useJUnitPlatform() } -jacoco.toolVersion = jacocoVersion +jacoco.toolVersion = Versions.Jacoco // === integration testing // fixme: should probably use KotlinSourceSet instead From 55d6d6f21a112acc8da374714a9fcb18cd0be961 Mon Sep 17 00:00:00 2001 From: Peter Trifanov Date: Wed, 13 Jan 2021 11:31:15 +0300 Subject: [PATCH 03/50] Use gradle for project build ### What's done: * configureDiktat --- build.gradle.kts | 10 +--------- buildSrc/build.gradle.kts | 10 ++-------- buildSrc/src/main/kotlin/DiktatConfiguration.kt | 15 +++++++++++++++ diktat-test-framework/build.gradle.kts | 2 +- 4 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 buildSrc/src/main/kotlin/DiktatConfiguration.kt diff --git a/build.gradle.kts b/build.gradle.kts index 4747547fbc..841b160272 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,19 +1,11 @@ plugins { kotlin("jvm") version Versions.Kotlin apply false kotlin("plugin.serialization") version Versions.Kotlin apply false - id("org.cqfn.diktat.diktat-gradle-plugin") version Versions.Diktat } allprojects { repositories { jcenter() } + configureDiktat() } - -// diktat config is TODO -diktat { - inputs = files("**/src/main/kotlin/**/*.kt", - "**/src/test/kotlin/**/*.kt", - "buildSrc/**/*.kt") - excludes = files("**/resources/**/*.kt", "**/target/**/*.kt") -} \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 9937a3e544..eabd37d443 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -4,15 +4,9 @@ plugins { repositories { jcenter() - mavenLocal() - flatDir { - dirs( - "$rootDir/../../diktat-rules/target", - "$rootDir/../../diktat-common/target" - ) - } } dependencies { - implementation("org.cqfn.diktat:diktat-rules:$version") + implementation("org.cqfn.diktat:diktat-rules:0.3.0") // todo correct version of current build? + implementation("org.cqfn.diktat:diktat-gradle-plugin:0.3.0") } diff --git a/buildSrc/src/main/kotlin/DiktatConfiguration.kt b/buildSrc/src/main/kotlin/DiktatConfiguration.kt new file mode 100644 index 0000000000..ceeda27038 --- /dev/null +++ b/buildSrc/src/main/kotlin/DiktatConfiguration.kt @@ -0,0 +1,15 @@ +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.configure +import org.cqfn.diktat.plugin.gradle.DiktatGradlePlugin +import org.cqfn.diktat.plugin.gradle.DiktatExtension + +fun Project.configureDiktat() { + apply() + configure { + debug = true + inputs = files("src/main/kotlin/**/*.kt", "src/test/kotlin/**/*.kt") + excludes = files("src/main/kotlin/generated/**/*.kt") + diktatConfigFile = file("diktat-analysis.yml") + } +} \ No newline at end of file diff --git a/diktat-test-framework/build.gradle.kts b/diktat-test-framework/build.gradle.kts index f8d65983b5..b24d3597b4 100644 --- a/diktat-test-framework/build.gradle.kts +++ b/diktat-test-framework/build.gradle.kts @@ -1,6 +1,6 @@ plugins { kotlin("jvm") - kotlin("plugin.serialization") version Versions.Kotlin + kotlin("plugin.serialization") } dependencies { From c975f81a783a7cac12dcaff43299776c4404dd63 Mon Sep 17 00:00:00 2001 From: Peter Trifanov Date: Wed, 13 Jan 2021 14:37:48 +0300 Subject: [PATCH 04/50] Move project build to gradle ### What's done: * WIP --- build.gradle.kts | 14 ++++++++++ .../src/main/kotlin/DiktatConfiguration.kt | 3 ++- buildSrc/src/main/kotlin/Versions.kt | 3 ++- diktat-common/build.gradle.kts | 4 +-- diktat-rules/build.gradle.kts | 26 +++++++++++++++++++ .../kotlin}/generation/Generation.kt | 4 +-- diktat-test-framework/build.gradle.kts | 2 +- .../gradle.properties => gradle.properties | 0 gradle/wrapper/gradle-wrapper.properties | 2 +- 9 files changed, 50 insertions(+), 8 deletions(-) rename diktat-rules/src/{main/kotlin/org/cqfn/diktat/ruleset => generators/kotlin}/generation/Generation.kt (92%) rename buildSrc/gradle.properties => gradle.properties (100%) diff --git a/build.gradle.kts b/build.gradle.kts index 841b160272..a2927df374 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { kotlin("jvm") version Versions.Kotlin apply false kotlin("plugin.serialization") version Versions.Kotlin apply false @@ -7,5 +9,17 @@ allprojects { repositories { jcenter() } + tasks.withType { + kotlinOptions { + jvmTarget = "1.8" + } + } configureDiktat() } + +tasks.register("diktatCheckAll") { + group = "verification" + allprojects { + this@register.dependsOn(tasks.getByName("diktatCheck")) + } +} diff --git a/buildSrc/src/main/kotlin/DiktatConfiguration.kt b/buildSrc/src/main/kotlin/DiktatConfiguration.kt index ceeda27038..fbd597ad3f 100644 --- a/buildSrc/src/main/kotlin/DiktatConfiguration.kt +++ b/buildSrc/src/main/kotlin/DiktatConfiguration.kt @@ -3,6 +3,7 @@ import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.configure import org.cqfn.diktat.plugin.gradle.DiktatGradlePlugin import org.cqfn.diktat.plugin.gradle.DiktatExtension +import java.io.File fun Project.configureDiktat() { apply() @@ -10,6 +11,6 @@ fun Project.configureDiktat() { debug = true inputs = files("src/main/kotlin/**/*.kt", "src/test/kotlin/**/*.kt") excludes = files("src/main/kotlin/generated/**/*.kt") - diktatConfigFile = file("diktat-analysis.yml") + diktatConfigFile = File("diktat-analysis.yml") } } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 89dc6b8a1b..6511997281 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -5,6 +5,7 @@ object Versions { const val Junit = "5.7.0" const val Assert4J = "3.18.0" const val KtLint = "0.39.0" - const val Diktat = "0.3.0" +// const val Diktat = "0.3.0" const val Jacoco = "0.8.6" + const val Guava = "30.0-jre" } diff --git a/diktat-common/build.gradle.kts b/diktat-common/build.gradle.kts index 1fa3aa7257..269c3fe7fd 100644 --- a/diktat-common/build.gradle.kts +++ b/diktat-common/build.gradle.kts @@ -4,8 +4,8 @@ plugins { } dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:${Versions.Serialization}") - implementation("com.charleskorn.kaml:kaml:0.26.0") + api("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:${Versions.Serialization}") + api("com.charleskorn.kaml:kaml:0.26.0") implementation("commons-cli:commons-cli:1.4") implementation("org.slf4j:slf4j-api:${Versions.Slf4j}") implementation("org.slf4j:slf4j-log4j12:${Versions.Slf4j}") diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index 0cba055efd..fe41191aef 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -4,7 +4,33 @@ plugins { dependencies { implementation(project(":diktat-common")) + implementation("com.pinterest.ktlint:ktlint-core:${Versions.KtLint}") + implementation("com.google.guava:guava:${Versions.Guava}") + implementation("org.slf4j:slf4j-api:${Versions.Slf4j}") + implementation("org.slf4j:slf4j-log4j12:${Versions.Slf4j}") + testImplementation(project(":diktat-test-framework")) + testImplementation("org.mockito:mockito-all:1.10.19") } configureJunit() + +val generators: Configuration by configurations.creating { + dependencies.add( + project.dependencies.create("com.squareup:kotlinpoet:1.7.1") + ) + dependencies.addAll(configurations.implementation.get().dependencies) +} +sourceSets.create("generators") { + compileClasspath += sourceSets.main.get().output + generators + runtimeClasspath += sourceSets.main.get().output + generators +} + +tasks.register("generateWarningNames", JavaExec::class) { + dependsOn("compileKotlin") + classpath(sourceSets.getByName("generators").runtimeClasspath) + mainClass.set("org.cqfn.diktat.ruleset.generation.GenerationKt") + workingDir(project.projectDir) // to ensure path to files can be set relative to diktat-rules +} + +tasks.getByName("compileTestKotlin").dependsOn("generateWarningNames") diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt b/diktat-rules/src/generators/kotlin/generation/Generation.kt similarity index 92% rename from diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt rename to diktat-rules/src/generators/kotlin/generation/Generation.kt index 93cd94ddbb..b2c46c15d8 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt +++ b/diktat-rules/src/generators/kotlin/generation/Generation.kt @@ -53,11 +53,11 @@ private fun generateWarningNames() { .addComment(autoGenerationComment) .build() - kotlinFile.writeTo(File("diktat-rules/src/main/kotlin")) // fixme: need to add it to pom + kotlinFile.writeTo(File("src/main/kotlin")) // fixme: need to add it to build.gradle } private fun validateYear() { - val file = File("diktat-rules/src/test/resources/test/paragraph2/header/CopyrightDifferentYearExpected.kt") + val file = File("src/test/resources/test/paragraph2/header/CopyrightDifferentYearExpected.kt") val tempFile = createTempFile() tempFile.printWriter().use { writer -> file.forEachLine { line -> diff --git a/diktat-test-framework/build.gradle.kts b/diktat-test-framework/build.gradle.kts index b24d3597b4..79d68997d8 100644 --- a/diktat-test-framework/build.gradle.kts +++ b/diktat-test-framework/build.gradle.kts @@ -5,7 +5,7 @@ plugins { dependencies { implementation(project(":diktat-common")) - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:${Versions.Serialization}") + api("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:${Versions.Serialization}") implementation("commons-cli:commons-cli:1.4") implementation("commons-io:commons-io:2.8.0") implementation("org.slf4j:slf4j-api:${Versions.Slf4j}") diff --git a/buildSrc/gradle.properties b/gradle.properties similarity index 100% rename from buildSrc/gradle.properties rename to gradle.properties diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4d9ca16491..da9702f9e7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 33c8d9d726a119a5efb6c67e3c177be3ca9b256e Mon Sep 17 00:00:00 2001 From: Peter Trifanov Date: Wed, 13 Jan 2021 15:18:29 +0300 Subject: [PATCH 05/50] Move project build to gradle ### What's done: * build_and_test.yml converted to gradle --- .github/workflows/build_and_test.yml | 39 +++++++++++++++------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 6dbc1c6113..f5fcb8a822 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -3,6 +3,9 @@ name: Build and test on: pull_request +env: + GRADLE_OPTS: -Dorg.gradle.daemon=false + jobs: build_and_test_with_code_coverage: name: Build, test and upload code coverage @@ -15,17 +18,16 @@ jobs: uses: actions/setup-java@v1 with: java-version: 1.11 - - name: Cache local Maven repository + - name: Cache local Gradle repository uses: actions/cache@v2 with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-build-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-build- - - name: Maven Package - run: mvn -B clean package -DskipTests - - name: Maven Install - run: mvn -B install + path: | + ~/.gradle/caches/ + ~/.gradle/wrapper/ + key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*') }} + restore-keys: ${{ runner.os }}-gradle-build- + - name: Gradle Build + run: gradlew build - name: Code coverage report uses: codecov/codecov-action@v1 with: @@ -101,22 +103,23 @@ jobs: uses: actions/setup-java@v1 with: java-version: 1.11 - - name: Cache local Maven repository + - name: Cache local Gradle repository uses: actions/cache@v2 with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-build-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-build- + path: | + ~/.gradle/caches/ + ~/.gradle/wrapper/ + key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*') }} + restore-keys: ${{ runner.os }}-gradle-build- - - name: Maven Install + - name: Gradle Build if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} run: | - mvn -B clean install + gradlew build shell: bash - - name: Maven Install on windows + - name: Gradle Build on windows if: runner.os == 'Windows' run: | - mvn -B clean install + gradlew.bat build shell: cmd From b6f703b44fc8d9b13cb6c914fcd4164e6249b8d3 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Tue, 14 Mar 2023 16:43:33 +0300 Subject: [PATCH 06/50] Migration to Gradle ### What's done: - move gradlew to root directory --- build.gradle.kts | 29 +++ diktat-common/build.gradle.kts | 16 ++ .../{build.gradle.kts => build.gradle.kts_} | 20 +- diktat-gradle-plugin/settings.gradle.kts | 6 - diktat-maven-plugin/build.gradle.kts | 14 ++ diktat-rules/build.gradle.kts | 20 ++ diktat-ruleset/build.gradle.kts | 14 ++ diktat-test-framework/build.gradle.kts | 18 ++ gradle.properties | 13 ++ gradle/libs.versions.toml | 185 ++++++++++++++++++ gradle/plugins/build.gradle.kts | 40 ++++ gradle/plugins/settings.gradle.kts | 9 + gradle/plugins/src/main/kotlin/Versions.kt | 8 + .../save/buildutils/GitHookInstallation.kt | 23 +++ .../save/buildutils/JacocoConfiguration.kt | 36 ++++ .../buildutils/PublishingConfiguration.kt | 166 ++++++++++++++++ .../buildutils/VersioningConfiguration.kt | 46 +++++ .../code-quality-convention.gradle.kts | 10 + ...detekt-convention-configuration.gradle.kts | 39 ++++ ...diktat-convention-configuration.gradle.kts | 29 +++ .../kotlin-jvm-configuration.gradle.kts | 26 +++ .../publishing-configuration.gradle.kts | 37 ++++ ...otless-convention-configuration.gradle.kts | 36 ++++ .../versioning-configuration.gradle.kts | 3 + .../wrapper/gradle-wrapper.jar | Bin 61574 -> 61608 bytes .../wrapper/gradle-wrapper.properties | 2 +- diktat-gradle-plugin/gradlew => gradlew | 4 +- .../gradlew.bat => gradlew.bat | 0 info/gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle.kts | 39 ++++ 30 files changed, 862 insertions(+), 28 deletions(-) create mode 100644 build.gradle.kts create mode 100644 diktat-common/build.gradle.kts rename diktat-gradle-plugin/{build.gradle.kts => build.gradle.kts_} (91%) delete mode 100644 diktat-gradle-plugin/settings.gradle.kts create mode 100644 diktat-maven-plugin/build.gradle.kts create mode 100644 diktat-rules/build.gradle.kts create mode 100644 diktat-ruleset/build.gradle.kts create mode 100644 diktat-test-framework/build.gradle.kts create mode 100644 gradle.properties create mode 100644 gradle/libs.versions.toml create mode 100644 gradle/plugins/build.gradle.kts create mode 100644 gradle/plugins/settings.gradle.kts create mode 100644 gradle/plugins/src/main/kotlin/Versions.kt create mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/GitHookInstallation.kt create mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/JacocoConfiguration.kt create mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/PublishingConfiguration.kt create mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/VersioningConfiguration.kt create mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/code-quality-convention.gradle.kts create mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/detekt-convention-configuration.gradle.kts create mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/diktat-convention-configuration.gradle.kts create mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/kotlin-jvm-configuration.gradle.kts create mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/publishing-configuration.gradle.kts create mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/spotless-convention-configuration.gradle.kts create mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/versioning-configuration.gradle.kts rename {diktat-gradle-plugin/gradle => gradle}/wrapper/gradle-wrapper.jar (67%) rename {diktat-gradle-plugin/gradle => gradle}/wrapper/gradle-wrapper.properties (92%) rename diktat-gradle-plugin/gradlew => gradlew (99%) mode change 100755 => 100644 rename diktat-gradle-plugin/gradlew.bat => gradlew.bat (100%) mode change 100755 => 100644 create mode 100644 settings.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000000..1de5c884b0 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,29 @@ +import com.saveourtool.save.buildutils.* + +@Suppress("DSL_SCOPE_VIOLATION", "RUN_IN_SCRIPT") // https://github.com/gradle/gradle/issues/22797 +plugins { + id("com.saveourtool.save.buildutils.versioning-configuration") +// id("com.saveourtool.save.buildutils.code-quality-convention") + id("com.saveourtool.save.buildutils.publishing-configuration") + alias(libs.plugins.talaiot.base) + java +} + +talaiot { + metrics { + // disabling due to problems with OSHI on some platforms + performanceMetrics = false + environmentMetrics = false + } + publishers { + timelinePublisher = true + } +} + +allprojects { + configurations.all { + // if SNAPSHOT dependencies are used, refresh them periodically + resolutionStrategy.cacheDynamicVersionsFor(10, TimeUnit.MINUTES) + resolutionStrategy.cacheChangingModulesFor(10, TimeUnit.MINUTES) + } +} diff --git a/diktat-common/build.gradle.kts b/diktat-common/build.gradle.kts new file mode 100644 index 0000000000..0588937aae --- /dev/null +++ b/diktat-common/build.gradle.kts @@ -0,0 +1,16 @@ +plugins { + id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") +// id("com.saveourtool.save.buildutils.code-quality-convention") +} + +dependencies { + implementation(libs.kotlin.stdlib.jdk8) + implementation(libs.kotlinx.serialization.json.jvm) + implementation(libs.kaml) + implementation(libs.apache.commons.cli) + implementation(libs.kotlin.logging) + // ktlint-core is needed only for `initKtLintKLogger` method + implementation(libs.ktlint.core) + testImplementation(libs.junit.jupiter) + testImplementation(libs.assertj.core) +} diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts_ similarity index 91% rename from diktat-gradle-plugin/build.gradle.kts rename to diktat-gradle-plugin/build.gradle.kts_ index 684e2326ec..3c2ccaaf08 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts_ @@ -9,34 +9,18 @@ plugins { id("org.gradle.test-retry") version "1.5.2" } -repositories { - flatDir { - // to use snapshot diktat without necessary installing - dirs("../diktat-common/target") - content { - includeGroup("org.cqfn.diktat") - } - } - mavenCentral() - mavenLocal { - // to use snapshot diktat - content { - includeGroup("org.cqfn.diktat") - } - } -} - // default value is needed for correct gradle loading in IDEA; actual value from maven is used during build // To debug gradle plugin, please set `diktatVersion` manually to the current maven project version. val ktlintVersion = project.properties.getOrDefault("ktlintVersion", "0.46.1") as String val diktatVersion = project.version.takeIf { it.toString() != Project.DEFAULT_VERSION } ?: "1.2.3" val junitVersion = project.properties.getOrDefault("junitVersion", "5.8.1") as String val jacocoVersion = project.properties.getOrDefault("jacocoVersion", "0.8.7") as String + dependencies { implementation(kotlin("gradle-plugin-api")) implementation("io.github.detekt.sarif4k:sarif4k:0.3.0") - implementation("org.cqfn.diktat:diktat-common:$diktatVersion") { + implementation(projects.diktatCommon) { 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/settings.gradle.kts b/diktat-gradle-plugin/settings.gradle.kts deleted file mode 100644 index 1442a83658..0000000000 --- a/diktat-gradle-plugin/settings.gradle.kts +++ /dev/null @@ -1,6 +0,0 @@ -pluginManagement { - repositories { - mavenCentral() - gradlePluginPortal() - } -} diff --git a/diktat-maven-plugin/build.gradle.kts b/diktat-maven-plugin/build.gradle.kts new file mode 100644 index 0000000000..ecc351a0be --- /dev/null +++ b/diktat-maven-plugin/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") + id("com.saveourtool.save.buildutils.code-quality-convention") +} + +dependencies { + api(projects.saveCloudCommon) + implementation(libs.spring.cloud.starter.gateway) + implementation(libs.spring.boot.starter.security) + implementation(libs.spring.boot.starter.oauth2.client) + implementation(libs.spring.cloud.starter.kubernetes.client.config) + implementation(libs.spring.security.core) + implementation(projects.authenticationService) +} diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts new file mode 100644 index 0000000000..b2b93a2a0b --- /dev/null +++ b/diktat-rules/build.gradle.kts @@ -0,0 +1,20 @@ +plugins { + id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") +// id("com.saveourtool.save.buildutils.code-quality-convention") +} + +dependencies { + implementation(projects.diktatCommon) + testImplementation(projects.diktatTestFramework) + implementation(libs.ktlint.core) + implementation(libs.kotlin.stdlib.jdk8) + // guava is used for string case utils + implementation(libs.guava) + implementation(libs.kotlin.logging) + testImplementation(libs.junit.jupiter) + testImplementation(libs.junit.platform.suite) + testImplementation(libs.assertj.core) + testImplementation(libs.mockito) + // is used for simplifying boolean expressions + implementation(libs.jbool.expressions) +} diff --git a/diktat-ruleset/build.gradle.kts b/diktat-ruleset/build.gradle.kts new file mode 100644 index 0000000000..ecc351a0be --- /dev/null +++ b/diktat-ruleset/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") + id("com.saveourtool.save.buildutils.code-quality-convention") +} + +dependencies { + api(projects.saveCloudCommon) + implementation(libs.spring.cloud.starter.gateway) + implementation(libs.spring.boot.starter.security) + implementation(libs.spring.boot.starter.oauth2.client) + implementation(libs.spring.cloud.starter.kubernetes.client.config) + implementation(libs.spring.security.core) + implementation(projects.authenticationService) +} diff --git a/diktat-test-framework/build.gradle.kts b/diktat-test-framework/build.gradle.kts new file mode 100644 index 0000000000..1e7abe3472 --- /dev/null +++ b/diktat-test-framework/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") +// id("com.saveourtool.save.buildutils.code-quality-convention") +} + +dependencies { + implementation(projects.diktatCommon) + implementation(libs.kotlin.stdlib.jdk8) + implementation(libs.apache.commons.cli) + implementation(libs.apache.commons.io) + implementation(libs.kotlin.logging) + implementation(libs.kotlin.multiplatform.diff) + testImplementation(libs.junit.jupiter) + testImplementation(libs.assertj.core) + + // FIXME: it should come as transitive dependency from projects.diktatCommon +// implementation(libs.kotlinx.serialization.json) +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000000..31df874aed --- /dev/null +++ b/gradle.properties @@ -0,0 +1,13 @@ +group=org.cqfn.diktat + +# gradle performance +org.gradle.jvmargs=-Xmx3g -XX:MaxMetaspaceSize=512m +org.gradle.parallel=true +org.gradle.vfs.watch=true + +# See +# +# If this is enabled, the Gradle Enterprise plug-in will be conflicting with +# the Test Retry plug-in (org.gradle.test-retry, +# ). +systemProp.gradle.enterprise.testretry.enabled=false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000000..2461bbf002 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,185 @@ +[versions] +kotlin = "1.8.10" +serialization = "1.5.0" +ktlint = "0.46.1" +junit = "5.9.1" +junit-platfrom = "1.9.1" +guava = "31.1-jre" +commons-cli = "1.5.0" +commons-io = "2.11.0" +diktat-check = "1.2.4.2" +kotlinpoet = "1.12.0" +detekt = "1.22.0" +dokka = "1.7.20" +jacoco = "0.8.8" +maven-plugin-tools = "3.7.0" +jbool = "1.24" +# downgraded to be compliance with ktlint +mu-logging = "2.1.23" +kaml = "0.47.0" +kotlin-multiplatform-diff = "0.4.0" +# FIXME: need to migrate to mockito +mockito-all = "1.10.19" + +# copied from save-cloud +jetbrains-annotations = "24.0.1" +save-cli = "0.3.9" +ktor = "2.2.4" +okio = "3.3.0" +kotlinx-datetime = "0.4.0" +kotlinx-coroutines = "1.6.4" +assertj = "3.24.2" +diktat = "1.2.4.1" +jgit = "6.5.0.202303070854-r" +mockito = "5.2.0" +mockito-kotlin = "4.1.0" +# only in save-cli +log4j = "2.20.0" +testcontainers = "1.17.6" +okhttp3 = "4.10.0" +reckon = "0.16.1" +commons-compress = "1.22" +zip4j = "2.11.5" +ktoml = "0.4.1" +springdoc = "1.6.15" +kotlinx-cli = "0.3.5" +spotless = "6.17.0" +arrow-kt = "1.1.5" +publish = "1.3.0" +download = "5.3.1" + +[plugins] +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +kotlin-plugin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlin" } +kotlin-plugin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" } +talaiot-base = { id = "io.github.cdsap.talaiot.plugin.base", version = "1.5.3" } +detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } +spotless = { id = "com.diffplug.gradle.spotless", version.ref = "spotless" } +download = { id = "de.undercouch.download", version.ref = "download" } + +[libraries] +save-common = { module = "com.saveourtool.save:save-common", version.ref = "save-cli" } +save-common-jvm = { module = "com.saveourtool.save:save-common-jvm", version.ref = "save-cli" } +save-core = { module = "com.saveourtool.save:save-core", version.ref = "save-cli" } +save-core-jvm = { module = "com.saveourtool.save:save-core-jvm", version.ref = "save-cli" } +save-plugins-fix = { module = "com.saveourtool.save:fix-plugin", version.ref = "save-cli" } +save-plugins-fix-jvm = { module = "com.saveourtool.save:fix-plugin-jvm", version.ref = "save-cli" } +save-plugins-warn-jvm = { module = "com.saveourtool.save:warn-plugin-jvm", version.ref = "save-cli" } +save-plugins-fixAndWarn-jvm = { module = "com.saveourtool.save:fix-and-warn-plugin-jvm", version.ref = "save-cli" } +save-reporters = { module = "com.saveourtool.save:save-reporters", version.ref = "save-cli" } +publish-gradle-plugin = { module = "io.github.gradle-nexus:publish-plugin", version.ref = "publish"} +download-plugin = { module = "de.undercouch:gradle-download-task", version.ref = "download" } + +# kotlin +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } +kotlin-stdlib-common = { module = "org.jetbrains.kotlin:kotlin-stdlib-common", version.ref = "kotlin" } +kotlin-stdlib-jdk7 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk7", version.ref = "kotlin" } +kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } + +# kotlinx serialization +kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" } +# another serialization +kaml = { module = "com.charleskorn.kaml:kaml", version.ref = "kaml" } + +#kotlin libs +kotlin-multiplatform-diff = { module = "io.github.petertrr:kotlin-multiplatform-diff", version.ref = "kotlin-multiplatform-diff" } + +# ktlint +ktlint-core = { module = "com.pinterest.ktlint:ktlint-core", version.ref = "ktlint" } + +# apache +apache-commons-cli = { module = "commons-cli:commons-cli", version.ref = "commons-cli" } +apache-commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" } + +# others +guava = { module = "com.google.guava:guava", version.ref = "guava" } +jbool-expressions = { module = "com.bpodgursky:jbool_expressions", version.ref = "jbool" } + +# logging +kotlin-logging = { module = "io.github.microutils:kotlin-logging", version.ref = "mu-logging" } + +# testing +junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" } +assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" } +junit-platform-suite = { module = "org.junit.platform:junit-platform-suite-engine", version.ref = "junit-platfrom" } +mockito = { module = "org.mockito:mockito-all", version.ref = "mockito-all" } + + + + + + +######### copied from save-cloud +kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +kotlin-plugin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" } +kotlin-plugin-allopen = { module = "org.jetbrains.kotlin:kotlin-allopen", version.ref = "kotlin" } +kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } + +kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialization" } + +kotlinx-serialization-json-jvm = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-jvm", version.ref = "serialization" } +kotlinx-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "serialization" } +kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-reactor = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactor", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-core-linuxx64 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core-linuxx64", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } +jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "jetbrains-annotations" } +ktoml-core = { module = "com.akuleshov7:ktoml-core", version.ref = "ktoml" } +ktoml-file = { module = "com.akuleshov7:ktoml-file", version.ref = "ktoml" } + +ktor-client-apache = { module = "io.ktor:ktor-client-apache", version.ref = "ktor" } +ktor-client-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" } +ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } +ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" } +ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" } +ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" } +ktor-client-serialization = { module = "io.ktor:ktor-client-serialization", version.ref = "ktor" } +ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" } +ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" } +ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" } +ktor-http = { module = "io.ktor:ktor-http", version.ref = "ktor" } + +ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" } +ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" } +ktor-server-cio = { module = "io.ktor:ktor-server-cio", version.ref = "ktor" } +ktor-server-content-negotiation = { module = "io.ktor:ktor-server-content-negotiation", version.ref = "ktor" } + +# java core libraries +validation-api = { module = "jakarta.validation:jakarta.validation-api"} +annotation-api = { module = "jakarta.annotation:jakarta.annotation-api"} + +# testing +testcontainers = { module = "org.testcontainers:testcontainers", version.ref = "testcontainers" } +testcontainers-mysql = { module = "org.testcontainers:mysql", version.ref = "testcontainers" } +testcontainers-junit-jupiter = { module = "org.testcontainers:junit-jupiter", version.ref = "testcontainers" } +okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp3" } +okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp3" } +mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "mockito-kotlin" } +mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" } +kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } +kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version = "5.5.5" } + +okio = { module = "com.squareup.okio:okio", version.ref = "okio" } +slf4j-api = { module = "org.slf4j:slf4j-api" } +log4j = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" } +log4j-slf4j-impl = { module = "org.apache.logging.log4j:log4j-slf4j-impl", version.ref = "log4j" } +logback-core = { module = "ch.qos.logback:logback-core" } + +junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" } +junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" } +junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" } + +diktat-gradle-plugin = { module = "org.cqfn.diktat:diktat-gradle-plugin", version.ref = "diktat" } +detekt-gradle-plugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" } +reckon-gradle-plugin = { module = "org.ajoberstar.reckon:reckon-gradle", version.ref = "reckon" } +commons-compress = { module = "org.apache.commons:commons-compress", version.ref = "commons-compress" } + +kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli", version.ref = "kotlinx-cli" } + +gradle-plugin-spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" } + +arrow-kt-core = { module = "io.arrow-kt:arrow-core", version.ref = "arrow-kt"} diff --git a/gradle/plugins/build.gradle.kts b/gradle/plugins/build.gradle.kts new file mode 100644 index 0000000000..91b1c86957 --- /dev/null +++ b/gradle/plugins/build.gradle.kts @@ -0,0 +1,40 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + `kotlin-dsl` +} + +repositories { + mavenCentral() + gradlePluginPortal() +} + +dependencies { + // workaround https://github.com/gradle/gradle/issues/15383 + implementation(files(project.libs.javaClass.superclass.protectionDomain.codeSource.location)) + implementation(libs.kotlin.gradle.plugin) + implementation(libs.kotlin.plugin.allopen) + implementation(libs.download.plugin) + implementation(libs.reckon.gradle.plugin) + implementation(libs.detekt.gradle.plugin) { + exclude("io.github.detekt.sarif4k", "sarif4k") + } + implementation(libs.diktat.gradle.plugin) { + exclude("io.github.detekt.sarif4k", "sarif4k") + } + implementation(libs.gradle.plugin.spotless) + implementation(libs.publish.gradle.plugin) + // extra dependencies + implementation(libs.okio) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlin.stdlib.common) + implementation(libs.kotlin.stdlib.jdk7) + implementation(libs.kotlin.stdlib.jdk8) + implementation(libs.jetbrains.annotations) +} + +tasks.withType { + kotlinOptions { + freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn" + } +} diff --git a/gradle/plugins/settings.gradle.kts b/gradle/plugins/settings.gradle.kts new file mode 100644 index 0000000000..78b17f596a --- /dev/null +++ b/gradle/plugins/settings.gradle.kts @@ -0,0 +1,9 @@ +rootProject.name = "buildutils" + +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("../libs.versions.toml")) + } + } +} diff --git a/gradle/plugins/src/main/kotlin/Versions.kt b/gradle/plugins/src/main/kotlin/Versions.kt new file mode 100644 index 0000000000..6e33ebf61b --- /dev/null +++ b/gradle/plugins/src/main/kotlin/Versions.kt @@ -0,0 +1,8 @@ +@file:Suppress("CONSTANT_UPPERCASE", "PACKAGE_NAME_MISSING") + +object Versions { + /** + * JDK version which is used for building and running the project. + */ + const val jdk = "11" +} diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/GitHookInstallation.kt b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/GitHookInstallation.kt new file mode 100644 index 0000000000..2183db4c90 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/GitHookInstallation.kt @@ -0,0 +1,23 @@ +/** + * Gradle tasks to install git hooks as a part of the build + */ + +package com.saveourtool.save.buildutils + +import org.gradle.api.Project +import org.gradle.api.tasks.Copy +import org.gradle.kotlin.dsl.register + +/** + * Task of type [Copy] that install git hooks from directory in repo to .git directory + */ +fun Project.installGitHooks() { + val installGitHooksTask = tasks.register("installGitHooks", Copy::class) { + from(file("$rootDir/.git-hooks")) + into(file("$rootDir/.git/hooks")) + } + // add git hooks installation to build by adding it as a dependency for some common task + tasks.named("build") { + dependsOn(installGitHooksTask) + } +} diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/JacocoConfiguration.kt b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/JacocoConfiguration.kt new file mode 100644 index 0000000000..da96417936 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/JacocoConfiguration.kt @@ -0,0 +1,36 @@ +/** + * Configuration for code coverage calculation via Jacoco + */ + +package com.saveourtool.save.buildutils + +import org.gradle.api.Project +import org.gradle.api.tasks.testing.Test +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.named +import org.gradle.testing.jacoco.plugins.JacocoPlugin +import org.gradle.testing.jacoco.plugins.JacocoPluginExtension +import org.gradle.testing.jacoco.tasks.JacocoReport + +/** + * Configure jacoco for [this] project + */ +fun Project.configureJacoco() { + apply() + + configure { + toolVersion = "0.8.7" + } + + tasks.named("test") { + finalizedBy("jacocoTestReport") + } + tasks.named("jacocoTestReport") { + dependsOn(tasks.named("test")) + reports { + xml.required.set(true) + html.required.set(true) + } + } +} diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/PublishingConfiguration.kt b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/PublishingConfiguration.kt new file mode 100644 index 0000000000..4cc9fe9877 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/PublishingConfiguration.kt @@ -0,0 +1,166 @@ +/** + * Publishing configuration file. + */ + +@file:Suppress( + "MISSING_KDOC_TOP_LEVEL", + "MISSING_KDOC_ON_FUNCTION", +) + +package com.saveourtool.save.buildutils + +import io.github.gradlenexus.publishplugin.NexusPublishExtension +import org.gradle.api.Named +import org.gradle.api.Project +import org.gradle.api.publish.PublishingExtension +import org.gradle.api.publish.maven.MavenPublication +import org.gradle.api.tasks.bundling.Jar +import org.gradle.internal.logging.text.StyledTextOutput +import org.gradle.internal.logging.text.StyledTextOutput.Style.Failure +import org.gradle.internal.logging.text.StyledTextOutput.Style.Success +import org.gradle.internal.logging.text.StyledTextOutputFactory +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.create +import org.gradle.kotlin.dsl.getByType +import org.gradle.kotlin.dsl.support.serviceOf +import org.gradle.kotlin.dsl.withType +import org.gradle.plugins.signing.SigningExtension + +/** + * Enables signing of the artifacts if the `signingKey` project property is set. + * + * Should be explicitly called after each custom `publishing {}` section. + */ +fun Project.configureSigning() { + if (hasProperty("signingKey")) { + /* + * GitHub Actions. + */ + configureSigningCommon { + useInMemoryPgpKeys(property("signingKey") as String?, findProperty("signingPassword") as String?) + } + } else if ( + hasProperties( + "signing.keyId", + "signing.password", + "signing.secretKeyRingFile", + ) + ) { + /*- + * Pure-Java signing mechanism via `org.bouncycastle.bcpg`. + * + * Requires an 8-digit (short form) PGP key id and a present `~/.gnupg/secring.gpg` + * (for gpg 2.1, run + * `gpg --keyring secring.gpg --export-secret-keys >~/.gnupg/secring.gpg` + * to generate one). + */ + configureSigningCommon() + } else if (hasProperty("signing.gnupg.keyName")) { + /*- + * Use an external `gpg` executable. + * + * On Windows, you may need to additionally specify the path to `gpg` via + * `signing.gnupg.executable`. + */ + configureSigningCommon { + useGpgCmd() + } + } +} + +@Suppress("TOO_LONG_FUNCTION") +internal fun Project.configurePublications() { + val dokkaJar: Jar = tasks.create("dokkaJar") { + group = "documentation" + archiveClassifier.set("javadoc") + from(tasks.findByName("dokkaHtml")) + } + configure { + repositories { + mavenLocal() + } + publications.withType().configureEach { + /* + * The content of this section will get executed only if + * a particular module has a `publishing {}` section. + */ + this.artifact(dokkaJar) + this.pom { + name.set(project.name) + description.set(project.description ?: project.name) + url.set("https://github.com/saveourtool/save-cloud") + licenses { + license { + name.set("MIT License") + url.set("http://www.opensource.org/licenses/mit-license.php") + distribution.set("repo") + } + } + developers { + developer { + id.set("petertrr") + name.set("Petr Trifanov") + email.set("peter.trifanov@gmail.com") + } + developer { + id.set("akuleshov7") + name.set("Andrey Kuleshov") + email.set("andrewkuleshov7@gmail.com") + } + } + scm { + url.set("https://github.com/saveourtool/save-cloud") + connection.set("scm:git:git://github.com/saveourtool/save-cloud.git") + } + } + } + } +} + +internal fun Project.configureNexusPublishing() { + configure { + repositories { + sonatype { + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + username.set(property("sonatypeUsername") as String) + password.set(property("sonatypePassword") as String) + } + } + } +} + +/** + * @param useKeys the block which configures the PGP keys. Use either + * [SigningExtension.useInMemoryPgpKeys], [SigningExtension.useGpgCmd], or an + * empty lambda. + * @see SigningExtension.useInMemoryPgpKeys + * @see SigningExtension.useGpgCmd + */ +private fun Project.configureSigningCommon(useKeys: SigningExtension.() -> Unit = {}) { + configure { + useKeys() + val publications = extensions.getByType().publications + val publicationCount = publications.size + val message = "The following $publicationCount publication(s) are getting signed: ${publications.map(Named::getName)}" + val style = when (publicationCount) { + 0 -> Failure + else -> Success + } + styledOut(logCategory = "signing").style(style).println(message) + sign(*publications.toTypedArray()) + } +} + +private fun Project.styledOut(logCategory: String): StyledTextOutput = + serviceOf().create(logCategory) + +/** + * Determines if this project has all the given properties. + * + * @param propertyNames the names of the properties to locate. + * @return `true` if this project has all the given properties, `false` otherwise. + * @see Project.hasProperty + */ +private fun Project.hasProperties(vararg propertyNames: String): Boolean = + propertyNames.asSequence().all(this::hasProperty) diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/VersioningConfiguration.kt b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/VersioningConfiguration.kt new file mode 100644 index 0000000000..8f258452be --- /dev/null +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/VersioningConfiguration.kt @@ -0,0 +1,46 @@ +/** + * Configuration for project versioning + */ + +package com.saveourtool.save.buildutils + +import org.ajoberstar.grgit.gradle.GrgitServiceExtension +import org.ajoberstar.grgit.gradle.GrgitServicePlugin +import org.ajoberstar.reckon.gradle.ReckonExtension +import org.ajoberstar.reckon.gradle.ReckonPlugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.* + +/** + * Configures reckon plugin for [this] project, should be applied for root project only + */ +fun Project.configureVersioning() { + apply() + apply() + val grgitProvider = project.extensions.getByType() + .service + .map { it.grgit } + + // should be provided in the gradle.properties + configure { + scopeFromProp() + // this should be used during local development most of the time, so that constantly changing version + // on a dirty git tree doesn't cause other task updates + snapshotFromProp() + } + + val grgit = grgitProvider.get() + val status = grgit.repository.jgit.status() + .call() + if (!status.isClean) { + logger.warn("git tree is not clean; " + + "Untracked files: ${status.untracked}, uncommitted changes: ${status.uncommittedChanges}" + ) + } +} + +/** + * @return true if this string denotes a snapshot version + */ +internal fun String.isSnapshot() = endsWith("SNAPSHOT") + diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/code-quality-convention.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/code-quality-convention.gradle.kts new file mode 100644 index 0000000000..01560d4128 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/code-quality-convention.gradle.kts @@ -0,0 +1,10 @@ +package com.saveourtool.save.buildutils + +plugins { + id("com.saveourtool.save.buildutils.detekt-convention-configuration") + id("com.saveourtool.save.buildutils.diktat-convention-configuration") +// id("com.saveourtool.save.buildutils.spotless-convention-configuration") +} + +// FixMe: only registers the task, doesn't actually install them +installGitHooks() diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/detekt-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/detekt-convention-configuration.gradle.kts new file mode 100644 index 0000000000..3e5235a2ee --- /dev/null +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/detekt-convention-configuration.gradle.kts @@ -0,0 +1,39 @@ +package com.saveourtool.save.buildutils + +import io.gitlab.arturbosch.detekt.Detekt +import io.gitlab.arturbosch.detekt.report.ReportMergeTask + +plugins { + id("io.gitlab.arturbosch.detekt") +} + +detekt { + config = rootProject.files("detekt.yml") + basePath = rootDir.canonicalPath + buildUponDefaultConfig = true +} + +@Suppress("RUN_IN_SCRIPT") +if (path == rootProject.path) { + tasks.register("detektAll") { + allprojects { + this@register.dependsOn(tasks.withType()) + } + } + + tasks.register("mergeDetektReports", ReportMergeTask::class) { + output.set(buildDir.resolve("detekt-sarif-reports/detekt-merged.sarif")) + } +} + +@Suppress("GENERIC_VARIABLE_WRONG_DECLARATION") +val reportMerge: TaskProvider = rootProject.tasks.named("mergeDetektReports") { + input.from( + tasks.withType().map { it.sarifReportFile } + ) + shouldRunAfter(tasks.withType()) +} +tasks.withType().configureEach { + reports.sarif.required.set(true) + finalizedBy(reportMerge) +} diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/diktat-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/diktat-convention-configuration.gradle.kts new file mode 100644 index 0000000000..eff795d654 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/diktat-convention-configuration.gradle.kts @@ -0,0 +1,29 @@ +package com.saveourtool.save.buildutils + +import Versions +import org.cqfn.diktat.plugin.gradle.DiktatJavaExecTaskBase + +plugins { + id("org.cqfn.diktat.diktat-gradle-plugin") +} + +diktat { + diktatConfigFile = rootProject.file("diktat-analysis.yml") + githubActions = findProperty("diktat.githubActions")?.toString()?.toBoolean() ?: false + inputs { + // using `Project#path` here, because it must be unique in gradle's project hierarchy + if (path == rootProject.path) { + include("gradle/plugins/src/**/*.kt", "*.kts", "gradle/plugins/**/*.kts") + exclude("gradle/plugins/build/**") + } else { + include("src/**/*.kt", "**/*.kts") + exclude("src/test/**/*.kt", "src/*Test/**/*.kt") + } + } +} + +tasks.withType().configureEach { + javaLauncher.set(project.extensions.getByType().launcherFor { + languageVersion.set(JavaLanguageVersion.of(Versions.jdk)) + }) +} diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/kotlin-jvm-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/kotlin-jvm-configuration.gradle.kts new file mode 100644 index 0000000000..c2396090ca --- /dev/null +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/kotlin-jvm-configuration.gradle.kts @@ -0,0 +1,26 @@ +package com.saveourtool.save.buildutils + +import org.gradle.api.tasks.testing.Test +import org.gradle.kotlin.dsl.* +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + kotlin("jvm") +} + +tasks.withType { + kotlinOptions { + freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn" + } +} + +kotlin { + jvmToolchain { + this.languageVersion.set(JavaLanguageVersion.of(Versions.jdk)) + } +} + +configureJacoco() +tasks.withType { + useJUnitPlatform() +} diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/publishing-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/publishing-configuration.gradle.kts new file mode 100644 index 0000000000..2087d11f47 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/publishing-configuration.gradle.kts @@ -0,0 +1,37 @@ +package com.saveourtool.save.buildutils + +import io.github.gradlenexus.publishplugin.NexusPublishPlugin +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.extra + +plugins { + `maven-publish` + signing +} + +run { + // If present, set properties from env variables. If any are absent, release will fail. + System.getenv("OSSRH_USERNAME")?.let { + extra.set("sonatypeUsername", it) + } + System.getenv("OSSRH_PASSWORD")?.let { + extra.set("sonatypePassword", it) + } + System.getenv("GPG_SEC")?.let { + extra.set("signingKey", it) + } + System.getenv("GPG_PASSWORD")?.let { + extra.set("signingPassword", it) + } + + if (project.path == rootProject.path) { + apply() + if (hasProperty("sonatypeUsername")) { + configureNexusPublishing() + } + } +} + +run { + configurePublications() +} diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/spotless-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/spotless-convention-configuration.gradle.kts new file mode 100644 index 0000000000..21fd6d3fe7 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/spotless-convention-configuration.gradle.kts @@ -0,0 +1,36 @@ +package com.saveourtool.save.buildutils + +import org.gradle.accessors.dm.LibrariesForLibs + +plugins { + id("com.diffplug.spotless") +} + +@Suppress("GENERIC_VARIABLE_WRONG_DECLARATION") +val libs = the() +val diktatVersion: String = libs.versions.diktat.asProvider().get() +spotless { + kotlin { + diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) + target("src/**/*.kt") + targetExclude("src/test/**/*.kt", "src/*Test/**/*.kt") + if (path == rootProject.path) { + target("gradle/plugins/src/**/*.kt") + } + } + kotlinGradle { + diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) + + // using `Project#path` here, because it must be unique in gradle's project hierarchy + if (path == rootProject.path) { + target("$rootDir/*.kts", "$rootDir/gradle/plugins/**/*.kts") + targetExclude( + "$rootDir/build/**/*.kts", + "$rootDir/gradle/plugins/build/**/*.kts", + ) + } else { + target("**/*.kts") + targetExclude("build/**/*.kts") + } + } +} diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/versioning-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/versioning-configuration.gradle.kts new file mode 100644 index 0000000000..bea93a575e --- /dev/null +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/versioning-configuration.gradle.kts @@ -0,0 +1,3 @@ +package com.saveourtool.save.buildutils + +configureVersioning() diff --git a/diktat-gradle-plugin/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar similarity index 67% rename from diktat-gradle-plugin/gradle/wrapper/gradle-wrapper.jar rename to gradle/wrapper/gradle-wrapper.jar index 943f0cbfa754578e88a3dae77fce6e3dea56edbf..ccebba7710deaf9f98673a68957ea02138b60d0a 100644 GIT binary patch delta 5094 zcmZu#c|6qH|DG9RA4`noBZNWrC2N)tSqjO%%aX0^O4dPAB*iC6_9R<`apl^#h-_oY z)(k_0v8Fxp{fyi9-uwN%e)GpU&v~BrS>~KG^PF=MNmQjIDr&QHR7f-kM{%U_u*1=5 zGC}ae5(^Rrg9QY8$x^}oiJ0d2O9YW{J~$dD1ovlvh&0B4L)!4S=z;Hac>K{#9q9cKq;>>BtKo1!+gw`yqE zSK8x^jC|B!qmSW#uyb@T^CkB9qRd{N3V-rEi}AEgoU_J27lw_0X`}c0&m9JhxM;RK z54_gdZ(u?R5`B3}NeVal2NTHqlktM`2eTF28%6BZCWW$-shf0l-BOVSm)hU58MTPy zDcY-5777j;ccU!Yba8wH=X6OdPJ8O5Kp^3gUNo>!b=xb6T2F&LiC2eBJj8KuLPW!4 zw3V^NnAKZm^D?tmliCvzi>UtoDH%V#%SM0d*NS+m%4}qO<)M1E{OpQ(v&ZNc`vdi| zEGlVi$Dgxy1p6+k0qGLQt(JwxZxLCZ4>wJ=sb0v%Ki?*+!ic_2exumn{%Co|| z-axdK#RUC;P|vqbe?L`K!j;sUo=uuR_#ZkRvBf%Txo6{OL&I(?dz?47Z(DcX3KTw> zGY%A=kX;fBkq$F^sX|-)1Qkg##+n-Ci{qJVPj@P?l_1Y`nD^v>fZ3HMX%(4p-TlD(>yWwJij!6Jw}l7h>CIm@Ou5B@$Wy`Ky*814%Mdi1GfG1zDG9NogaoVHHr4gannv4?w6g&10!j=lKM zFW;@=Z0}vAPAxA=R4)|`J??*$|Fh`5=ks*V7TapX`+=4n*{aXxRhh-EGX_Xrzjb4r zn0vO7Cc~wtyeM_8{**~9y7>+}1JV8Buhg%*hy|PUc#!vw#W(HFTL|BpM)U0>JxG6S zLnqn1!0++RyyJ>5VU<4mDv8>Q#{EtgS3mj7Hx}Zkr0tz1}h8Kn6q`MiwC z{Y#;D!-ndlImST(C@(*i5f0U(jD29G7g#nkiPX zki6M$QYX_fNH=E4_eg9*FFZ3wF9YAKC}CP89Kl(GNS(Ag994)0$OL4-fj_1EdR}ARB#-vP_$bWF`Qk58+ z4Jq*-YkcmCuo9U%oxGeYe7Be=?n}pX+x>ob(8oPLDUPiIryT8v*N4@0{s_VYALi;lzj19ivLJKaXt7~UfU|mu9zjbhPnIhG2`uI34urWWA9IO{ z_1zJ)lwSs{qt3*UnD}3qB^kcRZ?``>IDn>qp8L96bRaZH)Zl`!neewt(wjSk1i#zf zb8_{x_{WRBm9+0CF4+nE)NRe6K8d|wOWN)&-3jCDiK5mj>77=s+TonlH5j`nb@rB5 z5NX?Z1dk`E#$BF{`(D>zISrMo4&}^wmUIyYL-$PWmEEfEn-U0tx_vy$H6|+ zi{ytv2@JXBsot|%I5s74>W1K{-cvj0BYdNiRJz*&jrV9>ZXYZhEMULcM=fCmxkN&l zEoi=)b)Vazc5TQC&Q$oEZETy@!`Gnj`qoXl7mcwdY@3a-!SpS2Mau|uK#++@>H8QC zr2ld8;<_8We%@E?S=E?=e9c$BL^9X?bj*4W;<+B&OOe+3{<`6~*fC(=`TO>o^A(Y! zA`Qc1ky?*6xjVfR?ugE~oY`Gtzhw^{Z@E6vZ`mMRAp>Odpa!m zzWmtjT|Lj^qiZMfj%%un-o$Eu>*v12qF{$kCKai^?DF=$^tfyV%m9;W@pm-BZn_6b z{jsXY3!U`%9hzk6n7YyHY%48NhjI6jjuUn?Xfxe0`ARD_Q+T_QBZ{ zUK@!63_Wr`%9q_rh`N4=J=m;v>T{Y=ZLKN^m?(KZQ2J%|3`hV0iogMHJ} zY6&-nXirq$Yhh*CHY&Qf*b@@>LPTMf z(cMorwW?M11RN{H#~ApKT)F!;R#fBHahZGhmy>Sox`rk>>q&Y)RG$-QwH$_TWk^hS zTq2TC+D-cB21|$g4D=@T`-ATtJ?C=aXS4Q}^`~XjiIRszCB^cvW0OHe5;e~9D%D10 zl4yP4O=s-~HbL7*4>#W52eiG7*^Hi)?@-#*7C^X5@kGwK+paI>_a2qxtW zU=xV7>QQROWQqVfPcJ$4GSx`Y23Z&qnS?N;%mjHL*EVg3pBT{V7bQUI60jtBTS?i~ zycZ4xqJ<*3FSC6_^*6f)N|sgB5Bep(^%)$=0cczl>j&n~KR!7WC|3;Zoh_^GuOzRP zo2Hxf50w9?_4Qe368fZ0=J|fR*jO_EwFB1I^g~i)roB|KWKf49-)!N%Ggb%w=kB8)(+_%kE~G!(73aF=yCmM3Cfb9lV$G!b zoDIxqY{dH>`SILGHEJwq%rwh46_i`wkZS-NY95qdNE)O*y^+k#JlTEij8NT(Y_J!W zFd+YFoZB|auOz~A@A{V*c)o7E(a=wHvb@8g5PnVJ&7D+Fp8ABV z5`&LD-<$jPy{-y*V^SqM)9!#_Pj2-x{m$z+9Z*o|JTBGgXYYVM;g|VbitDUfnVn$o zO)6?CZcDklDoODzj+ti@i#WcqPoZ!|IPB98LW!$-p+a4xBVM@%GEGZKmNjQMhh)zv z7D){Gpe-Dv=~>c9f|1vANF&boD=Nb1Dv>4~eD636Lldh?#zD5{6JlcR_b*C_Enw&~ z5l2(w(`{+01xb1FCRfD2ap$u(h1U1B6e&8tQrnC}Cy0GR=i^Uue26Rc6Dx}!4#K*0 zaxt`a+px7-Z!^(U1WN2#kdN#OeR|2z+C@b@w+L67VEi&ZpAdg+8`HJT=wIMJqibhT ztb3PFzsq&7jzQuod3xp7uL?h-7rYao&0MiT_Bux;U*N#ebGv92o(jM2?`1!N2W_M* zeo9$%hEtIy;=`8z1c|kL&ZPn0y`N)i$Y1R9>K!el{moiy)014448YC#9=K zwO3weN|8!`5bU_#f(+ZrVd*9`7Uw?!q?yo&7sk&DJ;#-^tcCtqt5*A(V;&LdHq7Hg zI6sC@!ly9p$^@v&XDsgIuv;9#w^!C1n5+10-tEw~ZdO1kqMDYyDl!5__o}f3hYe2M zCeO)~m&&=JZn%cVH3HzPlcE`9^@``2u+!Y}Remn)DLMHc-h5A9ATgs;7F7=u2=vBlDRbjeYvyNby=TvpI{5nb2@J_YTEEEj4q<@zaGSC_i&xxD!6)d zG{1??({Ma<=Wd4JL%bnEXoBOU_0bbNy3p%mFrMW>#c zzPEvryBevZVUvT^2P&Zobk#9j>vSIW_t?AHy>(^x-Bx~(mvNYb_%$ZFg(s5~oka+Kp(GU68I$h(Vq|fZ zC_u1FM|S)=ldt#5q>&p4r%%p)*7|Rf0}B#-FwHDTo*|P6HB_rz%R;{==hpl#xTt@VLdSrrf~g^ z`IA8ZV1b`UazYpnkn28h&U)$(gdZ*f{n`&kH%Oy54&Z;ebjlh4x?JmnjFAALu}EG} zfGmQ$5vEMJMH`a=+*src#dWK&N1^LFxK9Sa#q_rja$JWra09we<2oL9Q9Sx)?kZFW z$jhOFGE~VcihYlkaZv8?uA7v$*}?2h6i%Qmgc4n~3E(O_`YCRGy~}`NFaj@(?Wz;GS_?T+RqU{S)eD1j$1Gr;C^m z7zDK=xaJ^6``=#Y-2ssNfdRqh0ntJrutGV5Nv&WI%3k1wmD5n+0aRe{0k^!>LFReN zx1g*E>nbyx03KU~UT6->+rG%(owLF=beJxK&a0F;ie1GZ^eKg-VEZb&=s&ajKS#6w zjvC6J#?b|U_(%@uq$c#Q@V_me0S1%)pKz9--{EKwyM}_gOj*Og-NEWLDF_oFtPjG; zXCZ7%#=s}RKr&_5RFN@=H(015AGl4XRN9Bc51`;WWt%vzQvzexDI2BZ@xP~^2$I&7 zA(ndsgLsmA*su8p-~IS q+ZJUZM}`4#Zi@l2F-#HCw*??ha2ta#9s8?H3%YId(*zJG6aF78h1yF1 delta 5107 zcmY*d1zc0@|J{HQlai7V5+f#EN-H%&UP4MFm6QgFfuJK4DG4u#ARsbQL4i>MB1q|w zmWd#pqd~BR-yN@ieE-|$^W1aKIZtf&-p_fyw{(Uwc7_sWYDh^12cY!qXvcPQ!qF;q@b0nYU7 zP&ht}K7j%}P%%|ffm;4F0^i3P0R`a!2wm89L5P3Kfu;tTZJre<{N5}AzsH+E3DS`Q zJLIl`LRMf`JOTBLf(;IV(9(h{(}dXK!cPoSLm(o@fz8vRz}6fOw%3}3VYOsCczLF` za2RTsCWa2sS-uw(6|HLJg)Xf@S8#|+(Z5Y)ER+v+8;btfB3&9sWH6<=U}0)o-jIts zsi?Nko;No&JyZI%@1G&zsG5kKo^Zd7rk_9VIUao9;fC~nv(T0F&Af0&Rp`?x94EIS zUBPyBe5R5#okNiB1Xe--q4|hPyGzhJ?Lurt#Ci09BQ+}rlHpBhm;EmfLw{EbCz)sg zgseAE#f$met1jo;`Z6ihk?O1be3aa$IGV69{nzagziA!M*~E5lMc(Sp+NGm2IUjmn zql((DU9QP~Tn1pt6L`}|$Na-v(P+Zg&?6bAN@2u%KiB*Gmf}Z)R zMENRJgjKMqVbMpzPO{`!J~2Jyu7&xXnTDW?V?IJgy+-35q1)-J8T**?@_-2H`%X+6f5 zIRv`uLp&*?g7L~6+3O*saXT~gWsmhF*FNKw4X$29ePKi02G*)ysenhHv{u9-y?_do ztT(Cu04pk>51n}zu~=wgToY5Cx|MTlNw}GR>+`|6CAhQn=bh@S<7N)`w};;KTywDU z=QWO@RBj$WKOXSgCWg{BD`xl&DS!G}`Mm3$)=%3jzO_C+s+mfTFH5JL>}*(JKs@MqX|o2b#ZBX5P;p7;c)$F1y4HwvJ?KA938$rd)gn_U^CcUtmdaBW57 zlPph>Fz&L`cSScFjcj+7Jif3vxb20Ag~FPstm?9#OrD$e?Y~#1osDB0CFZ9Mu&%iE zSj~wZpFqu6!k%BT)}$F@Z%(d-Pqy07`N8ch2F7z^=S-!r-@j{#&{SM@a8O$P#SySx zZLD_z=I300OCA1YmKV0^lo@>^)THfZvW}s<$^w^#^Ce=kO5ymAnk>H7pK!+NJ-+F7 z1Bb6Y=r)0nZ+hRXUyD+BKAyecZxb+$JTHK5k(nWv*5%2a+u*GDt|rpReYQ}vft zXrIt#!kGO85o^~|9Oc-M5A!S@9Q)O$$&g8u>1=ew?T35h8B{-Z_S78oe=E(-YZhBPe@Y1sUt63A-Cdv>D1nIT~=Rub6$?8g>meFb7Ic@w^%@RN2z72oPZ#Ta%b(P1|&6I z61iO<8hT*)p19Bgd0JgXP{^c{P2~K@^DIXv=dF(u|DFfqD^dMIl8-x)xKIpJRZru@ zDxicyYJG}mh}=1Dfg%B$#H`CiAxPTj^;f4KRMZHUz-_x6)lEq!^mu%72*PI=t$6{Uql#dqm4 zClgaN63!&?v*enz4k1sbaM+yCqUf+i9rw$(YrY%ir1+%cWRB<;r}$8si!6QcNAk~J zk3?dejBaC`>=T<=y=>QVt*4kL>SwYwn$(4ES793qaH)>n(axyV3R5jdXDh#e-N0K- zuUgk|N^|3*D1!Wlz-!M*b}Zc5=;K6I+>1N$&Q%)&8LWUiTYi&aQIj(luA< zN5R<8Y8L#*i0xBio$jWcaiZ4S2w3#R@CGemesy~akKP)2GojQF6!$}!_RdUJPBevX zG#~uz%Yirb0@1wgQ;ayb=qD}6{=QXxjuZQ@@kxbN!QWhtEvuhS2yAZe8fZy6*4Inr zdSyR9Dec4HrE|I=z-U;IlH;_h#7e^Hq}gaJ<-z^}{*s!m^66wu2=(*EM0UaV*&u1q zJrq!K23TO8a(ecSQFdD$y+`xu)Xk36Z*;1i{hS=H2E<8<5yHuHG~22-S+Jq|3HMAw z%qBz3auT=M!=5F|Wqke|I^E8pmJ-}>_DwX5w%d3MSdC>xW%$ocm8w8HRdZ|^#cEt1 zM*I7S6sLQq;;Mecet(Q()+?s+&MeVLOvx}(MkvytkvLHl7h*N0AT1#AqC&(he(^%przH`KqA$z_dAvJJb409@F)fYwD$JW_{_Oie8!@VdJE zU>D$@B?LawAf5$;`AZ1E!krn=aAC%4+YQrzL!59yl1;|T2)u=RBYA8lk0Ek&gS!Rb zt0&hVuyhSa0}rpZGjTA>Gz}>Uv*4)F zf7S%D2nfA7x?gPEXZWk8DZimQs#xi0?So_k`2zb!UVQEAcbvjPLK9v>J~!awnxGpq zEh$EPOc4q&jywmglnC&D)1-P0DH!@)x;uJwMHdhPh>ZLWDw+p1pf52{X2dk{_|UOmakJa4MHu?CY`6Hhv!!d7=aNwiB5z zb*Wlq1zf^3iDlPf)b_SzI*{JCx2jN;*s~ra8NeB!PghqP!0po-ZL?0Jk;2~*~sCQ<%wU`mRImd)~!23RS?XJu|{u( ztFPy3*F=ZhJmBugTv48WX)4U*pNmm~4oD4}$*-92&<)n=R)5lT z-VpbEDk>(C1hoo#-H_u0`#%L6L$ zln(}h2*Cl(5(JtVM{YZ26@Fwmp;?Qt}9$_F%`?+-JHbC;bPZj8PLq9 zWo-KFw!i&r8WuA-!3F_m9!24Z(RhalAUR~_H#Ln=$%b5GY z)oB)zO%J5TY}&BXq^7#M>euVL%01Tzj4$6^ZOjT*7@zr~q@6GEjGi)nbwzSL`TiLN z{DVG~I$w@%^#tD{>1Ap@%=XogG_^Hvy_xiRn4yy?LKsC+ zU!S79X8orh&D%>1S`x2iyi&(iG&r#YT{}~iy(FIOo8?MZU#eo*c*(RjAGj@uDi zARJur)-*{n0PgW~&mFeg`MJ?(Kr;NUom)jh?ozZtyywN9bea6ikQlh}953Oul~N%4 z@Sx!@>?l1e7V*@HZMJx!gMo0TeXdU~#W6^n?YVQJ$)nuFRkvKbfwv_s*2g(!wPO|@ zvuXF=2MiPIX)A7x!|BthSa$GB%ECnuZe_Scx&AlnC z!~6C_SF24#@^VMIw)a-7{00}}Cr5NImPbW8OTIHoo6@NcxLVTna8<<;uy~YaaeMnd z;k_ynYc_8jQn9vW_W8QLkgaHtmwGC}wRcgZ^I^GPbz{lW)p#YYoinez1MjkY%6LBd z+Vr>j&^!?b-*Vk>8I!28o`r3w&^Lal8@=50zV4&9V9oXI{^r8;JmVeos&wf?O!;_o zk))^k*1fvYw9?WrS!sG2TcX`hH@Y3mF&@{i05;_AV{>Umi8{uZP_0W5_1V2yHU<)E z+qviK*7SJtnL;76{WK!?Pv$-!w$08<%8Qy|sB|P%GiV1<+dHw*sj!C~SjsB6+1L@so+Q~n# z+Uc5+Uz+mGmkR@>H7D*c?mm8WQz;3VOpktU_DeBi>3#@z zmLe;3gP<7KPy>~k47nEeT?G?7e2g6316Xdb_y+ja5C9Ayg6QTNr~&Kbs(1>7zp|f@le;9B z1e(+Ga%jPWR7oc}=XcB4$z?YD)l;%#U;}~gZzGViI=fwu9OAPCCK!0w>Ay^#$b49k zT&|M?JaIyRT<;@*t_jp1ifWPvL;{maf6o0T#X!#9YX;0Q;LTQ0}0tg^_Ru4pkSr4#P zmnW|D0`A#Ie6pEfBDv39=jN2;kiUoT6I&kChsbI!jMuY6zuZql5!&i%5!c zjsHlXtjT;NV?jAb`%vy)JOK_j1rponLqc>(2qgYlLPEs>|0QV<=Pw~C`fLFKJJitt zyC6003{rxCsmtGKjhB%W2W~*%vKH8l$pZoOFT*K@uL9%CD^3rh=ZtuTU1 zJpf4|%n^yjh#dKSSCJI8;YU*CD!8Wv20*e5`-fya^75@ADLU^RdHDg3Bk3k6)dGi7 z!!z;|O1h$8q!vO*w6 I6Xdi10eY*&F8}}l diff --git a/diktat-gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties similarity index 92% rename from diktat-gradle-plugin/gradle/wrapper/gradle-wrapper.properties rename to gradle/wrapper/gradle-wrapper.properties index 508322917b..bdc9a83b1e 100644 --- a/diktat-gradle-plugin/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/diktat-gradle-plugin/gradlew b/gradlew old mode 100755 new mode 100644 similarity index 99% rename from diktat-gradle-plugin/gradlew rename to gradlew index 65dcd68d65..79a61d421c --- a/diktat-gradle-plugin/gradlew +++ b/gradlew @@ -144,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/diktat-gradle-plugin/gradlew.bat b/gradlew.bat old mode 100755 new mode 100644 similarity index 100% rename from diktat-gradle-plugin/gradlew.bat rename to gradlew.bat diff --git a/info/gradle/wrapper/gradle-wrapper.properties b/info/gradle/wrapper/gradle-wrapper.properties index 774fae8767..e1bef7e873 100644 --- a/info/gradle/wrapper/gradle-wrapper.properties +++ b/info/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000000..9e1110d756 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,39 @@ +rootProject.name = "diktat" + +dependencyResolutionManagement { + repositories { + mavenCentral() + } +} + +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("com.gradle.enterprise") version "3.12.4" +} + +includeBuild("gradle/plugins") +include("diktat-common") +//include("diktat-gradle-plugin") +//include("diktat-maven-plugin") +include("diktat-rules") +//include("diktat-ruleset") +include("diktat-test-framework") + +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + +gradleEnterprise { + @Suppress("AVOID_NULL_CHECKS") + if (System.getenv("CI") != null) { + buildScan { + publishAlways() + termsOfServiceUrl = "https://gradle.com/terms-of-service" + termsOfServiceAgree = "yes" + } + } +} From 3536bf73648ee057f3055a272213725181113e50 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 15 Mar 2023 12:06:12 +0300 Subject: [PATCH 07/50] finished a basic migration to gradle --- .../{build.gradle.kts_ => build.gradle.kts} | 23 ++++++------- diktat-maven-plugin/build.gradle.kts | 32 ++++++++++++----- diktat-ruleset/build.gradle.kts | 25 +++++++++----- diktat-test-framework/build.gradle.kts | 2 +- gradle/libs.versions.toml | 34 +++++++++++++++---- settings.gradle.kts | 6 ++-- 6 files changed, 83 insertions(+), 39 deletions(-) rename diktat-gradle-plugin/{build.gradle.kts_ => build.gradle.kts} (80%) diff --git a/diktat-gradle-plugin/build.gradle.kts_ b/diktat-gradle-plugin/build.gradle.kts similarity index 80% rename from diktat-gradle-plugin/build.gradle.kts_ rename to diktat-gradle-plugin/build.gradle.kts index 3c2ccaaf08..717646d622 100644 --- a/diktat-gradle-plugin/build.gradle.kts_ +++ b/diktat-gradle-plugin/build.gradle.kts @@ -3,22 +3,15 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurr plugins { `java-gradle-plugin` - kotlin("jvm") version "1.8.0" + kotlin("jvm") jacoco id("pl.droidsonroids.jacoco.testkit") version "1.0.9" id("org.gradle.test-retry") version "1.5.2" } -// default value is needed for correct gradle loading in IDEA; actual value from maven is used during build -// To debug gradle plugin, please set `diktatVersion` manually to the current maven project version. -val ktlintVersion = project.properties.getOrDefault("ktlintVersion", "0.46.1") as String -val diktatVersion = project.version.takeIf { it.toString() != Project.DEFAULT_VERSION } ?: "1.2.3" -val junitVersion = project.properties.getOrDefault("junitVersion", "5.8.1") as String -val jacocoVersion = project.properties.getOrDefault("jacocoVersion", "0.8.7") as String - dependencies { implementation(kotlin("gradle-plugin-api")) - implementation("io.github.detekt.sarif4k:sarif4k:0.3.0") + implementation(libs.sarif4k) implementation(projects.diktatCommon) { exclude("org.jetbrains.kotlin", "kotlin-compiler-embeddable") @@ -29,15 +22,21 @@ dependencies { exclude("org.slf4j", "slf4j-log4j12") } - testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion") + testImplementation(libs.junit.jupiter.api) + testRuntimeOnly(libs.junit.jupiter.engine) + + // FIXME: it should come as transitive dependency from projects.diktatCommon + implementation(libs.kotlinx.serialization.json) } val generateVersionsFile by tasks.registering { val versionsFile = File("$buildDir/generated/src/generated/Versions.kt") + val diktatVersion = project.version.toString() + val ktlintVersion = libs.versions.ktlint.get() inputs.property("diktat version", diktatVersion) inputs.property("ktlint version", ktlintVersion) + outputs.file(versionsFile) doFirst { @@ -84,7 +83,7 @@ val functionalTestTask by tasks.register("functionalTest") tasks.withType { useJUnitPlatform() } -jacoco.toolVersion = jacocoVersion +jacoco.toolVersion = libs.versions.jacoco.get() // === integration testing // fixme: should probably use KotlinSourceSet instead diff --git a/diktat-maven-plugin/build.gradle.kts b/diktat-maven-plugin/build.gradle.kts index ecc351a0be..126ef59e83 100644 --- a/diktat-maven-plugin/build.gradle.kts +++ b/diktat-maven-plugin/build.gradle.kts @@ -1,14 +1,30 @@ plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") - id("com.saveourtool.save.buildutils.code-quality-convention") +// id("com.saveourtool.save.buildutils.code-quality-convention") + id("de.benediktritter.maven-plugin-development") version "0.4.1" } dependencies { - api(projects.saveCloudCommon) - implementation(libs.spring.cloud.starter.gateway) - implementation(libs.spring.boot.starter.security) - implementation(libs.spring.boot.starter.oauth2.client) - implementation(libs.spring.cloud.starter.kubernetes.client.config) - implementation(libs.spring.security.core) - implementation(projects.authenticationService) + api(libs.maven.core) + api(libs.maven.plugin.api) + implementation(libs.maven.plugin.annotations) + implementation(libs.kotlin.stdlib.jdk8) + implementation(projects.diktatRules) + implementation(libs.ktlint.reporter.plain) + implementation(libs.ktlint.reporter.sarif) + implementation(libs.ktlint.reporter.json) + implementation(libs.ktlint.reporter.html) + implementation(libs.ktlint.reporter.baseline) + testImplementation(libs.junit.jupiter.api) + testRuntimeOnly(libs.junit.jupiter.engine) + testImplementation(libs.junit.jupiter.extension.itf) + testImplementation(libs.maven.plugin.testing.harness) + // to use org.apache.maven.repository.RepositorySystem in newer maven versions and maybe other classes + testImplementation(libs.maven.compat) + testImplementation(libs.assertj.core) + testImplementation(libs.plexus.cipher) +} + +mavenPlugin { + helpMojoPackage.set("org.cqfn.diktat.plugin.maven") } diff --git a/diktat-ruleset/build.gradle.kts b/diktat-ruleset/build.gradle.kts index ecc351a0be..12f0591c09 100644 --- a/diktat-ruleset/build.gradle.kts +++ b/diktat-ruleset/build.gradle.kts @@ -1,14 +1,23 @@ plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") - id("com.saveourtool.save.buildutils.code-quality-convention") +// id("com.saveourtool.save.buildutils.code-quality-convention") } dependencies { - api(projects.saveCloudCommon) - implementation(libs.spring.cloud.starter.gateway) - implementation(libs.spring.boot.starter.security) - implementation(libs.spring.boot.starter.oauth2.client) - implementation(libs.spring.cloud.starter.kubernetes.client.config) - implementation(libs.spring.security.core) - implementation(projects.authenticationService) + implementation(projects.diktatRules) { + exclude("org.jetbrains.kotlin", "kotlin-stdlib-common") + exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8") + exclude("org.jetbrains.kotlin", "kotlin-stdlib") + exclude("org.jetbrains.kotlin", "kotlin-compiler-embeddable") + } + testImplementation(projects.diktatTestFramework) + testImplementation(libs.kotlin.stdlib.common) + testImplementation(libs.kotlin.stdlib.jdk7) + testImplementation(libs.kotlin.stdlib.jdk8) + testImplementation(libs.kotlin.stdlib) + testImplementation(libs.kotlin.compiler.embeddable) + testImplementation(libs.junit.jupiter) + testImplementation(libs.junit.platform.suite) + testImplementation(libs.assertj.core) + testImplementation(libs.mockito) } diff --git a/diktat-test-framework/build.gradle.kts b/diktat-test-framework/build.gradle.kts index 1e7abe3472..8394a7222e 100644 --- a/diktat-test-framework/build.gradle.kts +++ b/diktat-test-framework/build.gradle.kts @@ -14,5 +14,5 @@ dependencies { testImplementation(libs.assertj.core) // FIXME: it should come as transitive dependency from projects.diktatCommon -// implementation(libs.kotlinx.serialization.json) + implementation(libs.kotlinx.serialization.json) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2461bbf002..1ac3bf678f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,15 +12,23 @@ kotlinpoet = "1.12.0" detekt = "1.22.0" dokka = "1.7.20" jacoco = "0.8.8" +# maven +maven-api = "3.8.6" maven-plugin-tools = "3.7.0" +maven-plugin-testing-harness = "3.3.0" +plexus = "2.0" + jbool = "1.24" # downgraded to be compliance with ktlint mu-logging = "2.1.23" kaml = "0.47.0" kotlin-multiplatform-diff = "0.4.0" +sarif4k = "0.3.0" +jupiter-itf-extension = "0.11.0" # FIXME: need to migrate to mockito mockito-all = "1.10.19" + # copied from save-cloud jetbrains-annotations = "24.0.1" save-cli = "0.3.9" @@ -78,6 +86,7 @@ kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = " kotlin-stdlib-common = { module = "org.jetbrains.kotlin:kotlin-stdlib-common", version.ref = "kotlin" } kotlin-stdlib-jdk7 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk7", version.ref = "kotlin" } kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } +kotlin-compiler-embeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "kotlin" } # kotlinx serialization kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" } @@ -87,8 +96,14 @@ kaml = { module = "com.charleskorn.kaml:kaml", version.ref = "kaml" } #kotlin libs kotlin-multiplatform-diff = { module = "io.github.petertrr:kotlin-multiplatform-diff", version.ref = "kotlin-multiplatform-diff" } -# ktlint +# ktlint & detekt ktlint-core = { module = "com.pinterest.ktlint:ktlint-core", version.ref = "ktlint" } +ktlint-reporter-plain = { module = "com.pinterest.ktlint:ktlint-reporter-plain", version.ref = "ktlint" } +ktlint-reporter-sarif = { module = "com.pinterest.ktlint:ktlint-reporter-sarif", version.ref = "ktlint" } +ktlint-reporter-json = { module = "com.pinterest.ktlint:ktlint-reporter-json", version.ref = "ktlint" } +ktlint-reporter-html = { module = "com.pinterest.ktlint:ktlint-reporter-html", version.ref = "ktlint" } +ktlint-reporter-baseline = { module = "com.pinterest.ktlint:ktlint-reporter-baseline", version.ref = "ktlint" } +sarif4k = { module = "io.github.detekt.sarif4k:sarif4k", version.ref = "sarif4k" } # apache apache-commons-cli = { module = "commons-cli:commons-cli", version.ref = "commons-cli" } @@ -103,14 +118,21 @@ kotlin-logging = { module = "io.github.microutils:kotlin-logging", version.ref = # testing junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" } +junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" } +junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" } +junit-jupiter-extension-itf = { module = "com.soebes.itf.jupiter.extension:itf-jupiter-extension", version.ref = "jupiter-itf-extension" } assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" } junit-platform-suite = { module = "org.junit.platform:junit-platform-suite-engine", version.ref = "junit-platfrom" } mockito = { module = "org.mockito:mockito-all", version.ref = "mockito-all" } - - - - +# maven +maven-core = { module = "org.apache.maven:maven-core", version.ref = "maven-api" } +maven-embedder = { module = "org.apache.maven:maven-embedder", version.ref = "maven-api" } +maven-compat = { module = "org.apache.maven:maven-compat", version.ref = "maven-api" } +maven-plugin-api = { module = "org.apache.maven:maven-plugin-api", version.ref = "maven-api" } +maven-plugin-annotations = { module = "org.apache.maven.plugin-tools:maven-plugin-annotations", version.ref = "maven-plugin-tools" } +maven-plugin-testing-harness = { module = "org.apache.maven.plugin-testing:maven-plugin-testing-harness", version.ref = "maven-plugin-testing-harness" } +plexus-cipher = { module = "org.codehaus.plexus:plexus-cipher", version.ref = "plexus" } ######### copied from save-cloud kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } @@ -169,8 +191,6 @@ log4j = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" log4j-slf4j-impl = { module = "org.apache.logging.log4j:log4j-slf4j-impl", version.ref = "log4j" } logback-core = { module = "ch.qos.logback:logback-core" } -junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" } -junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" } junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" } diktat-gradle-plugin = { module = "org.cqfn.diktat:diktat-gradle-plugin", version.ref = "diktat" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 9e1110d756..c9acf4c16a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -19,10 +19,10 @@ plugins { includeBuild("gradle/plugins") include("diktat-common") -//include("diktat-gradle-plugin") -//include("diktat-maven-plugin") +include("diktat-gradle-plugin") +include("diktat-maven-plugin") include("diktat-rules") -//include("diktat-ruleset") +include("diktat-ruleset") include("diktat-test-framework") enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") From b114680ef3a4c80540b29f05f25ddb210fc27d43 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 15 Mar 2023 12:44:19 +0300 Subject: [PATCH 08/50] downgrade gradle --- diktat-maven-plugin/build.gradle.kts | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/diktat-maven-plugin/build.gradle.kts b/diktat-maven-plugin/build.gradle.kts index 126ef59e83..2967ceb494 100644 --- a/diktat-maven-plugin/build.gradle.kts +++ b/diktat-maven-plugin/build.gradle.kts @@ -5,9 +5,9 @@ plugins { } dependencies { - api(libs.maven.core) - api(libs.maven.plugin.api) - implementation(libs.maven.plugin.annotations) + implementation(libs.maven.plugin.api) + compileOnly(libs.maven.plugin.annotations) + implementation(libs.kotlin.stdlib.jdk8) implementation(projects.diktatRules) implementation(libs.ktlint.reporter.plain) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bdc9a83b1e..508322917b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From c5401f67a20794811f009db2c9f72b27c5fa047e Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 15 Mar 2023 14:40:50 +0300 Subject: [PATCH 09/50] added ksp to generate enum names --- diktat-common/build.gradle.kts | 4 +- diktat-dev-ksp/build.gradle.kts | 7 + .../generation/EnumNamesSymbolProcessor.kt | 76 +++++ .../EnumNamesSymbolProcessorProvider.kt | 24 ++ ...ols.ksp.processing.SymbolProcessorProvider | 1 + diktat-maven-plugin/build.gradle.kts | 2 + diktat-rules/build.gradle.kts | 13 +- .../src/main/kotlin/generated/WarningNames.kt | 279 ------------------ .../diktat/ruleset/generation/Generation.kt | 41 --- .../ruleset/chapter1/EnumValueCaseTest.kt | 2 +- .../chapter1/IdentifierNamingFixTest.kt | 2 +- .../chapter1/IdentifierNamingWarnTest.kt | 2 +- .../ruleset/chapter1/MethodNamingWarnTest.kt | 2 +- .../ruleset/chapter1/PackageNamingFixTest.kt | 2 +- .../ruleset/chapter1/PackageNamingWarnTest.kt | 2 +- .../ruleset/chapter1/PackagePathFixTest.kt | 2 +- .../chapter2/CommentsFormattingFixTest.kt | 8 +- .../chapter2/CommentsFormattingTest.kt | 2 +- .../chapter2/HeaderCommentRuleFixTest.kt | 4 +- .../ruleset/chapter2/HeaderCommentRuleTest.kt | 2 +- .../ruleset/chapter2/KdocCommentsFixTest.kt | 2 +- .../ruleset/chapter2/KdocCommentsWarnTest.kt | 2 +- .../ruleset/chapter2/KdocFormattingFixTest.kt | 2 +- .../ruleset/chapter2/KdocFormattingTest.kt | 2 +- .../ruleset/chapter2/KdocMethodsFixTest.kt | 2 +- .../ruleset/chapter2/KdocMethodsTest.kt | 2 +- .../chapter2/KdocParamPresentWarnTest.kt | 2 +- .../chapter2/comments/CommentedCodeTest.kt | 2 +- .../chapter3/AnnotationNewLineRuleFixTest.kt | 2 +- .../chapter3/AnnotationNewLineRuleWarnTest.kt | 2 +- .../chapter3/BlockStructureBracesFixTest.kt | 2 +- .../chapter3/BlockStructureBracesWarnTest.kt | 2 +- .../chapter3/BooleanExpressionsRuleFixTest.kt | 2 +- .../BooleanExpressionsRuleWarnTest.kt | 2 +- .../ruleset/chapter3/BracesRuleFixTest.kt | 2 +- .../ruleset/chapter3/BracesRuleWarnTest.kt | 2 +- .../ClassLikeStructuresOrderFixTest.kt | 2 +- .../ClassLikeStructuresOrderRuleWarnTest.kt | 2 +- .../CollapseIfStatementsRuleFixTest.kt | 2 +- .../CollapseIfStatementsRuleWarnTest.kt | 2 +- .../chapter3/ConsecutiveSpacesRuleFixTest.kt | 2 +- .../chapter3/ConsecutiveSpacesRuleWarnTest.kt | 2 +- .../chapter3/DebugPrintRuleWarnTest.kt | 2 +- .../ruleset/chapter3/EmptyBlockFixTest.kt | 2 +- .../ruleset/chapter3/EmptyBlockWarnTest.kt | 2 +- .../ruleset/chapter3/EnumsSeparatedFixTest.kt | 2 +- .../chapter3/EnumsSeparatedWarnTest.kt | 2 +- .../ruleset/chapter3/FileSizeWarnTest.kt | 2 +- .../chapter3/FileStructureRuleFixTest.kt | 2 +- .../ruleset/chapter3/FileStructureRuleTest.kt | 2 +- .../ruleset/chapter3/LineLengthWarnTest.kt | 2 +- .../chapter3/LocalVariablesWarnTest.kt | 2 +- .../LongNumericalValuesSeparatedFixTest.kt | 2 +- .../LongNumericalValuesSeparatedWarnTest.kt | 2 +- .../chapter3/MagicNumberRuleWarnTest.kt | 2 +- .../MultipleModifiersSequenceFixTest.kt | 2 +- .../MultipleModifiersSequenceWarnTest.kt | 2 +- .../chapter3/NullableTypeRuleFixTest.kt | 2 +- .../chapter3/NullableTypeRuleWarnTest.kt | 2 +- .../SingleLineStatementsRuleFixTest.kt | 2 +- .../SingleLineStatementsRuleWarnTest.kt | 2 +- .../ruleset/chapter3/SortRuleFixTest.kt | 2 +- .../ruleset/chapter3/SortRuleWarnTest.kt | 2 +- .../StringConcatenationRuleFixTest.kt | 2 +- .../chapter3/StringConcatenationWarnTest.kt | 2 +- .../chapter3/StringTemplateRuleFixTest.kt | 2 +- .../chapter3/StringTemplateRuleWarnTest.kt | 4 +- .../ruleset/chapter3/TrailingCommaFixTest.kt | 2 +- .../ruleset/chapter3/TrailingCommaWarnTest.kt | 2 +- .../chapter3/WhenMustHaveElseFixTest.kt | 2 +- .../chapter3/WhenMustHaveElseWarnTest.kt | 2 +- .../chapter3/files/BlankLinesFixTest.kt | 2 +- .../chapter3/files/BlankLinesWarnTest.kt | 2 +- .../chapter3/files/NewlinesRuleFixTest.kt | 2 +- .../chapter3/files/NewlinesRuleWarnTest.kt | 2 +- .../files/TopLevelOrderRuleFixTest.kt | 2 +- .../files/TopLevelOrderRuleWarnTest.kt | 2 +- .../chapter3/spaces/IndentationRuleFixTest.kt | 2 +- .../spaces/IndentationRuleWarnTest.kt | 2 +- .../chapter3/spaces/WhiteSpaceRuleFixTest.kt | 2 +- .../chapter3/spaces/WhiteSpaceRuleWarnTest.kt | 2 +- .../chapter3/spaces/junit/IndentationTest.kt | 2 +- ...ndentationTestInvocationContextProvider.kt | 2 +- .../chapter4/AccurateCalculationsWarnTest.kt | 2 +- .../ruleset/chapter4/NoVarRuleWarnTest.kt | 2 +- .../ruleset/chapter4/NullChecksRuleFixTest.kt | 2 +- .../chapter4/NullChecksRuleWarnTest.kt | 2 +- .../ruleset/chapter4/SmartCastRuleWarnTest.kt | 2 +- .../ruleset/chapter4/TypeAliasRuleWarnTest.kt | 2 +- ...riableGenericTypeDeclarationRuleFixTest.kt | 2 +- ...iableGenericTypeDeclarationRuleWarnTest.kt | 2 +- .../ruleset/chapter5/AsyncAndSyncRuleTest.kt | 2 +- .../chapter5/AvoidNestedFunctionsFixTest.kt | 2 +- .../chapter5/AvoidNestedFunctionsWarnTest.kt | 2 +- .../chapter5/CheckInverseMethodRuleFixTest.kt | 2 +- .../CheckInverseMethodRuleWarnTest.kt | 2 +- .../ruleset/chapter5/CustomLabelsTest.kt | 2 +- .../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/AbstractClassesFixTest.kt | 2 +- .../chapter6/AbstractClassesWarnTest.kt | 2 +- .../chapter6/AvoidUtilityClassWarnTest.kt | 2 +- .../chapter6/CompactInitializationFixTest.kt | 2 +- .../chapter6/CompactInitializationWarnTest.kt | 2 +- .../chapter6/CustomGetterSetterWarnTest.kt | 2 +- .../chapter6/DataClassesRuleWarnTest.kt | 2 +- .../EmptyPrimaryConstructorFixTest.kt | 2 +- .../EmptyPrimaryConstructorWarnTest.kt | 2 +- .../ExtensionFunctionsInFileWarnTest.kt | 2 +- .../ExtensionFunctionsSameNameWarnTest.kt | 2 +- .../ImplicitBackingPropertyWarnTest.kt | 2 +- .../ruleset/chapter6/InlineClassesWarnTest.kt | 2 +- .../PropertyAccessorFieldsWarnTest.kt | 2 +- .../ruleset/chapter6/RunInScriptFixTest.kt | 2 +- .../ruleset/chapter6/RunInScriptWarnTest.kt | 2 +- .../chapter6/SingleConstructorRuleFixTest.kt | 2 +- .../chapter6/SingleConstructorRuleWarnTest.kt | 2 +- .../ruleset/chapter6/SingleInitRuleFixTest.kt | 2 +- .../chapter6/SingleInitRuleWarnTest.kt | 2 +- .../chapter6/StatelessClassesRuleFixTest.kt | 2 +- .../chapter6/StatelessClassesRuleWarnTest.kt | 2 +- .../TrivialPropertyAccessorsFixTest.kt | 2 +- .../TrivialPropertyAccessorsWarnTest.kt | 2 +- .../ruleset/chapter6/UseLastIndexWarnTest.kt | 2 +- .../chapter6/UselessSupertypeFixTest.kt | 2 +- .../chapter6/UselessSupertypeWarnTest.kt | 2 +- .../junit/RuleInvocationContextProvider.kt | 2 +- diktat-ruleset/build.gradle.kts | 2 +- settings.gradle.kts | 1 + 134 files changed, 254 insertions(+), 452 deletions(-) create mode 100644 diktat-dev-ksp/build.gradle.kts create mode 100644 diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt create mode 100644 diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt create mode 100644 diktat-dev-ksp/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider delete mode 100644 diktat-rules/src/main/kotlin/generated/WarningNames.kt diff --git a/diktat-common/build.gradle.kts b/diktat-common/build.gradle.kts index 0588937aae..379a703287 100644 --- a/diktat-common/build.gradle.kts +++ b/diktat-common/build.gradle.kts @@ -1,12 +1,14 @@ +@Suppress("DSL_SCOPE_VIOLATION", "RUN_IN_SCRIPT") // https://github.com/gradle/gradle/issues/22797 plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") // id("com.saveourtool.save.buildutils.code-quality-convention") + alias(libs.plugins.kotlin.plugin.serialization) } dependencies { implementation(libs.kotlin.stdlib.jdk8) implementation(libs.kotlinx.serialization.json.jvm) - implementation(libs.kaml) + api(libs.kaml) implementation(libs.apache.commons.cli) implementation(libs.kotlin.logging) // ktlint-core is needed only for `initKtLintKLogger` method diff --git a/diktat-dev-ksp/build.gradle.kts b/diktat-dev-ksp/build.gradle.kts new file mode 100644 index 0000000000..eb2a37b2c6 --- /dev/null +++ b/diktat-dev-ksp/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + kotlin("jvm") +} + +dependencies { + implementation("com.google.devtools.ksp:symbol-processing-api:1.8.0-1.0.8") +} diff --git a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt new file mode 100644 index 0000000000..ccb43fa4b1 --- /dev/null +++ b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt @@ -0,0 +1,76 @@ +package org.cqfn.diktat.ruleset.generation + +import com.google.devtools.ksp.getClassDeclarationByName +import com.google.devtools.ksp.getDeclaredProperties +import com.google.devtools.ksp.processing.CodeGenerator +import com.google.devtools.ksp.processing.Dependencies +import com.google.devtools.ksp.processing.Resolver +import com.google.devtools.ksp.processing.SymbolProcessor +import com.google.devtools.ksp.symbol.ClassKind +import com.google.devtools.ksp.symbol.KSAnnotated +import com.google.devtools.ksp.symbol.KSClassDeclaration + +/** + * [SymbolProcessor] to generate a class with contacts for names from provided enum + */ +class EnumNamesSymbolProcessor( + private val enumName: String, + private val codeGenerator: CodeGenerator, +) : SymbolProcessor { + override fun process(resolver: Resolver): List { + val enumDeclaration = requireNotNull(resolver.getClassDeclarationByName(enumName)) { + "Not found class provided by property <${EnumNamesSymbolProcessorProvider.OPTION_NAME}>" + } + require(enumDeclaration.classKind == ClassKind.ENUM_CLASS) { + "Provided class $enumName is not enum" + } + val sourceFile = requireNotNull(enumDeclaration.containingFile) { + "Failed to detect a source file for $enumDeclaration" + } + + val packageName = enumDeclaration.packageName.asString() + val className = enumDeclaration.simpleName.asString() + "Names" + + resolver.getNewFiles() + .find { it.packageName.asString() == packageName && it.fileName == "$className.kt" } + ?.run { + return emptyList() + } + codeGenerator.createNewFile( + dependencies = Dependencies(true, sourceFile), + packageName = packageName, + fileName = className, + ).bufferedWriter() + .use { writer -> + writer.write(autoGenerationComment) + writer.newLine() + writer.write("package $packageName\n") + writer.newLine() + writer.write("import kotlin.String\n") + writer.newLine() + writer.write("object $className {\n") + enumDeclaration.declarations + .filterIsInstance() + .filter { it.classKind == ClassKind.ENUM_ENTRY } + .map { it.simpleName.asString() } + .forEach { enumEntryName -> + writer.write(" const val $enumEntryName: String = \"$enumEntryName\"\n") + } + writer.write("}\n") + } + return emptyList() + } + + companion object { + + /** + * The comment that will be added to the generated sources file. + */ + private val autoGenerationComment = """ + |/** + | * This document was auto generated, please don't modify it. + | * This document contains all enum properties from Warnings.kt as Strings. + | */ + """.trimMargin() + } +} diff --git a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt new file mode 100644 index 0000000000..634b19a72a --- /dev/null +++ b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt @@ -0,0 +1,24 @@ +package org.cqfn.diktat.ruleset.generation + +import com.google.devtools.ksp.processing.SymbolProcessor +import com.google.devtools.ksp.processing.SymbolProcessorEnvironment +import com.google.devtools.ksp.processing.SymbolProcessorProvider + +/** + * [SymbolProcessorProvider] for [EnumNamesSymbolProcessor] + */ +class EnumNamesSymbolProcessorProvider : SymbolProcessorProvider { + override fun create( + environment: SymbolProcessorEnvironment, + ): SymbolProcessor = EnumNamesSymbolProcessor( + enumName = environment.options.getValue(OPTION_NAME), + codeGenerator = environment.codeGenerator, + ) + + companion object { + /** + * Option name to specify `enumName` + */ + const val OPTION_NAME = "enumName" + } +} diff --git a/diktat-dev-ksp/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider b/diktat-dev-ksp/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider new file mode 100644 index 0000000000..f1006ef2dd --- /dev/null +++ b/diktat-dev-ksp/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider @@ -0,0 +1 @@ +org.cqfn.diktat.ruleset.generation.EnumNamesSymbolProcessorProvider diff --git a/diktat-maven-plugin/build.gradle.kts b/diktat-maven-plugin/build.gradle.kts index 2967ceb494..b51de0af7c 100644 --- a/diktat-maven-plugin/build.gradle.kts +++ b/diktat-maven-plugin/build.gradle.kts @@ -7,9 +7,11 @@ plugins { dependencies { implementation(libs.maven.plugin.api) compileOnly(libs.maven.plugin.annotations) + implementation(libs.maven.core) implementation(libs.kotlin.stdlib.jdk8) implementation(projects.diktatRules) + implementation(libs.ktlint.core) implementation(libs.ktlint.reporter.plain) implementation(libs.ktlint.reporter.sarif) implementation(libs.ktlint.reporter.json) diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index b2b93a2a0b..0e06eb8e2e 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -1,12 +1,13 @@ plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") // id("com.saveourtool.save.buildutils.code-quality-convention") + id("com.google.devtools.ksp") version "1.8.0-1.0.8" } dependencies { - implementation(projects.diktatCommon) + api(projects.diktatCommon) testImplementation(projects.diktatTestFramework) - implementation(libs.ktlint.core) + api(libs.ktlint.core) implementation(libs.kotlin.stdlib.jdk8) // guava is used for string case utils implementation(libs.guava) @@ -17,4 +18,12 @@ dependencies { testImplementation(libs.mockito) // is used for simplifying boolean expressions implementation(libs.jbool.expressions) + + // generating + implementation(projects.diktatDevKsp) + ksp(projects.diktatDevKsp) +} + +ksp { + arg("enumName", "org.cqfn.diktat.ruleset.constants.Warnings") } diff --git a/diktat-rules/src/main/kotlin/generated/WarningNames.kt b/diktat-rules/src/main/kotlin/generated/WarningNames.kt deleted file mode 100644 index 8ef79dfbe5..0000000000 --- a/diktat-rules/src/main/kotlin/generated/WarningNames.kt +++ /dev/null @@ -1,279 +0,0 @@ -// This document was auto generated, please don't modify it. -// This document contains all enum properties from Warnings.kt as Strings. -package generated - -import kotlin.String - -public object WarningNames { - public const val DUMMY_TEST_WARNING: String = "DUMMY_TEST_WARNING" - - public const val PACKAGE_NAME_MISSING: String = "PACKAGE_NAME_MISSING" - - public const val PACKAGE_NAME_INCORRECT_CASE: String = "PACKAGE_NAME_INCORRECT_CASE" - - public const val PACKAGE_NAME_INCORRECT_PREFIX: String = "PACKAGE_NAME_INCORRECT_PREFIX" - - public const val PACKAGE_NAME_INCORRECT_SYMBOLS: String = "PACKAGE_NAME_INCORRECT_SYMBOLS" - - public const val PACKAGE_NAME_INCORRECT_PATH: String = "PACKAGE_NAME_INCORRECT_PATH" - - public const val INCORRECT_PACKAGE_SEPARATOR: String = "INCORRECT_PACKAGE_SEPARATOR" - - public const val CLASS_NAME_INCORRECT: String = "CLASS_NAME_INCORRECT" - - public const val OBJECT_NAME_INCORRECT: String = "OBJECT_NAME_INCORRECT" - - public const val VARIABLE_NAME_INCORRECT_FORMAT: String = "VARIABLE_NAME_INCORRECT_FORMAT" - - public const val VARIABLE_NAME_INCORRECT: String = "VARIABLE_NAME_INCORRECT" - - public const val CONSTANT_UPPERCASE: String = "CONSTANT_UPPERCASE" - - public const val VARIABLE_HAS_PREFIX: String = "VARIABLE_HAS_PREFIX" - - public const val IDENTIFIER_LENGTH: String = "IDENTIFIER_LENGTH" - - public const val ENUM_VALUE: String = "ENUM_VALUE" - - public const val GENERIC_NAME: String = "GENERIC_NAME" - - public const val BACKTICKS_PROHIBITED: String = "BACKTICKS_PROHIBITED" - - public const val FUNCTION_NAME_INCORRECT_CASE: String = "FUNCTION_NAME_INCORRECT_CASE" - - public const val TYPEALIAS_NAME_INCORRECT_CASE: String = "TYPEALIAS_NAME_INCORRECT_CASE" - - public const val FUNCTION_BOOLEAN_PREFIX: String = "FUNCTION_BOOLEAN_PREFIX" - - public const val FILE_NAME_INCORRECT: String = "FILE_NAME_INCORRECT" - - public const val EXCEPTION_SUFFIX: String = "EXCEPTION_SUFFIX" - - public const val CONFUSING_IDENTIFIER_NAMING: String = "CONFUSING_IDENTIFIER_NAMING" - - public const val MISSING_KDOC_TOP_LEVEL: String = "MISSING_KDOC_TOP_LEVEL" - - public const val MISSING_KDOC_CLASS_ELEMENTS: String = "MISSING_KDOC_CLASS_ELEMENTS" - - public const val MISSING_KDOC_ON_FUNCTION: String = "MISSING_KDOC_ON_FUNCTION" - - public const val KDOC_TRIVIAL_KDOC_ON_FUNCTION: String = "KDOC_TRIVIAL_KDOC_ON_FUNCTION" - - public const val KDOC_WITHOUT_PARAM_TAG: String = "KDOC_WITHOUT_PARAM_TAG" - - public const val KDOC_WITHOUT_RETURN_TAG: String = "KDOC_WITHOUT_RETURN_TAG" - - public const val KDOC_WITHOUT_THROWS_TAG: String = "KDOC_WITHOUT_THROWS_TAG" - - public const val KDOC_EMPTY_KDOC: String = "KDOC_EMPTY_KDOC" - - public const val KDOC_WRONG_SPACES_AFTER_TAG: String = "KDOC_WRONG_SPACES_AFTER_TAG" - - public const val KDOC_WRONG_TAGS_ORDER: String = "KDOC_WRONG_TAGS_ORDER" - - public const val KDOC_NEWLINES_BEFORE_BASIC_TAGS: String = "KDOC_NEWLINES_BEFORE_BASIC_TAGS" - - public const val KDOC_NO_NEWLINES_BETWEEN_BASIC_TAGS: String = - "KDOC_NO_NEWLINES_BETWEEN_BASIC_TAGS" - - public const val KDOC_NO_NEWLINE_AFTER_SPECIAL_TAGS: String = - "KDOC_NO_NEWLINE_AFTER_SPECIAL_TAGS" - - public const val KDOC_NO_EMPTY_TAGS: String = "KDOC_NO_EMPTY_TAGS" - - public const val KDOC_NO_DEPRECATED_TAG: String = "KDOC_NO_DEPRECATED_TAG" - - public const val KDOC_NO_CONSTRUCTOR_PROPERTY: String = "KDOC_NO_CONSTRUCTOR_PROPERTY" - - public const val KDOC_NO_CLASS_BODY_PROPERTIES_IN_HEADER: String = - "KDOC_NO_CLASS_BODY_PROPERTIES_IN_HEADER" - - public const val KDOC_EXTRA_PROPERTY: String = "KDOC_EXTRA_PROPERTY" - - public const val KDOC_DUPLICATE_PROPERTY: String = "KDOC_DUPLICATE_PROPERTY" - - public const val KDOC_NO_CONSTRUCTOR_PROPERTY_WITH_COMMENT: String = - "KDOC_NO_CONSTRUCTOR_PROPERTY_WITH_COMMENT" - - public const val KDOC_CONTAINS_DATE_OR_AUTHOR: String = "KDOC_CONTAINS_DATE_OR_AUTHOR" - - public const val HEADER_WRONG_FORMAT: String = "HEADER_WRONG_FORMAT" - - public const val HEADER_MISSING_OR_WRONG_COPYRIGHT: String = "HEADER_MISSING_OR_WRONG_COPYRIGHT" - - public const val WRONG_COPYRIGHT_YEAR: String = "WRONG_COPYRIGHT_YEAR" - - public const val HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE: String = - "HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE" - - public const val HEADER_NOT_BEFORE_PACKAGE: String = "HEADER_NOT_BEFORE_PACKAGE" - - public const val COMMENTED_OUT_CODE: String = "COMMENTED_OUT_CODE" - - public const val COMMENTED_BY_KDOC: String = "COMMENTED_BY_KDOC" - - public const val WRONG_NEWLINES_AROUND_KDOC: String = "WRONG_NEWLINES_AROUND_KDOC" - - public const val FIRST_COMMENT_NO_BLANK_LINE: String = "FIRST_COMMENT_NO_BLANK_LINE" - - public const val COMMENT_WHITE_SPACE: String = "COMMENT_WHITE_SPACE" - - public const val IF_ELSE_COMMENTS: String = "IF_ELSE_COMMENTS" - - public const val FILE_IS_TOO_LONG: String = "FILE_IS_TOO_LONG" - - public const val FILE_CONTAINS_ONLY_COMMENTS: String = "FILE_CONTAINS_ONLY_COMMENTS" - - public const val FILE_INCORRECT_BLOCKS_ORDER: String = "FILE_INCORRECT_BLOCKS_ORDER" - - public const val FILE_NO_BLANK_LINE_BETWEEN_BLOCKS: String = "FILE_NO_BLANK_LINE_BETWEEN_BLOCKS" - - public const val FILE_UNORDERED_IMPORTS: String = "FILE_UNORDERED_IMPORTS" - - public const val FILE_WILDCARD_IMPORTS: String = "FILE_WILDCARD_IMPORTS" - - public const val UNUSED_IMPORT: String = "UNUSED_IMPORT" - - public const val NO_BRACES_IN_CONDITIONALS_AND_LOOPS: String = - "NO_BRACES_IN_CONDITIONALS_AND_LOOPS" - - public const val WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES: String = - "WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES" - - public const val BLANK_LINE_BETWEEN_PROPERTIES: String = "BLANK_LINE_BETWEEN_PROPERTIES" - - public const val TOP_LEVEL_ORDER: String = "TOP_LEVEL_ORDER" - - public const val BRACES_BLOCK_STRUCTURE_ERROR: String = "BRACES_BLOCK_STRUCTURE_ERROR" - - public const val WRONG_INDENTATION: String = "WRONG_INDENTATION" - - public const val EMPTY_BLOCK_STRUCTURE_ERROR: String = "EMPTY_BLOCK_STRUCTURE_ERROR" - - public const val MORE_THAN_ONE_STATEMENT_PER_LINE: String = "MORE_THAN_ONE_STATEMENT_PER_LINE" - - public const val LONG_LINE: String = "LONG_LINE" - - public const val REDUNDANT_SEMICOLON: String = "REDUNDANT_SEMICOLON" - - public const val WRONG_NEWLINES: String = "WRONG_NEWLINES" - - public const val TRAILING_COMMA: String = "TRAILING_COMMA" - - public const val COMPLEX_EXPRESSION: String = "COMPLEX_EXPRESSION" - - public const val COMPLEX_BOOLEAN_EXPRESSION: String = "COMPLEX_BOOLEAN_EXPRESSION" - - public const val STRING_CONCATENATION: String = "STRING_CONCATENATION" - - public const val TOO_MANY_BLANK_LINES: String = "TOO_MANY_BLANK_LINES" - - public const val WRONG_WHITESPACE: String = "WRONG_WHITESPACE" - - public const val TOO_MANY_CONSECUTIVE_SPACES: String = "TOO_MANY_CONSECUTIVE_SPACES" - - public const val ANNOTATION_NEW_LINE: String = "ANNOTATION_NEW_LINE" - - public const val ENUMS_SEPARATED: String = "ENUMS_SEPARATED" - - public const val WHEN_WITHOUT_ELSE: String = "WHEN_WITHOUT_ELSE" - - public const val LONG_NUMERICAL_VALUES_SEPARATED: String = "LONG_NUMERICAL_VALUES_SEPARATED" - - public const val MAGIC_NUMBER: String = "MAGIC_NUMBER" - - public const val WRONG_DECLARATIONS_ORDER: String = "WRONG_DECLARATIONS_ORDER" - - public const val WRONG_MULTIPLE_MODIFIERS_ORDER: String = "WRONG_MULTIPLE_MODIFIERS_ORDER" - - public const val LOCAL_VARIABLE_EARLY_DECLARATION: String = "LOCAL_VARIABLE_EARLY_DECLARATION" - - public const val STRING_TEMPLATE_CURLY_BRACES: String = "STRING_TEMPLATE_CURLY_BRACES" - - public const val STRING_TEMPLATE_QUOTES: String = "STRING_TEMPLATE_QUOTES" - - public const val FILE_NAME_MATCH_CLASS: String = "FILE_NAME_MATCH_CLASS" - - public const val COLLAPSE_IF_STATEMENTS: String = "COLLAPSE_IF_STATEMENTS" - - public const val CONVENTIONAL_RANGE: String = "CONVENTIONAL_RANGE" - - public const val DEBUG_PRINT: String = "DEBUG_PRINT" - - public const val NULLABLE_PROPERTY_TYPE: String = "NULLABLE_PROPERTY_TYPE" - - public const val TYPE_ALIAS: String = "TYPE_ALIAS" - - public const val SMART_CAST_NEEDED: String = "SMART_CAST_NEEDED" - - public const val SAY_NO_TO_VAR: String = "SAY_NO_TO_VAR" - - public const val GENERIC_VARIABLE_WRONG_DECLARATION: String = - "GENERIC_VARIABLE_WRONG_DECLARATION" - - public const val FLOAT_IN_ACCURATE_CALCULATIONS: String = "FLOAT_IN_ACCURATE_CALCULATIONS" - - public const val AVOID_NULL_CHECKS: String = "AVOID_NULL_CHECKS" - - public const val TOO_LONG_FUNCTION: String = "TOO_LONG_FUNCTION" - - public const val AVOID_NESTED_FUNCTIONS: String = "AVOID_NESTED_FUNCTIONS" - - public const val LAMBDA_IS_NOT_LAST_PARAMETER: String = "LAMBDA_IS_NOT_LAST_PARAMETER" - - public const val TOO_MANY_PARAMETERS: String = "TOO_MANY_PARAMETERS" - - public const val NESTED_BLOCK: String = "NESTED_BLOCK" - - public const val WRONG_OVERLOADING_FUNCTION_ARGUMENTS: String = - "WRONG_OVERLOADING_FUNCTION_ARGUMENTS" - - public const val RUN_BLOCKING_INSIDE_ASYNC: String = "RUN_BLOCKING_INSIDE_ASYNC" - - public const val TOO_MANY_LINES_IN_LAMBDA: String = "TOO_MANY_LINES_IN_LAMBDA" - - public const val CUSTOM_LABEL: String = "CUSTOM_LABEL" - - public const val PARAMETER_NAME_IN_OUTER_LAMBDA: String = "PARAMETER_NAME_IN_OUTER_LAMBDA" - - public const val INVERSE_FUNCTION_PREFERRED: String = "INVERSE_FUNCTION_PREFERRED" - - public const val SINGLE_CONSTRUCTOR_SHOULD_BE_PRIMARY: String = - "SINGLE_CONSTRUCTOR_SHOULD_BE_PRIMARY" - - public const val USE_DATA_CLASS: String = "USE_DATA_CLASS" - - public const val WRONG_NAME_OF_VARIABLE_INSIDE_ACCESSOR: String = - "WRONG_NAME_OF_VARIABLE_INSIDE_ACCESSOR" - - public const val MULTIPLE_INIT_BLOCKS: String = "MULTIPLE_INIT_BLOCKS" - - public const val CLASS_SHOULD_NOT_BE_ABSTRACT: String = "CLASS_SHOULD_NOT_BE_ABSTRACT" - - public const val CUSTOM_GETTERS_SETTERS: String = "CUSTOM_GETTERS_SETTERS" - - public const val COMPACT_OBJECT_INITIALIZATION: String = "COMPACT_OBJECT_INITIALIZATION" - - public const val USELESS_SUPERTYPE: String = "USELESS_SUPERTYPE" - - public const val TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED: String = - "TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED" - - public const val EXTENSION_FUNCTION_SAME_SIGNATURE: String = "EXTENSION_FUNCTION_SAME_SIGNATURE" - - public const val EMPTY_PRIMARY_CONSTRUCTOR: String = "EMPTY_PRIMARY_CONSTRUCTOR" - - public const val NO_CORRESPONDING_PROPERTY: String = "NO_CORRESPONDING_PROPERTY" - - public const val AVOID_USING_UTILITY_CLASS: String = "AVOID_USING_UTILITY_CLASS" - - public const val OBJECT_IS_PREFERRED: String = "OBJECT_IS_PREFERRED" - - public const val INLINE_CLASS_CAN_BE_USED: String = "INLINE_CLASS_CAN_BE_USED" - - public const val EXTENSION_FUNCTION_WITH_CLASS: String = "EXTENSION_FUNCTION_WITH_CLASS" - - public const val RUN_IN_SCRIPT: String = "RUN_IN_SCRIPT" - - public const val USE_LAST_INDEX: String = "USE_LAST_INDEX" -} diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt index 975a7361e1..30e49be9b2 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt @@ -4,15 +4,10 @@ package org.cqfn.diktat.ruleset.generation -import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter2.comments.HeaderCommentRule.Companion.afterCopyrightRegex import org.cqfn.diktat.ruleset.rules.chapter2.comments.HeaderCommentRule.Companion.curYear import org.cqfn.diktat.ruleset.rules.chapter2.comments.HeaderCommentRule.Companion.hyphenRegex -import com.squareup.kotlinpoet.FileSpec -import com.squareup.kotlinpoet.KModifier -import com.squareup.kotlinpoet.PropertySpec -import com.squareup.kotlinpoet.TypeSpec import java.nio.file.Files import java.nio.file.Paths @@ -22,49 +17,13 @@ import kotlin.io.path.name import kotlin.io.path.readLines import kotlin.io.path.writeLines -/** - * The comment that will be added to the generated sources file. - */ -private val autoGenerationComment = - """ - | This document was auto generated, please don't modify it. - | This document contains all enum properties from Warnings.kt as Strings. - """.trimMargin() - fun main(args: Array) { require(args.size == 2) { "Only two arguments are expected: " } - generateWarningNames(args[0]) validateYear(args[1]) } -private fun generateWarningNames(sourceDirectory: String) { - val enumValNames = Warnings.values().map { it.name } - - val propertyList = enumValNames.map { - PropertySpec - .builder(it, String::class) - .addModifiers(KModifier.CONST) - .initializer("\"$it\"") - .build() - } - - val fileBody = TypeSpec - .objectBuilder("WarningNames") - .addProperties(propertyList) - .build() - - val kotlinFile = FileSpec - .builder("generated", "WarningNames") - .addType(fileBody) - .indent(" ") - .addFileComment(autoGenerationComment) - .build() - - kotlinFile.writeTo(Paths.get(sourceDirectory)) -} - private fun validateYear(testResourcesDirectory: String) { val folder = Paths.get(testResourcesDirectory, "test/paragraph2/header") Files.list(folder) diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/EnumValueCaseTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/EnumValueCaseTest.kt index e083ee5c5f..9fcb27aee0 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/EnumValueCaseTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/EnumValueCaseTest.kt @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/IdentifierNamingFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/IdentifierNamingFixTest.kt index 200cc3a4be..d9e971963b 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/IdentifierNamingFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/IdentifierNamingFixTest.kt @@ -4,7 +4,7 @@ import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 ab32c4d1c4..edb929e592 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 @@ -19,7 +19,7 @@ import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 288c70cec7..ba3995fccc 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 @@ -8,7 +8,7 @@ import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackageNamingFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackageNamingFixTest.kt index 4c61ed6e52..4839fe85fb 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackageNamingFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackageNamingFixTest.kt @@ -4,7 +4,7 @@ import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.rules.chapter1.PackageNaming import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 60ddd1e26a..6e6b6fd905 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 @@ -13,7 +13,7 @@ import org.cqfn.diktat.util.LintTestBase import org.cqfn.diktat.util.TEST_FILE_NAME import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackagePathFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackagePathFixTest.kt index 5bd83cc205..31cded00bd 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackagePathFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackagePathFixTest.kt @@ -4,7 +4,7 @@ import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.rules.chapter1.PackageNaming import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/CommentsFormattingFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/CommentsFormattingFixTest.kt index 867c2d5433..f825257beb 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/CommentsFormattingFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/CommentsFormattingFixTest.kt @@ -5,10 +5,10 @@ import org.cqfn.diktat.ruleset.chapter3.spaces.describe import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.CommentsFormatting import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames.COMMENT_WHITE_SPACE -import generated.WarningNames.FIRST_COMMENT_NO_BLANK_LINE -import generated.WarningNames.IF_ELSE_COMMENTS -import generated.WarningNames.WRONG_NEWLINES_AROUND_KDOC +import org.cqfn.diktat.ruleset.constants.WarningsNames.COMMENT_WHITE_SPACE +import org.cqfn.diktat.ruleset.constants.WarningsNames.FIRST_COMMENT_NO_BLANK_LINE +import org.cqfn.diktat.ruleset.constants.WarningsNames.IF_ELSE_COMMENTS +import org.cqfn.diktat.ruleset.constants.WarningsNames.WRONG_NEWLINES_AROUND_KDOC import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags 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 8b87bbc735..9e6b4ba126 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.CommentsFormatting import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.intellij.lang.annotations.Language import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/HeaderCommentRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/HeaderCommentRuleFixTest.kt index c695aaf32a..24954665b4 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/HeaderCommentRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/HeaderCommentRuleFixTest.kt @@ -6,8 +6,8 @@ import org.cqfn.diktat.ruleset.constants.Warnings.HEADER_WRONG_FORMAT import org.cqfn.diktat.ruleset.rules.chapter2.comments.HeaderCommentRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames -import generated.WarningNames.WRONG_COPYRIGHT_YEAR +import org.cqfn.diktat.ruleset.constants.WarningsNames +import org.cqfn.diktat.ruleset.constants.WarningsNames.WRONG_COPYRIGHT_YEAR import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 e96b4b614d..9ae0e4598d 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 @@ -11,7 +11,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.comments.HeaderCommentRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocCommentsFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocCommentsFixTest.kt index ae2c1ef8a7..4046e7768c 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocCommentsFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocCommentsFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter2 import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocComments import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 fdbe16ef74..ec8538b4c2 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 @@ -13,7 +13,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocComments import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocFormattingFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocFormattingFixTest.kt index 8dc34df986..5af89785e5 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocFormattingFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocFormattingFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter2 import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocFormatting import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 9779a3c7b9..98a2f7d777 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 @@ -15,7 +15,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocFormatting import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocMethodsFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocMethodsFixTest.kt index 6fe6014cef..7d91029c0f 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocMethodsFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocMethodsFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter2 import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocMethods import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 d4166a1965..4325ae816d 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 @@ -12,7 +12,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocMethods import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 a44168ec7a..450f8f5f7b 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocMethods import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 04aad9c13b..81f4d7ebeb 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.comments.CommentsRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/AnnotationNewLineRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/AnnotationNewLineRuleFixTest.kt index 9f8df60fea..d85c4a4126 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/AnnotationNewLineRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/AnnotationNewLineRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.AnnotationNewLineRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 8fb9cd572c..c320a5363d 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.AnnotationNewLineRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BlockStructureBracesFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BlockStructureBracesFixTest.kt index ca19b19536..4da44aac55 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BlockStructureBracesFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BlockStructureBracesFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.BlockStructureBraces import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 23d4eed513..7973ea392b 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.BlockStructureBraces import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BooleanExpressionsRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BooleanExpressionsRuleFixTest.kt index fbd015f7a5..e65e797624 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BooleanExpressionsRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BooleanExpressionsRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.BooleanExpressionsRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 e03919276c..c1e221fcf5 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.utils.KotlinParser import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BracesRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BracesRuleFixTest.kt index 98e0bcfdc5..bb0dd6e0ca 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BracesRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BracesRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.BracesInConditionalsAndLoopsRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 48a9431890..828959f602 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.BracesInConditionalsAndLoopsRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ClassLikeStructuresOrderFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ClassLikeStructuresOrderFixTest.kt index 1e1bef6fa0..2b7ed751fe 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ClassLikeStructuresOrderFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ClassLikeStructuresOrderFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.ClassLikeStructuresOrderRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 415012b835..af4e50ddc6 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 @@ -8,7 +8,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.ClassLikeStructuresOrderRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.assertj.core.api.Assertions.assertThat import org.intellij.lang.annotations.Language import org.junit.jupiter.api.Tag diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/CollapseIfStatementsRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/CollapseIfStatementsRuleFixTest.kt index 3cb6833f82..f3fd0b5f63 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/CollapseIfStatementsRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/CollapseIfStatementsRuleFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.CollapseIfStatementsRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 d8c5fe53d6..08818ae691 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.CollapseIfStatementsRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ConsecutiveSpacesRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ConsecutiveSpacesRuleFixTest.kt index 7ea87ddde6..ff75d70ce9 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ConsecutiveSpacesRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ConsecutiveSpacesRuleFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.ConsecutiveSpacesRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 3ae0d5a7a5..53b347fd05 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.ConsecutiveSpacesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 e460036f46..59048c2eea 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.DebugPrintRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EmptyBlockFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EmptyBlockFixTest.kt index 2a5e899323..bd7dee809a 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EmptyBlockFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EmptyBlockFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.EmptyBlock import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 213ce928a8..a957ce4649 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.EmptyBlock import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EnumsSeparatedFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EnumsSeparatedFixTest.kt index 0617b45687..8f8511d96b 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EnumsSeparatedFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EnumsSeparatedFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.EnumsSeparated import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 1c2cc672ec..4dc50757eb 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.EnumsSeparated import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 cd578e1b8e..7249733bb9 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.FileSize import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileStructureRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileStructureRuleFixTest.kt index 72f7680a58..36264f6ba8 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileStructureRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileStructureRuleFixTest.kt @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.files.FileStructureRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 e3ecd45387..b906fefb8e 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 @@ -12,7 +12,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.FileStructureRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 463090c776..ed138f13df 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 @@ -9,7 +9,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.LineLength import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 51f59e574f..47804e272f 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.identifiers.LocalVariablesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.LOCAL_VARIABLE_EARLY_DECLARATION +import org.cqfn.diktat.ruleset.constants.WarningsNames.LOCAL_VARIABLE_EARLY_DECLARATION import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LongNumericalValuesSeparatedFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LongNumericalValuesSeparatedFixTest.kt index 75f680085f..8921cb9e93 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LongNumericalValuesSeparatedFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LongNumericalValuesSeparatedFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.LongNumericalValuesSeparatedRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames.LONG_NUMERICAL_VALUES_SEPARATED +import org.cqfn.diktat.ruleset.constants.WarningsNames.LONG_NUMERICAL_VALUES_SEPARATED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 f564afc014..b9d84fdae9 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.LongNumericalValuesSeparatedRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.LONG_NUMERICAL_VALUES_SEPARATED +import org.cqfn.diktat.ruleset.constants.WarningsNames.LONG_NUMERICAL_VALUES_SEPARATED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 ec73e59b55..b9ef4ec598 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.MagicNumberRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MultipleModifiersSequenceFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MultipleModifiersSequenceFixTest.kt index f052494e56..0ec0be04c8 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MultipleModifiersSequenceFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MultipleModifiersSequenceFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.MultipleModifiersSequence import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 8a672bce7a..4e9846a7f0 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.MultipleModifiersSequence import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/NullableTypeRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/NullableTypeRuleFixTest.kt index f78969f34f..654f0c04fd 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/NullableTypeRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/NullableTypeRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.NullableTypeRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 a0de2c05eb..ca0d8c7835 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.NullableTypeRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleFixTest.kt index 317236de90..bf50ecb742 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.SingleLineStatementsRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 482de292d4..b6f1fa6cd9 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.SingleLineStatementsRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SortRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SortRuleFixTest.kt index f00a9f6208..a1ea276473 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SortRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SortRuleFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.SortRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 75bddc621b..0efa1c5d3c 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.SortRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringConcatenationRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringConcatenationRuleFixTest.kt index 2705a85f33..9e1e5015d9 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringConcatenationRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringConcatenationRuleFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.StringConcatenationRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 eace0eb09b..84935b4223 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.StringConcatenationRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringTemplateRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringTemplateRuleFixTest.kt index 6f584924a9..b9027c64fe 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringTemplateRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringTemplateRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.StringTemplateFormatRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 1f53b01d40..c018155f40 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 @@ -6,8 +6,8 @@ import org.cqfn.diktat.ruleset.rules.chapter3.StringTemplateFormatRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.STRING_TEMPLATE_CURLY_BRACES -import generated.WarningNames.STRING_TEMPLATE_QUOTES +import org.cqfn.diktat.ruleset.constants.WarningsNames.STRING_TEMPLATE_CURLY_BRACES +import org.cqfn.diktat.ruleset.constants.WarningsNames.STRING_TEMPLATE_QUOTES import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/TrailingCommaFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/TrailingCommaFixTest.kt index 226b478ca2..fd7cbe6471 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/TrailingCommaFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/TrailingCommaFixTest.kt @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.TrailingCommaRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 ca06598ba0..30e48d3279 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.TrailingCommaRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/WhenMustHaveElseFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/WhenMustHaveElseFixTest.kt index 6a91e4685d..e355ae8d91 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/WhenMustHaveElseFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/WhenMustHaveElseFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.WhenMustHaveElseRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 a41baac3ba..186af734aa 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.WhenMustHaveElseRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/BlankLinesFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/BlankLinesFixTest.kt index 7855629c65..4a6c2e50a2 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/BlankLinesFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/BlankLinesFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3.files import org.cqfn.diktat.ruleset.rules.chapter3.files.BlankLinesRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 51bc63d232..b24b4b606e 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.BlankLinesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/NewlinesRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/NewlinesRuleFixTest.kt index 80232ddc10..e0e551d230 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/NewlinesRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/NewlinesRuleFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.files.NewlinesRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 6df9da27dd..5537f12ab9 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 @@ -9,7 +9,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.NewlinesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/TopLevelOrderRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/TopLevelOrderRuleFixTest.kt index 4b6d875b60..dac958db7c 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/TopLevelOrderRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/TopLevelOrderRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3.files import org.cqfn.diktat.ruleset.rules.chapter3.files.TopLevelOrderRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 ec84b2030f..93a804fc0d 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.TopLevelOrderRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleFixTest.kt index 75cfdd41be..a695ebb87d 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleFixTest.kt @@ -15,7 +15,7 @@ import org.cqfn.diktat.ruleset.utils.indentation.IndentationConfig.Companion.NEW import org.cqfn.diktat.test.framework.processing.FileComparisonResult import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.assertj.core.api.Assertions.assertThat import org.intellij.lang.annotations.Language import org.junit.jupiter.api.Nested 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 79adc34eb8..ad52fddf29 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 @@ -14,7 +14,7 @@ import org.cqfn.diktat.ruleset.utils.indentation.IndentationConfig.Companion.IND import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import org.junit.jupiter.api.TestMethodOrder diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/WhiteSpaceRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/WhiteSpaceRuleFixTest.kt index a4560c373a..e8e5e4511c 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/WhiteSpaceRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/WhiteSpaceRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3.spaces import org.cqfn.diktat.ruleset.rules.chapter3.files.WhiteSpaceRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 d7a5c39077..f8f58417ef 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.WhiteSpaceRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTest.kt index 3c34aff3a2..7c48527043 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTest.kt @@ -1,6 +1,6 @@ package org.cqfn.diktat.ruleset.chapter3.spaces.junit -import generated.WarningNames.WRONG_INDENTATION +import org.cqfn.diktat.ruleset.constants.WarningsNames.WRONG_INDENTATION import org.junit.jupiter.api.Tag import org.junit.jupiter.api.TestTemplate import org.junit.jupiter.api.extension.ExtendWith diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTestInvocationContextProvider.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTestInvocationContextProvider.kt index 2bee3d4f0f..5845c77311 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTestInvocationContextProvider.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTestInvocationContextProvider.kt @@ -9,7 +9,7 @@ import org.cqfn.diktat.ruleset.utils.indentation.IndentationConfig.Companion.EXT import org.cqfn.diktat.ruleset.utils.indentation.IndentationConfig.Companion.EXTENDED_INDENT_OF_PARAMETERS import org.cqfn.diktat.ruleset.utils.leadingSpaceCount import org.cqfn.diktat.util.assertNotNull -import generated.WarningNames.WRONG_INDENTATION +import org.cqfn.diktat.ruleset.constants.WarningsNames.WRONG_INDENTATION import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.fail import org.intellij.lang.annotations.Language 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 bf5da3910c..92561564e2 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter4.calculations.AccurateCalculationsR import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 fc954509ae..cdd0c515fc 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter4.ImmutableValNoVarRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.SAY_NO_TO_VAR +import org.cqfn.diktat.ruleset.constants.WarningsNames.SAY_NO_TO_VAR import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NullChecksRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NullChecksRuleFixTest.kt index f97bf3ebdb..c6a08e91e3 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NullChecksRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NullChecksRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter4 import org.cqfn.diktat.ruleset.rules.chapter4.NullChecksRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 cf7d11726f..f9ee2f717f 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter4.NullChecksRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 300cd4648f..d903607a99 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter4.SmartCastRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.SMART_CAST_NEEDED +import org.cqfn.diktat.ruleset.constants.WarningsNames.SMART_CAST_NEEDED import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 c3fd6297d7..b428fd9dab 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter4.TypeAliasRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/VariableGenericTypeDeclarationRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/VariableGenericTypeDeclarationRuleFixTest.kt index 25b089f83d..395a788113 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/VariableGenericTypeDeclarationRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/VariableGenericTypeDeclarationRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter4 import org.cqfn.diktat.ruleset.rules.chapter4.VariableGenericTypeDeclarationRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 d48aa0aee6..a198b03a38 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter4.VariableGenericTypeDeclarationRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.GENERIC_VARIABLE_WRONG_DECLARATION +import org.cqfn.diktat.ruleset.constants.WarningsNames.GENERIC_VARIABLE_WRONG_DECLARATION import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 469294936d..37ccc39b02 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.AsyncAndSyncRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AvoidNestedFunctionsFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AvoidNestedFunctionsFixTest.kt index 31f089403e..b748f85487 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AvoidNestedFunctionsFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AvoidNestedFunctionsFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter5 import org.cqfn.diktat.ruleset.rules.chapter5.AvoidNestedFunctionsRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 248e915dd2..cc62e8636b 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.AvoidNestedFunctionsRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.AVOID_NESTED_FUNCTIONS +import org.cqfn.diktat.ruleset.constants.WarningsNames.AVOID_NESTED_FUNCTIONS import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CheckInverseMethodRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CheckInverseMethodRuleFixTest.kt index fdf49b9e1d..b882d29e93 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CheckInverseMethodRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CheckInverseMethodRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter5 import org.cqfn.diktat.ruleset.rules.chapter5.CheckInverseMethodRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames.INVERSE_FUNCTION_PREFERRED +import org.cqfn.diktat.ruleset.constants.WarningsNames.INVERSE_FUNCTION_PREFERRED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 17ab8bba16..8660c5d8f9 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.CheckInverseMethodRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.INVERSE_FUNCTION_PREFERRED +import org.cqfn.diktat.ruleset.constants.WarningsNames.INVERSE_FUNCTION_PREFERRED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 95d0440526..148f680b6b 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.CustomLabel import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 cbe78faacf..15bd0d91f3 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.FunctionArgumentsSize import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 35b67631bc..25145b0267 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.FunctionLength import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 f1c3cdd249..bfbd0579d5 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.LambdaLengthRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 8cc527f53c..fcbb7c04ea 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.LambdaParameterOrder import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 92a733494f..2514ad982b 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.NestedFunctionBlock import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 eac4209fa8..46899b690b 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.OverloadingArgumentsFunction import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 dda19c367f..3921445bb4 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.ParameterNameInOuterLambdaRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AbstractClassesFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AbstractClassesFixTest.kt index ccbf59a0af..f4b5fa20de 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AbstractClassesFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AbstractClassesFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.classes.AbstractClassesRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames.CLASS_SHOULD_NOT_BE_ABSTRACT +import org.cqfn.diktat.ruleset.constants.WarningsNames.CLASS_SHOULD_NOT_BE_ABSTRACT import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 21f2176031..53485c9c13 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.AbstractClassesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.CLASS_SHOULD_NOT_BE_ABSTRACT +import org.cqfn.diktat.ruleset.constants.WarningsNames.CLASS_SHOULD_NOT_BE_ABSTRACT import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 0f18e6312e..0828383f68 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.AvoidUtilityClass import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CompactInitializationFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CompactInitializationFixTest.kt index 2232e308b5..593ecc3ee6 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CompactInitializationFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CompactInitializationFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.classes.CompactInitialization import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 e5eae7488e..48c4f8199c 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.CompactInitialization import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 7e76dd583f..72483495f6 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.CustomGetterSetterRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.CUSTOM_GETTERS_SETTERS +import org.cqfn.diktat.ruleset.constants.WarningsNames.CUSTOM_GETTERS_SETTERS import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 ce4dba68e7..fcb593af39 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.DataClassesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.USE_DATA_CLASS +import org.cqfn.diktat.ruleset.constants.WarningsNames.USE_DATA_CLASS import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/EmptyPrimaryConstructorFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/EmptyPrimaryConstructorFixTest.kt index 3fdf3e15a8..d80a0aded8 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/EmptyPrimaryConstructorFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/EmptyPrimaryConstructorFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.AvoidEmptyPrimaryConstructor import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 9f131203c9..a14d7e2c0e 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.AvoidEmptyPrimaryConstructor import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 4cdff48e26..a7997a583f 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.ExtensionFunctionsInFileRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.EXTENSION_FUNCTION_WITH_CLASS +import org.cqfn.diktat.ruleset.constants.WarningsNames.EXTENSION_FUNCTION_WITH_CLASS import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 4760b91db4..5e1825eb50 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.ExtensionFunctionsSameNameRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.EXTENSION_FUNCTION_SAME_SIGNATURE +import org.cqfn.diktat.ruleset.constants.WarningsNames.EXTENSION_FUNCTION_SAME_SIGNATURE import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 9433e0e937..8448fce099 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.ImplicitBackingPropertyRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.NO_CORRESPONDING_PROPERTY +import org.cqfn.diktat.ruleset.constants.WarningsNames.NO_CORRESPONDING_PROPERTY import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 e1e7a57700..5558360ade 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 @@ -8,7 +8,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.InlineClassesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 b488e8a577..ffea0fdce0 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.PropertyAccessorFields import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/RunInScriptFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/RunInScriptFixTest.kt index 5961acb89d..098d820f7d 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/RunInScriptFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/RunInScriptFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.RunInScript import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 440dbdf3dd..ae2e67192a 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.RunInScript import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleConstructorRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleConstructorRuleFixTest.kt index 9616300dea..4c488b9ad5 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleConstructorRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleConstructorRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.classes.SingleConstructorRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 fe9f1b8066..2079e430f4 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.SingleConstructorRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleInitRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleInitRuleFixTest.kt index 8dcb4a39f5..631c8525f5 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleInitRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleInitRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.classes.SingleInitRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 ebde70f1b6..3ad5eb6b7c 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.SingleInitRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/StatelessClassesRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/StatelessClassesRuleFixTest.kt index 51987e0279..9412cd7999 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/StatelessClassesRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/StatelessClassesRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.classes.StatelessClassesRule import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames.OBJECT_IS_PREFERRED +import org.cqfn.diktat.ruleset.constants.WarningsNames.OBJECT_IS_PREFERRED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 17f9ffe53b..1ad9253d3d 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.StatelessClassesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.OBJECT_IS_PREFERRED +import org.cqfn.diktat.ruleset.constants.WarningsNames.OBJECT_IS_PREFERRED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/TrivialPropertyAccessorsFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/TrivialPropertyAccessorsFixTest.kt index 1d9e11013c..353f437e64 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/TrivialPropertyAccessorsFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/TrivialPropertyAccessorsFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.TrivialPropertyAccessors import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames.TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED +import org.cqfn.diktat.ruleset.constants.WarningsNames.TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 7ef6e71bf7..3fe7feabeb 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.TrivialPropertyAccessors import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames.TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED +import org.cqfn.diktat.ruleset.constants.WarningsNames.TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 444b3eee2b..d15f05ac0d 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.UseLastIndex import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UselessSupertypeFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UselessSupertypeFixTest.kt index eb9faab46b..4d969ae9b9 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UselessSupertypeFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UselessSupertypeFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.UselessSupertype import org.cqfn.diktat.util.FixTestBase -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 45aaf6f58b..c75c07db78 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.UselessSupertype import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/junit/RuleInvocationContextProvider.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/junit/RuleInvocationContextProvider.kt index 66fefd7cb4..53cc83257c 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/junit/RuleInvocationContextProvider.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/junit/RuleInvocationContextProvider.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.junit import org.cqfn.diktat.ruleset.utils.NEWLINE -import generated.WarningNames +import org.cqfn.diktat.ruleset.constants.WarningsNames import org.assertj.core.api.Assertions.assertThat import org.intellij.lang.annotations.Language import org.junit.jupiter.api.TestTemplate diff --git a/diktat-ruleset/build.gradle.kts b/diktat-ruleset/build.gradle.kts index 12f0591c09..1d4fdfef4e 100644 --- a/diktat-ruleset/build.gradle.kts +++ b/diktat-ruleset/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } dependencies { - implementation(projects.diktatRules) { + api(projects.diktatRules) { exclude("org.jetbrains.kotlin", "kotlin-stdlib-common") exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8") exclude("org.jetbrains.kotlin", "kotlin-stdlib") diff --git a/settings.gradle.kts b/settings.gradle.kts index c9acf4c16a..bcf2a7b924 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,6 +24,7 @@ include("diktat-maven-plugin") include("diktat-rules") include("diktat-ruleset") include("diktat-test-framework") +include("diktat-dev-ksp") enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") From 45ca514299d0f545741e6089cef2a46e422d16a1 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 15 Mar 2023 14:44:19 +0300 Subject: [PATCH 10/50] reverted unused changes --- info/gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/gradle/wrapper/gradle-wrapper.properties b/info/gradle/wrapper/gradle-wrapper.properties index e1bef7e873..774fae8767 100644 --- a/info/gradle/wrapper/gradle-wrapper.properties +++ b/info/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 9b519f96bfc371f7b7593b22c014be2b82bb489e Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 15 Mar 2023 14:50:20 +0300 Subject: [PATCH 11/50] reverted unused changes with WarningNames --- .../generation/EnumNamesSymbolProcessor.kt | 29 ++++++++----------- .../EnumNamesSymbolProcessorProvider.kt | 16 ++++++++-- diktat-rules/build.gradle.kts | 4 ++- .../ruleset/chapter1/EnumValueCaseTest.kt | 2 +- .../chapter1/IdentifierNamingFixTest.kt | 2 +- .../chapter1/IdentifierNamingWarnTest.kt | 2 +- .../ruleset/chapter1/MethodNamingWarnTest.kt | 2 +- .../ruleset/chapter1/PackageNamingFixTest.kt | 2 +- .../ruleset/chapter1/PackageNamingWarnTest.kt | 2 +- .../ruleset/chapter1/PackagePathFixTest.kt | 2 +- .../chapter2/CommentsFormattingFixTest.kt | 8 ++--- .../chapter2/CommentsFormattingTest.kt | 2 +- .../chapter2/HeaderCommentRuleFixTest.kt | 4 +-- .../ruleset/chapter2/HeaderCommentRuleTest.kt | 2 +- .../ruleset/chapter2/KdocCommentsFixTest.kt | 2 +- .../ruleset/chapter2/KdocCommentsWarnTest.kt | 2 +- .../ruleset/chapter2/KdocFormattingFixTest.kt | 2 +- .../ruleset/chapter2/KdocFormattingTest.kt | 2 +- .../ruleset/chapter2/KdocMethodsFixTest.kt | 2 +- .../ruleset/chapter2/KdocMethodsTest.kt | 2 +- .../chapter2/KdocParamPresentWarnTest.kt | 2 +- .../chapter2/comments/CommentedCodeTest.kt | 2 +- .../chapter3/AnnotationNewLineRuleFixTest.kt | 2 +- .../chapter3/AnnotationNewLineRuleWarnTest.kt | 2 +- .../chapter3/BlockStructureBracesFixTest.kt | 2 +- .../chapter3/BlockStructureBracesWarnTest.kt | 2 +- .../chapter3/BooleanExpressionsRuleFixTest.kt | 2 +- .../BooleanExpressionsRuleWarnTest.kt | 2 +- .../ruleset/chapter3/BracesRuleFixTest.kt | 2 +- .../ruleset/chapter3/BracesRuleWarnTest.kt | 2 +- .../ClassLikeStructuresOrderFixTest.kt | 2 +- .../ClassLikeStructuresOrderRuleWarnTest.kt | 2 +- .../CollapseIfStatementsRuleFixTest.kt | 2 +- .../CollapseIfStatementsRuleWarnTest.kt | 2 +- .../chapter3/ConsecutiveSpacesRuleFixTest.kt | 2 +- .../chapter3/ConsecutiveSpacesRuleWarnTest.kt | 2 +- .../chapter3/DebugPrintRuleWarnTest.kt | 2 +- .../ruleset/chapter3/EmptyBlockFixTest.kt | 2 +- .../ruleset/chapter3/EmptyBlockWarnTest.kt | 2 +- .../ruleset/chapter3/EnumsSeparatedFixTest.kt | 2 +- .../chapter3/EnumsSeparatedWarnTest.kt | 2 +- .../ruleset/chapter3/FileSizeWarnTest.kt | 2 +- .../chapter3/FileStructureRuleFixTest.kt | 2 +- .../ruleset/chapter3/FileStructureRuleTest.kt | 2 +- .../ruleset/chapter3/LineLengthWarnTest.kt | 2 +- .../chapter3/LocalVariablesWarnTest.kt | 2 +- .../LongNumericalValuesSeparatedFixTest.kt | 2 +- .../LongNumericalValuesSeparatedWarnTest.kt | 2 +- .../chapter3/MagicNumberRuleWarnTest.kt | 2 +- .../MultipleModifiersSequenceFixTest.kt | 2 +- .../MultipleModifiersSequenceWarnTest.kt | 2 +- .../chapter3/NullableTypeRuleFixTest.kt | 2 +- .../chapter3/NullableTypeRuleWarnTest.kt | 2 +- .../SingleLineStatementsRuleFixTest.kt | 2 +- .../SingleLineStatementsRuleWarnTest.kt | 2 +- .../ruleset/chapter3/SortRuleFixTest.kt | 2 +- .../ruleset/chapter3/SortRuleWarnTest.kt | 2 +- .../StringConcatenationRuleFixTest.kt | 2 +- .../chapter3/StringConcatenationWarnTest.kt | 2 +- .../chapter3/StringTemplateRuleFixTest.kt | 2 +- .../chapter3/StringTemplateRuleWarnTest.kt | 4 +-- .../ruleset/chapter3/TrailingCommaFixTest.kt | 2 +- .../ruleset/chapter3/TrailingCommaWarnTest.kt | 2 +- .../chapter3/WhenMustHaveElseFixTest.kt | 2 +- .../chapter3/WhenMustHaveElseWarnTest.kt | 2 +- .../chapter3/files/BlankLinesFixTest.kt | 2 +- .../chapter3/files/BlankLinesWarnTest.kt | 2 +- .../chapter3/files/NewlinesRuleFixTest.kt | 2 +- .../chapter3/files/NewlinesRuleWarnTest.kt | 2 +- .../files/TopLevelOrderRuleFixTest.kt | 2 +- .../files/TopLevelOrderRuleWarnTest.kt | 2 +- .../chapter3/spaces/IndentationRuleFixTest.kt | 2 +- .../spaces/IndentationRuleWarnTest.kt | 2 +- .../chapter3/spaces/WhiteSpaceRuleFixTest.kt | 2 +- .../chapter3/spaces/WhiteSpaceRuleWarnTest.kt | 2 +- .../chapter3/spaces/junit/IndentationTest.kt | 2 +- ...ndentationTestInvocationContextProvider.kt | 2 +- .../chapter4/AccurateCalculationsWarnTest.kt | 2 +- .../ruleset/chapter4/NoVarRuleWarnTest.kt | 2 +- .../ruleset/chapter4/NullChecksRuleFixTest.kt | 2 +- .../chapter4/NullChecksRuleWarnTest.kt | 2 +- .../ruleset/chapter4/SmartCastRuleWarnTest.kt | 2 +- .../ruleset/chapter4/TypeAliasRuleWarnTest.kt | 2 +- ...riableGenericTypeDeclarationRuleFixTest.kt | 2 +- ...iableGenericTypeDeclarationRuleWarnTest.kt | 2 +- .../ruleset/chapter5/AsyncAndSyncRuleTest.kt | 2 +- .../chapter5/AvoidNestedFunctionsFixTest.kt | 2 +- .../chapter5/AvoidNestedFunctionsWarnTest.kt | 2 +- .../chapter5/CheckInverseMethodRuleFixTest.kt | 2 +- .../CheckInverseMethodRuleWarnTest.kt | 2 +- .../ruleset/chapter5/CustomLabelsTest.kt | 2 +- .../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/AbstractClassesFixTest.kt | 2 +- .../chapter6/AbstractClassesWarnTest.kt | 2 +- .../chapter6/AvoidUtilityClassWarnTest.kt | 2 +- .../chapter6/CompactInitializationFixTest.kt | 2 +- .../chapter6/CompactInitializationWarnTest.kt | 2 +- .../chapter6/CustomGetterSetterWarnTest.kt | 2 +- .../chapter6/DataClassesRuleWarnTest.kt | 2 +- .../EmptyPrimaryConstructorFixTest.kt | 2 +- .../EmptyPrimaryConstructorWarnTest.kt | 2 +- .../ExtensionFunctionsInFileWarnTest.kt | 2 +- .../ExtensionFunctionsSameNameWarnTest.kt | 2 +- .../ImplicitBackingPropertyWarnTest.kt | 2 +- .../ruleset/chapter6/InlineClassesWarnTest.kt | 2 +- .../PropertyAccessorFieldsWarnTest.kt | 2 +- .../ruleset/chapter6/RunInScriptFixTest.kt | 2 +- .../ruleset/chapter6/RunInScriptWarnTest.kt | 2 +- .../chapter6/SingleConstructorRuleFixTest.kt | 2 +- .../chapter6/SingleConstructorRuleWarnTest.kt | 2 +- .../ruleset/chapter6/SingleInitRuleFixTest.kt | 2 +- .../chapter6/SingleInitRuleWarnTest.kt | 2 +- .../chapter6/StatelessClassesRuleFixTest.kt | 2 +- .../chapter6/StatelessClassesRuleWarnTest.kt | 2 +- .../TrivialPropertyAccessorsFixTest.kt | 2 +- .../TrivialPropertyAccessorsWarnTest.kt | 2 +- .../ruleset/chapter6/UseLastIndexWarnTest.kt | 2 +- .../chapter6/UselessSupertypeFixTest.kt | 2 +- .../chapter6/UselessSupertypeWarnTest.kt | 2 +- .../junit/RuleInvocationContextProvider.kt | 2 +- 126 files changed, 157 insertions(+), 148 deletions(-) diff --git a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt index ccb43fa4b1..c55c6ce322 100644 --- a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt +++ b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt @@ -1,7 +1,6 @@ package org.cqfn.diktat.ruleset.generation import com.google.devtools.ksp.getClassDeclarationByName -import com.google.devtools.ksp.getDeclaredProperties import com.google.devtools.ksp.processing.CodeGenerator import com.google.devtools.ksp.processing.Dependencies import com.google.devtools.ksp.processing.Resolver @@ -14,41 +13,37 @@ import com.google.devtools.ksp.symbol.KSClassDeclaration * [SymbolProcessor] to generate a class with contacts for names from provided enum */ class EnumNamesSymbolProcessor( - private val enumName: String, + private val sourceEnumName: String, + private val targetPackageName: String, + private val targetClassName: String, private val codeGenerator: CodeGenerator, ) : SymbolProcessor { override fun process(resolver: Resolver): List { - val enumDeclaration = requireNotNull(resolver.getClassDeclarationByName(enumName)) { - "Not found class provided by property <${EnumNamesSymbolProcessorProvider.OPTION_NAME}>" + val enumDeclaration = requireNotNull(resolver.getClassDeclarationByName(sourceEnumName)) { + "Not found class provided by property <${EnumNamesSymbolProcessorProvider.OPTION_NAME_SOURCE_ENUM_NAME}>" } require(enumDeclaration.classKind == ClassKind.ENUM_CLASS) { - "Provided class $enumName is not enum" + "Provided class $sourceEnumName is not enum" } - val sourceFile = requireNotNull(enumDeclaration.containingFile) { - "Failed to detect a source file for $enumDeclaration" - } - - val packageName = enumDeclaration.packageName.asString() - val className = enumDeclaration.simpleName.asString() + "Names" resolver.getNewFiles() - .find { it.packageName.asString() == packageName && it.fileName == "$className.kt" } + .find { it.packageName.asString() == targetPackageName && it.fileName == "$targetClassName.kt" } ?.run { return emptyList() } codeGenerator.createNewFile( - dependencies = Dependencies(true, sourceFile), - packageName = packageName, - fileName = className, + dependencies = Dependencies.ALL_FILES, + packageName = targetPackageName, + fileName = targetClassName, ).bufferedWriter() .use { writer -> writer.write(autoGenerationComment) writer.newLine() - writer.write("package $packageName\n") + writer.write("package $targetPackageName\n") writer.newLine() writer.write("import kotlin.String\n") writer.newLine() - writer.write("object $className {\n") + writer.write("object $targetClassName {\n") enumDeclaration.declarations .filterIsInstance() .filter { it.classKind == ClassKind.ENUM_ENTRY } diff --git a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt index 634b19a72a..8912ada216 100644 --- a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt +++ b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt @@ -11,7 +11,9 @@ class EnumNamesSymbolProcessorProvider : SymbolProcessorProvider { override fun create( environment: SymbolProcessorEnvironment, ): SymbolProcessor = EnumNamesSymbolProcessor( - enumName = environment.options.getValue(OPTION_NAME), + sourceEnumName = environment.options.getValue(OPTION_NAME_SOURCE_ENUM_NAME), + targetPackageName = environment.options.getValue(OPTION_NAME_TARGET_PACKAGE_NAME), + targetClassName = environment.options.getValue(OPTION_NAME_TARGET_CLASS_NAME), codeGenerator = environment.codeGenerator, ) @@ -19,6 +21,16 @@ class EnumNamesSymbolProcessorProvider : SymbolProcessorProvider { /** * Option name to specify `enumName` */ - const val OPTION_NAME = "enumName" + const val OPTION_NAME_SOURCE_ENUM_NAME = "sourceEnumName" + + /** + * Option name to specify `packageName` for target class + */ + const val OPTION_NAME_TARGET_PACKAGE_NAME = "targetPackageName" + + /** + * Option name to specify `className` for target class + */ + const val OPTION_NAME_TARGET_CLASS_NAME = "targetClassName" } } diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index 0e06eb8e2e..ab31189e24 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -25,5 +25,7 @@ dependencies { } ksp { - arg("enumName", "org.cqfn.diktat.ruleset.constants.Warnings") + arg("sourceEnumName", "org.cqfn.diktat.ruleset.constants.Warnings") + arg("targetPackageName", "generated") + arg("targetClassName", "WarningNames") } diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/EnumValueCaseTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/EnumValueCaseTest.kt index 9fcb27aee0..e083ee5c5f 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/EnumValueCaseTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/EnumValueCaseTest.kt @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/IdentifierNamingFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/IdentifierNamingFixTest.kt index d9e971963b..200cc3a4be 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/IdentifierNamingFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/IdentifierNamingFixTest.kt @@ -4,7 +4,7 @@ import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 edb929e592..ab32c4d1c4 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 @@ -19,7 +19,7 @@ import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 ba3995fccc..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 @@ -8,7 +8,7 @@ import org.cqfn.diktat.ruleset.rules.chapter1.IdentifierNaming import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackageNamingFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackageNamingFixTest.kt index 4839fe85fb..4c61ed6e52 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackageNamingFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackageNamingFixTest.kt @@ -4,7 +4,7 @@ import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.rules.chapter1.PackageNaming import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 6e6b6fd905..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 @@ -13,7 +13,7 @@ import org.cqfn.diktat.util.LintTestBase import org.cqfn.diktat.util.TEST_FILE_NAME import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackagePathFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackagePathFixTest.kt index 31cded00bd..5bd83cc205 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackagePathFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter1/PackagePathFixTest.kt @@ -4,7 +4,7 @@ import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.ruleset.rules.chapter1.PackageNaming import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/CommentsFormattingFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/CommentsFormattingFixTest.kt index f825257beb..867c2d5433 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/CommentsFormattingFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/CommentsFormattingFixTest.kt @@ -5,10 +5,10 @@ import org.cqfn.diktat.ruleset.chapter3.spaces.describe import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.CommentsFormatting import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames.COMMENT_WHITE_SPACE -import org.cqfn.diktat.ruleset.constants.WarningsNames.FIRST_COMMENT_NO_BLANK_LINE -import org.cqfn.diktat.ruleset.constants.WarningsNames.IF_ELSE_COMMENTS -import org.cqfn.diktat.ruleset.constants.WarningsNames.WRONG_NEWLINES_AROUND_KDOC +import generated.WarningNames.COMMENT_WHITE_SPACE +import generated.WarningNames.FIRST_COMMENT_NO_BLANK_LINE +import generated.WarningNames.IF_ELSE_COMMENTS +import generated.WarningNames.WRONG_NEWLINES_AROUND_KDOC import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags 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 9e6b4ba126..8b87bbc735 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.CommentsFormatting import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.intellij.lang.annotations.Language import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/HeaderCommentRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/HeaderCommentRuleFixTest.kt index 24954665b4..c695aaf32a 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/HeaderCommentRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/HeaderCommentRuleFixTest.kt @@ -6,8 +6,8 @@ import org.cqfn.diktat.ruleset.constants.Warnings.HEADER_WRONG_FORMAT import org.cqfn.diktat.ruleset.rules.chapter2.comments.HeaderCommentRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames -import org.cqfn.diktat.ruleset.constants.WarningsNames.WRONG_COPYRIGHT_YEAR +import generated.WarningNames +import generated.WarningNames.WRONG_COPYRIGHT_YEAR import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 9ae0e4598d..e96b4b614d 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 @@ -11,7 +11,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.comments.HeaderCommentRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocCommentsFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocCommentsFixTest.kt index 4046e7768c..ae2c1ef8a7 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocCommentsFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocCommentsFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter2 import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocComments import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 ec8538b4c2..fdbe16ef74 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 @@ -13,7 +13,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocComments import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocFormattingFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocFormattingFixTest.kt index 5af89785e5..8dc34df986 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocFormattingFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocFormattingFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter2 import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocFormatting import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 98a2f7d777..9779a3c7b9 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 @@ -15,7 +15,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocFormatting import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocMethodsFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocMethodsFixTest.kt index 7d91029c0f..6fe6014cef 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocMethodsFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter2/KdocMethodsFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter2 import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocMethods import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 4325ae816d..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 @@ -12,7 +12,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocMethods import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 450f8f5f7b..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocMethods import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 81f4d7ebeb..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter2.comments.CommentsRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/AnnotationNewLineRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/AnnotationNewLineRuleFixTest.kt index d85c4a4126..9f8df60fea 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/AnnotationNewLineRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/AnnotationNewLineRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.AnnotationNewLineRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 c320a5363d..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.AnnotationNewLineRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BlockStructureBracesFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BlockStructureBracesFixTest.kt index 4da44aac55..ca19b19536 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BlockStructureBracesFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BlockStructureBracesFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.BlockStructureBraces import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 7973ea392b..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.BlockStructureBraces import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BooleanExpressionsRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BooleanExpressionsRuleFixTest.kt index e65e797624..fbd015f7a5 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BooleanExpressionsRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BooleanExpressionsRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.BooleanExpressionsRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 c1e221fcf5..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.utils.KotlinParser import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BracesRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BracesRuleFixTest.kt index bb0dd6e0ca..98e0bcfdc5 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BracesRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/BracesRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.BracesInConditionalsAndLoopsRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 828959f602..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.BracesInConditionalsAndLoopsRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ClassLikeStructuresOrderFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ClassLikeStructuresOrderFixTest.kt index 2b7ed751fe..1e1bef6fa0 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ClassLikeStructuresOrderFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ClassLikeStructuresOrderFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.ClassLikeStructuresOrderRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags import org.junit.jupiter.api.Test 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 af4e50ddc6..415012b835 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 @@ -8,7 +8,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.ClassLikeStructuresOrderRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.assertj.core.api.Assertions.assertThat import org.intellij.lang.annotations.Language import org.junit.jupiter.api.Tag diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/CollapseIfStatementsRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/CollapseIfStatementsRuleFixTest.kt index f3fd0b5f63..3cb6833f82 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/CollapseIfStatementsRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/CollapseIfStatementsRuleFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.CollapseIfStatementsRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 08818ae691..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.CollapseIfStatementsRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ConsecutiveSpacesRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ConsecutiveSpacesRuleFixTest.kt index ff75d70ce9..7ea87ddde6 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ConsecutiveSpacesRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/ConsecutiveSpacesRuleFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.ConsecutiveSpacesRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 53b347fd05..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.ConsecutiveSpacesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 59048c2eea..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.DebugPrintRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EmptyBlockFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EmptyBlockFixTest.kt index bd7dee809a..2a5e899323 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EmptyBlockFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EmptyBlockFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.EmptyBlock import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 a957ce4649..213ce928a8 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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.EmptyBlock import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EnumsSeparatedFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EnumsSeparatedFixTest.kt index 8f8511d96b..0617b45687 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EnumsSeparatedFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/EnumsSeparatedFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.EnumsSeparated import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 4dc50757eb..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.EnumsSeparated import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 7249733bb9..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.FileSize import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileStructureRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileStructureRuleFixTest.kt index 36264f6ba8..72f7680a58 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileStructureRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/FileStructureRuleFixTest.kt @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.files.FileStructureRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 b906fefb8e..e3ecd45387 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 @@ -12,7 +12,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.FileStructureRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 ed138f13df..463090c776 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 @@ -9,7 +9,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.LineLength import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 47804e272f..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.identifiers.LocalVariablesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.LOCAL_VARIABLE_EARLY_DECLARATION +import generated.WarningNames.LOCAL_VARIABLE_EARLY_DECLARATION import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LongNumericalValuesSeparatedFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LongNumericalValuesSeparatedFixTest.kt index 8921cb9e93..75f680085f 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LongNumericalValuesSeparatedFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/LongNumericalValuesSeparatedFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.LongNumericalValuesSeparatedRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames.LONG_NUMERICAL_VALUES_SEPARATED +import generated.WarningNames.LONG_NUMERICAL_VALUES_SEPARATED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 b9d84fdae9..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.LongNumericalValuesSeparatedRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.LONG_NUMERICAL_VALUES_SEPARATED +import generated.WarningNames.LONG_NUMERICAL_VALUES_SEPARATED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 b9ef4ec598..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.MagicNumberRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MultipleModifiersSequenceFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MultipleModifiersSequenceFixTest.kt index 0ec0be04c8..f052494e56 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MultipleModifiersSequenceFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MultipleModifiersSequenceFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.MultipleModifiersSequence import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 4e9846a7f0..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.MultipleModifiersSequence import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/NullableTypeRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/NullableTypeRuleFixTest.kt index 654f0c04fd..f78969f34f 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/NullableTypeRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/NullableTypeRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.NullableTypeRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 ca0d8c7835..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.NullableTypeRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleFixTest.kt index bf50ecb742..317236de90 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SingleLineStatementsRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.SingleLineStatementsRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 b6f1fa6cd9..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.SingleLineStatementsRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SortRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SortRuleFixTest.kt index a1ea276473..f00a9f6208 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SortRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/SortRuleFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.SortRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 0efa1c5d3c..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.SortRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringConcatenationRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringConcatenationRuleFixTest.kt index 9e1e5015d9..2705a85f33 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringConcatenationRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringConcatenationRuleFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.StringConcatenationRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 84935b4223..eace0eb09b 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.StringConcatenationRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringTemplateRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringTemplateRuleFixTest.kt index b9027c64fe..6f584924a9 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringTemplateRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/StringTemplateRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.StringTemplateFormatRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 c018155f40..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 @@ -6,8 +6,8 @@ import org.cqfn.diktat.ruleset.rules.chapter3.StringTemplateFormatRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.STRING_TEMPLATE_CURLY_BRACES -import org.cqfn.diktat.ruleset.constants.WarningsNames.STRING_TEMPLATE_QUOTES +import generated.WarningNames.STRING_TEMPLATE_CURLY_BRACES +import generated.WarningNames.STRING_TEMPLATE_QUOTES import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/TrailingCommaFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/TrailingCommaFixTest.kt index fd7cbe6471..226b478ca2 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/TrailingCommaFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/TrailingCommaFixTest.kt @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.TrailingCommaRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 30e48d3279..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.TrailingCommaRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/WhenMustHaveElseFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/WhenMustHaveElseFixTest.kt index e355ae8d91..6a91e4685d 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/WhenMustHaveElseFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/WhenMustHaveElseFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3 import org.cqfn.diktat.ruleset.rules.chapter3.WhenMustHaveElseRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 186af734aa..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.WhenMustHaveElseRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/BlankLinesFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/BlankLinesFixTest.kt index 4a6c2e50a2..7855629c65 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/BlankLinesFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/BlankLinesFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3.files import org.cqfn.diktat.ruleset.rules.chapter3.files.BlankLinesRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 b24b4b606e..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.BlankLinesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/NewlinesRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/NewlinesRuleFixTest.kt index e0e551d230..80232ddc10 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/NewlinesRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/NewlinesRuleFixTest.kt @@ -5,7 +5,7 @@ import org.cqfn.diktat.ruleset.constants.Warnings import org.cqfn.diktat.ruleset.rules.chapter3.files.NewlinesRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 5537f12ab9..6df9da27dd 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 @@ -9,7 +9,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.NewlinesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Tags diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/TopLevelOrderRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/TopLevelOrderRuleFixTest.kt index dac958db7c..4b6d875b60 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/TopLevelOrderRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/files/TopLevelOrderRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3.files import org.cqfn.diktat.ruleset.rules.chapter3.files.TopLevelOrderRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 93a804fc0d..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.TopLevelOrderRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleFixTest.kt index a695ebb87d..75cfdd41be 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/IndentationRuleFixTest.kt @@ -15,7 +15,7 @@ import org.cqfn.diktat.ruleset.utils.indentation.IndentationConfig.Companion.NEW import org.cqfn.diktat.test.framework.processing.FileComparisonResult import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.assertj.core.api.Assertions.assertThat import org.intellij.lang.annotations.Language import org.junit.jupiter.api.Nested 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 ad52fddf29..79adc34eb8 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 @@ -14,7 +14,7 @@ import org.cqfn.diktat.ruleset.utils.indentation.IndentationConfig.Companion.IND import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import org.junit.jupiter.api.TestMethodOrder diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/WhiteSpaceRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/WhiteSpaceRuleFixTest.kt index e8e5e4511c..a4560c373a 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/WhiteSpaceRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/WhiteSpaceRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter3.spaces import org.cqfn.diktat.ruleset.rules.chapter3.files.WhiteSpaceRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 f8f58417ef..d7a5c39077 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.WhiteSpaceRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTest.kt index 7c48527043..3c34aff3a2 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTest.kt @@ -1,6 +1,6 @@ package org.cqfn.diktat.ruleset.chapter3.spaces.junit -import org.cqfn.diktat.ruleset.constants.WarningsNames.WRONG_INDENTATION +import generated.WarningNames.WRONG_INDENTATION import org.junit.jupiter.api.Tag import org.junit.jupiter.api.TestTemplate import org.junit.jupiter.api.extension.ExtendWith diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTestInvocationContextProvider.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTestInvocationContextProvider.kt index 5845c77311..2bee3d4f0f 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTestInvocationContextProvider.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/spaces/junit/IndentationTestInvocationContextProvider.kt @@ -9,7 +9,7 @@ import org.cqfn.diktat.ruleset.utils.indentation.IndentationConfig.Companion.EXT import org.cqfn.diktat.ruleset.utils.indentation.IndentationConfig.Companion.EXTENDED_INDENT_OF_PARAMETERS import org.cqfn.diktat.ruleset.utils.leadingSpaceCount import org.cqfn.diktat.util.assertNotNull -import org.cqfn.diktat.ruleset.constants.WarningsNames.WRONG_INDENTATION +import generated.WarningNames.WRONG_INDENTATION import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.fail import org.intellij.lang.annotations.Language 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 92561564e2..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter4.calculations.AccurateCalculationsR import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 cdd0c515fc..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter4.ImmutableValNoVarRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.SAY_NO_TO_VAR +import generated.WarningNames.SAY_NO_TO_VAR import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NullChecksRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NullChecksRuleFixTest.kt index c6a08e91e3..f97bf3ebdb 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NullChecksRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/NullChecksRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter4 import org.cqfn.diktat.ruleset.rules.chapter4.NullChecksRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 f9ee2f717f..cf7d11726f 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter4.NullChecksRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 d903607a99..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter4.SmartCastRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.SMART_CAST_NEEDED +import generated.WarningNames.SMART_CAST_NEEDED import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 b428fd9dab..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter4.TypeAliasRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/VariableGenericTypeDeclarationRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/VariableGenericTypeDeclarationRuleFixTest.kt index 395a788113..25b089f83d 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/VariableGenericTypeDeclarationRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter4/VariableGenericTypeDeclarationRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter4 import org.cqfn.diktat.ruleset.rules.chapter4.VariableGenericTypeDeclarationRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 a198b03a38..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter4.VariableGenericTypeDeclarationRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.GENERIC_VARIABLE_WRONG_DECLARATION +import generated.WarningNames.GENERIC_VARIABLE_WRONG_DECLARATION import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 37ccc39b02..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.AsyncAndSyncRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AvoidNestedFunctionsFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AvoidNestedFunctionsFixTest.kt index b748f85487..31f089403e 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AvoidNestedFunctionsFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/AvoidNestedFunctionsFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter5 import org.cqfn.diktat.ruleset.rules.chapter5.AvoidNestedFunctionsRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 cc62e8636b..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.AvoidNestedFunctionsRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.AVOID_NESTED_FUNCTIONS +import generated.WarningNames.AVOID_NESTED_FUNCTIONS import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CheckInverseMethodRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CheckInverseMethodRuleFixTest.kt index b882d29e93..fdf49b9e1d 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CheckInverseMethodRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter5/CheckInverseMethodRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter5 import org.cqfn.diktat.ruleset.rules.chapter5.CheckInverseMethodRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames.INVERSE_FUNCTION_PREFERRED +import generated.WarningNames.INVERSE_FUNCTION_PREFERRED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 8660c5d8f9..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.CheckInverseMethodRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.INVERSE_FUNCTION_PREFERRED +import generated.WarningNames.INVERSE_FUNCTION_PREFERRED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 148f680b6b..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.CustomLabel import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 15bd0d91f3..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.FunctionArgumentsSize import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 25145b0267..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.FunctionLength import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 bfbd0579d5..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.LambdaLengthRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 fcbb7c04ea..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.LambdaParameterOrder import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 2514ad982b..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.NestedFunctionBlock import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 46899b690b..eac4209fa8 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.OverloadingArgumentsFunction import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 3921445bb4..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 @@ -7,7 +7,7 @@ import org.cqfn.diktat.ruleset.rules.chapter5.ParameterNameInOuterLambdaRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AbstractClassesFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AbstractClassesFixTest.kt index f4b5fa20de..ccbf59a0af 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AbstractClassesFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/AbstractClassesFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.classes.AbstractClassesRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames.CLASS_SHOULD_NOT_BE_ABSTRACT +import generated.WarningNames.CLASS_SHOULD_NOT_BE_ABSTRACT import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 53485c9c13..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.AbstractClassesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.CLASS_SHOULD_NOT_BE_ABSTRACT +import generated.WarningNames.CLASS_SHOULD_NOT_BE_ABSTRACT import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 0828383f68..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.AvoidUtilityClass import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CompactInitializationFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CompactInitializationFixTest.kt index 593ecc3ee6..2232e308b5 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CompactInitializationFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/CompactInitializationFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.classes.CompactInitialization import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 48c4f8199c..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.CompactInitialization import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 72483495f6..7e76dd583f 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.CustomGetterSetterRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.CUSTOM_GETTERS_SETTERS +import generated.WarningNames.CUSTOM_GETTERS_SETTERS import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 fcb593af39..ce4dba68e7 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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.DataClassesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.USE_DATA_CLASS +import generated.WarningNames.USE_DATA_CLASS import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/EmptyPrimaryConstructorFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/EmptyPrimaryConstructorFixTest.kt index d80a0aded8..3fdf3e15a8 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/EmptyPrimaryConstructorFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/EmptyPrimaryConstructorFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.AvoidEmptyPrimaryConstructor import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 a14d7e2c0e..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.AvoidEmptyPrimaryConstructor import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 a7997a583f..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.ExtensionFunctionsInFileRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.EXTENSION_FUNCTION_WITH_CLASS +import generated.WarningNames.EXTENSION_FUNCTION_WITH_CLASS import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 5e1825eb50..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.ExtensionFunctionsSameNameRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.EXTENSION_FUNCTION_SAME_SIGNATURE +import generated.WarningNames.EXTENSION_FUNCTION_SAME_SIGNATURE import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 8448fce099..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.ImplicitBackingPropertyRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.NO_CORRESPONDING_PROPERTY +import generated.WarningNames.NO_CORRESPONDING_PROPERTY import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 5558360ade..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 @@ -8,7 +8,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.InlineClassesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 ffea0fdce0..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.PropertyAccessorFields import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/RunInScriptFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/RunInScriptFixTest.kt index 098d820f7d..5961acb89d 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/RunInScriptFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/RunInScriptFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.RunInScript import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 ae2e67192a..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.RunInScript import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleConstructorRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleConstructorRuleFixTest.kt index 4c488b9ad5..9616300dea 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleConstructorRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleConstructorRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.classes.SingleConstructorRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 2079e430f4..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.SingleConstructorRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleInitRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleInitRuleFixTest.kt index 631c8525f5..8dcb4a39f5 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleInitRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/SingleInitRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.classes.SingleInitRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 3ad5eb6b7c..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.SingleInitRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/StatelessClassesRuleFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/StatelessClassesRuleFixTest.kt index 9412cd7999..51987e0279 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/StatelessClassesRuleFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/StatelessClassesRuleFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.classes.StatelessClassesRule import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames.OBJECT_IS_PREFERRED +import generated.WarningNames.OBJECT_IS_PREFERRED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 1ad9253d3d..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.classes.StatelessClassesRule import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.OBJECT_IS_PREFERRED +import generated.WarningNames.OBJECT_IS_PREFERRED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/TrivialPropertyAccessorsFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/TrivialPropertyAccessorsFixTest.kt index 353f437e64..1d9e11013c 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/TrivialPropertyAccessorsFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/TrivialPropertyAccessorsFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.TrivialPropertyAccessors import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames.TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED +import generated.WarningNames.TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 3fe7feabeb..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.TrivialPropertyAccessors import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames.TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED +import generated.WarningNames.TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 d15f05ac0d..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.UseLastIndex import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UselessSupertypeFixTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UselessSupertypeFixTest.kt index 4d969ae9b9..eb9faab46b 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UselessSupertypeFixTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter6/UselessSupertypeFixTest.kt @@ -3,7 +3,7 @@ package org.cqfn.diktat.ruleset.chapter6 import org.cqfn.diktat.ruleset.rules.chapter6.UselessSupertype import org.cqfn.diktat.util.FixTestBase -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test 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 c75c07db78..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 @@ -6,7 +6,7 @@ import org.cqfn.diktat.ruleset.rules.chapter6.UselessSupertype import org.cqfn.diktat.util.LintTestBase import com.pinterest.ktlint.core.LintError -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/junit/RuleInvocationContextProvider.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/junit/RuleInvocationContextProvider.kt index 53cc83257c..66fefd7cb4 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/junit/RuleInvocationContextProvider.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/junit/RuleInvocationContextProvider.kt @@ -1,7 +1,7 @@ package org.cqfn.diktat.ruleset.junit import org.cqfn.diktat.ruleset.utils.NEWLINE -import org.cqfn.diktat.ruleset.constants.WarningsNames +import generated.WarningNames import org.assertj.core.api.Assertions.assertThat import org.intellij.lang.annotations.Language import org.junit.jupiter.api.TestTemplate From d5bb2e4acfb33af3d61df41e746d089d1d0377d6 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 15 Mar 2023 15:33:10 +0300 Subject: [PATCH 12/50] moved updating copyright year to gradle --- diktat-rules/build.gradle.kts | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index ab31189e24..dfc259b56d 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -1,3 +1,6 @@ +import java.time.LocalDate +import java.nio.file.Files + plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") // id("com.saveourtool.save.buildutils.code-quality-convention") @@ -29,3 +32,40 @@ ksp { arg("targetPackageName", "generated") arg("targetClassName", "WarningNames") } + +val updateCopyrightYearInTestTaskProvider = tasks.register("updateCopyrightYearInTest") { + val headerDir = "$projectDir/src/test/resources/test/paragraph2/header" + inputs.dir(headerDir) + outputs.dir(headerDir) + + val hyphenRegex = Regex("""\d+-\d+""") + val afterCopyrightRegex = Regex("""((©|\([cC]\))+ *\d+)""") + val curYear = LocalDate.now().year + fileTree(headerDir) + .filter { !it.name.contains("CopyrightDifferentYearTest.kt") } + .map { it.toPath() } + .forEach { file -> + val updatedLines = Files.readAllLines(file).map { line -> + when { + line.contains(hyphenRegex) -> line.replace(hyphenRegex) { + val years = it.value.split("-") + "${years[0]}-$curYear" + } + line.contains(afterCopyrightRegex) -> line.replace(afterCopyrightRegex) { + val copyrightYears = it.value.split("(c)", "(C)", "©") + "${copyrightYears[0]}-$curYear" + } + else -> line + } + } + println("here") + val tempFile = temporaryDir.toPath().resolve(file.fileName) + Files.write(tempFile, updatedLines) + Files.delete(file) + Files.move(tempFile, file) + } +} + +tasks.named("compileTestKotlin") { + dependsOn(updateCopyrightYearInTestTaskProvider) +} From a37789f0334504b5ad9327f264ff59d9d1ca579a Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 15 Mar 2023 17:29:18 +0300 Subject: [PATCH 13/50] migrated maven plugin --- diktat-maven-plugin/build.gradle.kts | 27 +- diktat-maven-plugin/pom.xml | 357 ------------------ .../diktat/plugin/maven/DiktatBaseMojoTest.kt | 8 +- .../maven/DiktatMavenPluginIntegrationTest.kt | 4 +- diktat-rules/build.gradle.kts | 18 +- gradle/libs.versions.toml | 5 +- 6 files changed, 50 insertions(+), 369 deletions(-) delete mode 100644 diktat-maven-plugin/pom.xml diff --git a/diktat-maven-plugin/build.gradle.kts b/diktat-maven-plugin/build.gradle.kts index b51de0af7c..f1ee074d35 100644 --- a/diktat-maven-plugin/build.gradle.kts +++ b/diktat-maven-plugin/build.gradle.kts @@ -1,13 +1,17 @@ +import de.benediktritter.maven.plugin.development.task.GenerateMavenPluginDescriptorTask +import de.benediktritter.maven.plugin.development.task.GenerateHelpMojoSourcesTask + plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") // id("com.saveourtool.save.buildutils.code-quality-convention") id("de.benediktritter.maven-plugin-development") version "0.4.1" + `maven-publish` } dependencies { implementation(libs.maven.plugin.api) compileOnly(libs.maven.plugin.annotations) - implementation(libs.maven.core) + compileOnly(libs.maven.core) implementation(libs.kotlin.stdlib.jdk8) implementation(projects.diktatRules) @@ -18,7 +22,7 @@ dependencies { implementation(libs.ktlint.reporter.html) implementation(libs.ktlint.reporter.baseline) testImplementation(libs.junit.jupiter.api) - testRuntimeOnly(libs.junit.jupiter.engine) + testImplementation(libs.junit.vintage.engine) testImplementation(libs.junit.jupiter.extension.itf) testImplementation(libs.maven.plugin.testing.harness) // to use org.apache.maven.repository.RepositorySystem in newer maven versions and maybe other classes @@ -27,6 +31,23 @@ dependencies { testImplementation(libs.plexus.cipher) } +tasks.withType { + notCompatibleWithConfigurationCache("https://github.com/britter/maven-plugin-development/issues/8") +} + +tasks.withType { + notCompatibleWithConfigurationCache("https://github.com/britter/maven-plugin-development/issues/8") +} + mavenPlugin { - helpMojoPackage.set("org.cqfn.diktat.plugin.maven") + goalPrefix.set("diktat") +} + +publishing { + publications { + // create a publication so that the plugin can be published to the local Maven repository + create("mavenPlugin") { + from(components["java"]) + } + } } diff --git a/diktat-maven-plugin/pom.xml b/diktat-maven-plugin/pom.xml deleted file mode 100644 index d226ba16b7..0000000000 --- a/diktat-maven-plugin/pom.xml +++ /dev/null @@ -1,357 +0,0 @@ - - - - diktat-parent - org.cqfn.diktat - 1.2.4.3-SNAPSHOT - - 4.0.0 - - diktat-maven-plugin - maven-plugin - - - 3.9.0 - UTF-8 - 0.12.0 - - - - - - - - - - - org.apache.maven - maven-core - ${maven.api.version} - provided - - - org.apache.maven - maven-plugin-api - ${maven.api.version} - provided - - - org.apache.maven.plugin-tools - maven-plugin-annotations - ${maven-plugin-tools.version} - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - - - org.cqfn.diktat - diktat-rules - ${project.version} - - - com.pinterest.ktlint - ktlint-reporter-plain - - - com.pinterest.ktlint - ktlint-reporter-sarif - - - com.pinterest.ktlint - ktlint-reporter-json - - - com.pinterest.ktlint - ktlint-reporter-html - - - com.pinterest.ktlint - ktlint-reporter-baseline - - - org.junit.vintage - junit-vintage-engine - ${junit.version} - test - - - com.soebes.itf.jupiter.extension - itf-jupiter-extension - ${maven.itf.version} - test - - - org.apache.maven.plugin-testing - maven-plugin-testing-harness - 3.3.0 - test - - - - org.apache.maven - maven-compat - ${maven.api.version} - test - - - org.assertj - assertj-core - test - - - org.codehaus.plexus - plexus-cipher - 2.0 - test - - - - - src/main/kotlin - src/test/kotlin - - - org.jetbrains.kotlin - kotlin-maven-plugin - - - compile - process-sources - - compile - - - - test-compile - process-test-sources - - test-compile - - - - - src/test/kotlin - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - *IntegrationTest* - - - - - com.soebes.itf.jupiter.extension - itf-maven-plugin - ${maven.itf.version} - - - installing - pre-integration-test - - install - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - ${maven.version} - ${maven.home} - - - **/*IntegrationTest* - - - - - - integration-test - verify - - - - - - - org.jacoco - jacoco-maven-plugin - - - - **/HelpMojo* - - - - - report-integration - - - merge - report-integration - - post-integration-test - - - - ${project.build.directory} - - - jacoco-it*.exec - - - - ${project.build.directory}/jacoco-it.exec - - - - - - - - ../examples/maven - - false - ${project.build.testOutputDirectory}/org/cqfn/diktat/plugin/maven/DiktatMavenPluginIntegrationTest/diktatCheck - - - ${project.basedir}/src/test/resources/.mvn - - true - ${project.build.testOutputDirectory}/org/cqfn/diktat/plugin/maven/DiktatMavenPluginIntegrationTest/diktatCheck/.mvn - - - ../examples/maven - false - ${project.build.testOutputDirectory}/org/cqfn/diktat/plugin/maven/DiktatMavenPluginIntegrationTest/diktatFix - - - ${project.basedir}/src/test/resources/.mvn - true - ${project.build.testOutputDirectory}/org/cqfn/diktat/plugin/maven/DiktatMavenPluginIntegrationTest/diktatFix/.mvn - - - - - - - - default - - true - - - - - org.apache.maven.plugins - maven-plugin-plugin - - diktat - true - - - - mojo-descriptor - - descriptor - - - - help-goal - - helpmojo - - - - - - - - - - release - - - kotlin-maven-plugin-tools - GitHub Packages - https://maven.pkg.github.com/gantsign/kotlin-maven-plugin-tools - - false - - - - - - - org.apache.maven.plugins - maven-plugin-plugin - - diktat - true - - - kotlin - - - - - mojo-descriptor - - descriptor - - - - help-goal - - helpmojo - - - - - - com.github.gantsign.maven.plugin-tools - kotlin-maven-plugin-tools - 0.9.26 - - - - - org.codehaus.mojo - properties-maven-plugin - 1.1.0 - - - - set-system-properties - - - - - idea.io.use.nio2 - true - - - idea.io.use.fallback - true - - - - - - - - - - - diff --git a/diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojoTest.kt b/diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojoTest.kt index ea1505fda8..40d250ae3e 100644 --- a/diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojoTest.kt +++ b/diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojoTest.kt @@ -46,11 +46,11 @@ class DiktatBaseMojoTest { xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - + org.cqfn.diktat diktat-test 1.0.0-SNAPSHOT - + @@ -87,11 +87,11 @@ class DiktatBaseMojoTest { xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - + org.cqfn.diktat diktat-test 1.0.0-SNAPSHOT - + 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 95d8e6f5d1..927ded578b 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 @@ -57,7 +57,7 @@ class DiktatMavenPluginIntegrationTest { assertThat(mavenLog).contains("[FILE_NAME_MATCH_CLASS]") val method = testInfo.testMethod.get() - File(result.mavenProjectResult.targetProjectDirectory.toFile(), "target/jacoco-it.exec").copyTo( + File(result.mavenProjectResult.targetProjectDirectory, "target/jacoco-it.exec").copyTo( File("target/jacoco-it-${method.name}.exec") ) } @@ -82,7 +82,7 @@ class DiktatMavenPluginIntegrationTest { } val method = testInfo.testMethod.get() - File(result.mavenProjectResult.targetProjectDirectory.toFile(), "target/jacoco-it.exec").copyTo( + File(result.mavenProjectResult.targetProjectDirectory, "target/jacoco-it.exec").copyTo( File("target/jacoco-it-${method.name}.exec") ) } diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index dfc259b56d..a1e0cb9a9e 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -5,6 +5,7 @@ plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") // id("com.saveourtool.save.buildutils.code-quality-convention") id("com.google.devtools.ksp") version "1.8.0-1.0.8" + idea } dependencies { @@ -25,6 +26,7 @@ dependencies { // generating implementation(projects.diktatDevKsp) ksp(projects.diktatDevKsp) + testImplementation(libs.kotlin.reflect) } ksp { @@ -33,6 +35,12 @@ ksp { arg("targetClassName", "WarningNames") } +kotlin { + sourceSets.main { + kotlin.srcDir("build/generated/ksp/main/kotlin") + } +} + val updateCopyrightYearInTestTaskProvider = tasks.register("updateCopyrightYearInTest") { val headerDir = "$projectDir/src/test/resources/test/paragraph2/header" inputs.dir(headerDir) @@ -58,7 +66,6 @@ val updateCopyrightYearInTestTaskProvider = tasks.register("updateCopyrightYearI else -> line } } - println("here") val tempFile = temporaryDir.toPath().resolve(file.fileName) Files.write(tempFile, updatedLines) Files.delete(file) @@ -69,3 +76,12 @@ val updateCopyrightYearInTestTaskProvider = tasks.register("updateCopyrightYearI tasks.named("compileTestKotlin") { dependsOn(updateCopyrightYearInTestTaskProvider) } + +idea { + module { + // Not using += due to https://github.com/gradle/gradle/issues/8749 + sourceDirs = sourceDirs + file("build/generated/ksp/main/kotlin") // or tasks["kspKotlin"].destination + testSourceDirs = testSourceDirs + file("build/generated/ksp/test/kotlin") + generatedSourceDirs = generatedSourceDirs + file("build/generated/ksp/main/kotlin") + file("build/generated/ksp/test/kotlin") + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1ac3bf678f..0c3635cb1a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -87,6 +87,8 @@ kotlin-stdlib-common = { module = "org.jetbrains.kotlin:kotlin-stdlib-common", v kotlin-stdlib-jdk7 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk7", version.ref = "kotlin" } kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } kotlin-compiler-embeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embeddable", version.ref = "kotlin" } +kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } + # kotlinx serialization kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" } @@ -120,6 +122,7 @@ kotlin-logging = { module = "io.github.microutils:kotlin-logging", version.ref = junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" } junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" } junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" } +junit-vintage-engine = { module = "org.junit.vintage:junit-vintage-engine", version.ref = "junit" } junit-jupiter-extension-itf = { module = "com.soebes.itf.jupiter.extension:itf-jupiter-extension", version.ref = "jupiter-itf-extension" } assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" } junit-platform-suite = { module = "org.junit.platform:junit-platform-suite-engine", version.ref = "junit-platfrom" } @@ -138,8 +141,6 @@ plexus-cipher = { module = "org.codehaus.plexus:plexus-cipher", version.ref = "p kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotlin-plugin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" } kotlin-plugin-allopen = { module = "org.jetbrains.kotlin:kotlin-allopen", version.ref = "kotlin" } -kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } - kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialization" } kotlinx-serialization-json-jvm = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-jvm", version.ref = "serialization" } From e7cb0cab7611cc3c6a66346d543a51513645664f Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 15 Mar 2023 17:43:55 +0300 Subject: [PATCH 14/50] disabled explicit setting a goal prefix --- diktat-maven-plugin/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diktat-maven-plugin/build.gradle.kts b/diktat-maven-plugin/build.gradle.kts index f1ee074d35..54ac2284d6 100644 --- a/diktat-maven-plugin/build.gradle.kts +++ b/diktat-maven-plugin/build.gradle.kts @@ -40,7 +40,7 @@ tasks.withType { } mavenPlugin { - goalPrefix.set("diktat") +// goalPrefix.set("diktat") } publishing { From 4440904e8f05388fab3268ad500cec9412d36366 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 15 Mar 2023 18:09:33 +0300 Subject: [PATCH 15/50] upgraded ksp --- diktat-dev-ksp/build.gradle.kts | 2 +- diktat-rules/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/diktat-dev-ksp/build.gradle.kts b/diktat-dev-ksp/build.gradle.kts index eb2a37b2c6..a4042a4d38 100644 --- a/diktat-dev-ksp/build.gradle.kts +++ b/diktat-dev-ksp/build.gradle.kts @@ -3,5 +3,5 @@ plugins { } dependencies { - implementation("com.google.devtools.ksp:symbol-processing-api:1.8.0-1.0.8") + implementation("com.google.devtools.ksp:symbol-processing-api:1.8.10-1.0.9") } diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index a1e0cb9a9e..ce4c6301fd 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -4,7 +4,7 @@ import java.nio.file.Files plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") // id("com.saveourtool.save.buildutils.code-quality-convention") - id("com.google.devtools.ksp") version "1.8.0-1.0.8" + id("com.google.devtools.ksp") version "1.8.10-1.0.9" idea } From a7e9fdc78090d771c28690c8bf380d15b29dcea2 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 15 Mar 2023 18:42:56 +0300 Subject: [PATCH 16/50] removed pom.xml and fixed PublishingConfiguration --- build.gradle.kts | 4 +- diktat-common/build.gradle.kts | 2 +- diktat-common/pom.xml | 98 --- diktat-gradle-plugin/build.gradle.kts | 4 +- .../gradle-plugin-marker/pom.xml | 40 -- diktat-gradle-plugin/pom.xml | 208 ------ diktat-maven-plugin/build.gradle.kts | 2 +- diktat-rules/build.gradle.kts | 5 +- diktat-rules/pom.xml | 153 ----- diktat-ruleset/build.gradle.kts | 4 +- diktat-ruleset/pom.xml | 229 ------- diktat-test-framework/build.gradle.kts | 4 +- diktat-test-framework/pom.xml | 123 ---- gradle/libs.versions.toml | 3 +- .../buildutils/PublishingConfiguration.kt | 20 +- .../code-quality-convention.gradle.kts | 2 +- ...detekt-convention-configuration.gradle.kts | 2 +- pom.xml | 622 ------------------ 18 files changed, 32 insertions(+), 1493 deletions(-) delete mode 100644 diktat-common/pom.xml delete mode 100644 diktat-gradle-plugin/gradle-plugin-marker/pom.xml delete mode 100644 diktat-gradle-plugin/pom.xml delete mode 100644 diktat-rules/pom.xml delete mode 100644 diktat-ruleset/pom.xml delete mode 100644 diktat-test-framework/pom.xml delete mode 100644 pom.xml diff --git a/build.gradle.kts b/build.gradle.kts index 1de5c884b0..d9df4ccfd1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ import com.saveourtool.save.buildutils.* @Suppress("DSL_SCOPE_VIOLATION", "RUN_IN_SCRIPT") // https://github.com/gradle/gradle/issues/22797 plugins { id("com.saveourtool.save.buildutils.versioning-configuration") -// id("com.saveourtool.save.buildutils.code-quality-convention") + id("com.saveourtool.save.buildutils.code-quality-convention") id("com.saveourtool.save.buildutils.publishing-configuration") alias(libs.plugins.talaiot.base) java @@ -27,3 +27,5 @@ allprojects { resolutionStrategy.cacheChangingModulesFor(10, TimeUnit.MINUTES) } } + +project.description = "diKTat kotlin formatter and fixer" diff --git a/diktat-common/build.gradle.kts b/diktat-common/build.gradle.kts index 379a703287..ed0ed942c9 100644 --- a/diktat-common/build.gradle.kts +++ b/diktat-common/build.gradle.kts @@ -1,7 +1,7 @@ @Suppress("DSL_SCOPE_VIOLATION", "RUN_IN_SCRIPT") // https://github.com/gradle/gradle/issues/22797 plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") -// id("com.saveourtool.save.buildutils.code-quality-convention") + id("com.saveourtool.save.buildutils.code-quality-convention") alias(libs.plugins.kotlin.plugin.serialization) } diff --git a/diktat-common/pom.xml b/diktat-common/pom.xml deleted file mode 100644 index c03997e737..0000000000 --- a/diktat-common/pom.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - 4.0.0 - diktat-common - diktat-common - Common part - - - org.cqfn.diktat - diktat-parent - 1.2.4.3-SNAPSHOT - - - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - - - org.jetbrains.kotlinx - kotlinx-serialization-json - - - com.charleskorn.kaml - kaml-jvm - - - commons-cli - commons-cli - - - io.github.microutils - kotlin-logging-jvm - - - - com.pinterest.ktlint - ktlint-core - - - org.junit.jupiter - junit-jupiter - test - - - org.assertj - assertj-core - test - - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/test/kotlin - - - org.jetbrains.kotlin - kotlin-maven-plugin - - - compile - process-sources - - compile - - - - test-compile - process-test-sources - - test-compile - - - - src/test/kotlin - src/test/resources - - - - - - - kotlinx-serialization - - - - - org.jetbrains.kotlin - kotlin-maven-serialization - ${kotlin.version} - - - - - - - diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index 717646d622..fa537044c7 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -11,9 +11,9 @@ plugins { dependencies { implementation(kotlin("gradle-plugin-api")) - implementation(libs.sarif4k) + implementation(libs.sarif4k.jvm) - implementation(projects.diktatCommon) { + api(projects.diktatCommon) { 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/gradle-plugin-marker/pom.xml b/diktat-gradle-plugin/gradle-plugin-marker/pom.xml deleted file mode 100644 index 0efd77ffd1..0000000000 --- a/diktat-gradle-plugin/gradle-plugin-marker/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - diktat-gradle-plugin - org.cqfn.diktat - 1.2.4.3-SNAPSHOT - - 4.0.0 - - org.cqfn.diktat.diktat-gradle-plugin - org.cqfn.diktat.diktat-gradle-plugin.gradle.plugin - pom - - - - org.cqfn.diktat - diktat-gradle-plugin - ${project.version} - - - - - - - org.jetbrains.dokka - dokka-maven-plugin - ${dokka.version} - - - none - - javadocJar - - - - - - - \ No newline at end of file diff --git a/diktat-gradle-plugin/pom.xml b/diktat-gradle-plugin/pom.xml deleted file mode 100644 index 0a23744efb..0000000000 --- a/diktat-gradle-plugin/pom.xml +++ /dev/null @@ -1,208 +0,0 @@ - - - - diktat-parent - org.cqfn.diktat - 1.2.4.3-SNAPSHOT - - 4.0.0 - - diktat-gradle-plugin - - pom - - - ${project.basedir} - gradlew - build - build - false - false - - - - - org.cqfn.diktat - diktat-common - ${project.version} - - - - * - * - - - - - io.github.detekt.sarif4k - sarif4k-jvm - 0.3.0 - - - - - - - org.apache.maven.plugins - maven-clean-plugin - false - - - - ${project.basedir}/${gradle.builddir} - - - - - - org.codehaus.mojo - exec-maven-plugin - false - - ${gradle.workingDir} - ${gradle.workingDir}/${gradle.executable} - - - - gradle-test - test - - - clean - test - functionalTest - -Pgroup=${project.groupId} - -Pversion=${project.version} - -Pdescription=${project.description} - -PktlintVersion=${ktlint.version} - -PjunitVersion=${junit.version} - -PjacocoVersion=${jacoco.version} - -S - - ${skip.gradle.test} - - - exec - - - - gradle - prepare-package - - - ${gradle.task} - -Pgroup=${project.groupId} - -Pversion=${project.version} - -Pdescription=${project.description} - -PktlintVersion=${ktlint.version} - -PjunitVersion=${junit.version} - -PjacocoVersion=${jacoco.version} - -S - - - - ${skip.gradle.build} - - - exec - - - - - - org.codehaus.mojo - build-helper-maven-plugin - false - - - attach-artifacts - package - - attach-artifact - - - - - ${gradle.builddir}/libs/${project.artifactId}-${project.version}.jar - jar - - - - ${gradle.builddir}/libs/${project.artifactId}-${project.version}-sources.jar - jar - sources - - - ${skip.gradle.build} - - - - - - com.github.ozsie - detekt-maven-plugin - ${detekt.version} - - - detekt - none - - check - - - detekt-config.yml - - - 1.3 - 1.8 - **/resources/**/*.kt - - - - - - - - - - - - gradle-plugin-marker - - - - !skipPluginMarker - - - - gradle-plugin-marker - - - - local-win-build - - - windows - - - - gradlew.bat - - - - skip-gradle-tests - - - skipTests - true - - - - -xcheck - true - - - - diff --git a/diktat-maven-plugin/build.gradle.kts b/diktat-maven-plugin/build.gradle.kts index 54ac2284d6..cc12f9e55d 100644 --- a/diktat-maven-plugin/build.gradle.kts +++ b/diktat-maven-plugin/build.gradle.kts @@ -3,7 +3,7 @@ import de.benediktritter.maven.plugin.development.task.GenerateHelpMojoSourcesTa plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") -// id("com.saveourtool.save.buildutils.code-quality-convention") + id("com.saveourtool.save.buildutils.code-quality-convention") id("de.benediktritter.maven-plugin-development") version "0.4.1" `maven-publish` } diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index ce4c6301fd..1ccb519981 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -3,11 +3,13 @@ import java.nio.file.Files plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") -// id("com.saveourtool.save.buildutils.code-quality-convention") + id("com.saveourtool.save.buildutils.code-quality-convention") id("com.google.devtools.ksp") version "1.8.10-1.0.9" idea } +project.description = "The main diktat ruleset" + dependencies { api(projects.diktatCommon) testImplementation(projects.diktatTestFramework) @@ -85,3 +87,4 @@ idea { generatedSourceDirs = generatedSourceDirs + file("build/generated/ksp/main/kotlin") + file("build/generated/ksp/test/kotlin") } } + diff --git a/diktat-rules/pom.xml b/diktat-rules/pom.xml deleted file mode 100644 index 9807c2d4cd..0000000000 --- a/diktat-rules/pom.xml +++ /dev/null @@ -1,153 +0,0 @@ - - - 4.0.0 - diktat-rules - diktat-rules - The main diktat ruleset - - - org.cqfn.diktat - diktat-parent - 1.2.4.3-SNAPSHOT - - - - - - - - com.squareup - kotlinpoet - true - - - org.cqfn.diktat - diktat-common - ${project.version} - - - org.cqfn.diktat - diktat-test-framework - ${project.version} - test - - - com.pinterest.ktlint - ktlint-core - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - - - - com.google.guava - guava - - - io.github.microutils - kotlin-logging-jvm - - - org.junit.jupiter - junit-jupiter - test - - - org.junit.platform - junit-platform-suite-engine - test - - - org.assertj - assertj-core - test - - - org.mockito - mockito-all - test - - - - com.bpodgursky - jbool_expressions - - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/test/kotlin - - - org.jetbrains.kotlin - kotlin-maven-plugin - - - build-generated-code - process-test-sources - - compile - - - - ${project.basedir}/src/main/kotlin/generated - - - - - compile - compile - - compile - - - - test-compile - process-test-sources - - test-compile - - - - - src/main/kotlin - src/test/kotlin - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/test/kotlin - - - - - - - - org.codehaus.mojo - exec-maven-plugin - - - generate-warnings - generate-test-sources - - java - - - - - org.cqfn.diktat.ruleset.generation.GenerationKt - - ${project.build.sourceDirectory} - ${project.basedir}/src/test/resources - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - - diff --git a/diktat-ruleset/build.gradle.kts b/diktat-ruleset/build.gradle.kts index 1d4fdfef4e..6eefdfdd79 100644 --- a/diktat-ruleset/build.gradle.kts +++ b/diktat-ruleset/build.gradle.kts @@ -1,8 +1,10 @@ plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") -// id("com.saveourtool.save.buildutils.code-quality-convention") + id("com.saveourtool.save.buildutils.code-quality-convention") } +project.description = "This module builds jar that can be used to run diktat using ktlint -R via command line" + dependencies { api(projects.diktatRules) { exclude("org.jetbrains.kotlin", "kotlin-stdlib-common") diff --git a/diktat-ruleset/pom.xml b/diktat-ruleset/pom.xml deleted file mode 100644 index af194b36cd..0000000000 --- a/diktat-ruleset/pom.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - 4.0.0 - diktat - This module builds jar that can be used to run diktat using ktlint -R via command line - - - org.cqfn.diktat - diktat-parent - 1.2.4.3-SNAPSHOT - ../pom.xml - - - - - org.cqfn.diktat - diktat-rules - ${project.version} - - - - org.jetbrains.kotlin - kotlin-stdlib-common - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - - - org.jetbrains.kotlin - kotlin-stdlib - - - org.jetbrains.kotlin - kotlin-compiler-embeddable - - - - - - org.cqfn.diktat - diktat-test-framework - ${project.version} - test - - - org.jetbrains.kotlin - kotlin-stdlib-common - test - - - org.jetbrains.kotlin - kotlin-stdlib-jdk7 - test - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - test - - - org.jetbrains.kotlin - kotlin-stdlib - test - - - org.jetbrains.kotlin - kotlin-compiler-embeddable - test - - - org.junit.jupiter - junit-jupiter - test - - - org.junit.platform - junit-platform-suite-engine - test - - - org.assertj - assertj-core - test - - - org.mockito - mockito-all - test - - - - - ${project.basedir}/src/test/kotlin - - - org.jetbrains.kotlin - kotlin-maven-plugin - - - test-compile - process-test-sources - - test-compile - - - - - src/main/kotlin - src/test/kotlin - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/test/kotlin - - - - - - - - maven-jar-plugin - - - default-jar - none - - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - jar-with-dependencies - - diktat-${project.version} - false - - - true - - - - - - make-assembly - package - - single - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/DiktatSaveSmokeTest.* - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - **/DiktatSaveSmokeTest.* - - - - - - integration-test - verify - - integration-test - - - - - - org.jacoco - jacoco-maven-plugin - - - - default-prepare-agent-integration - - prepare-agent-integration - - - - default-merge - post-integration-test - - merge - - - - - ${project.build.directory} - - jacoco.exec - jacoco-it.exec - - - - ${project.build.directory}/jacoco-merged.exec - - - - default-report-merged - - report-integration - - - ${project.reporting.outputDirectory}/jacoco - ${project.build.directory}/jacoco-merged.exec - - - - - - - diff --git a/diktat-test-framework/build.gradle.kts b/diktat-test-framework/build.gradle.kts index 8394a7222e..7f74b07e81 100644 --- a/diktat-test-framework/build.gradle.kts +++ b/diktat-test-framework/build.gradle.kts @@ -1,8 +1,10 @@ plugins { id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") -// id("com.saveourtool.save.buildutils.code-quality-convention") + id("com.saveourtool.save.buildutils.code-quality-convention") } +project.description = "Test framework for diktat" + dependencies { implementation(projects.diktatCommon) implementation(libs.kotlin.stdlib.jdk8) diff --git a/diktat-test-framework/pom.xml b/diktat-test-framework/pom.xml deleted file mode 100644 index 4ba068f3a2..0000000000 --- a/diktat-test-framework/pom.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - 4.0.0 - diktat-test-framework - diktat-test-framework - Test framework for diktat - - - org.cqfn.diktat - diktat-parent - 1.2.4.3-SNAPSHOT - - - - - org.cqfn.diktat - diktat-common - ${project.version} - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - - - commons-cli - commons-cli - - - commons-io - commons-io - - - io.github.microutils - kotlin-logging-jvm - - - io.github.petertrr - kotlin-multiplatform-diff-jvm - - - org.junit.jupiter - junit-jupiter - test - - - org.assertj - assertj-core - test - - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/test/kotlin - - - org.jetbrains.kotlin - kotlin-maven-plugin - - - compile - process-sources - - compile - - - - src/main/java - src/main/kotlin - src/main/resources - - - kotlinx-serialization - - - - - test-compile - process-test-sources - - test-compile - - - - src/test/java - src/test/kotlin - - - - - - - org.jetbrains.kotlin - kotlin-maven-serialization - ${kotlin.version} - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - compile - compile - - compile - - - - testCompile - test-compile - - testCompile - - - - - - - - diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0c3635cb1a..8e2f6804f0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -37,7 +37,7 @@ okio = "3.3.0" kotlinx-datetime = "0.4.0" kotlinx-coroutines = "1.6.4" assertj = "3.24.2" -diktat = "1.2.4.1" +diktat = "1.2.4.2" jgit = "6.5.0.202303070854-r" mockito = "5.2.0" mockito-kotlin = "4.1.0" @@ -106,6 +106,7 @@ ktlint-reporter-json = { module = "com.pinterest.ktlint:ktlint-reporter-json", v ktlint-reporter-html = { module = "com.pinterest.ktlint:ktlint-reporter-html", version.ref = "ktlint" } ktlint-reporter-baseline = { module = "com.pinterest.ktlint:ktlint-reporter-baseline", version.ref = "ktlint" } sarif4k = { module = "io.github.detekt.sarif4k:sarif4k", version.ref = "sarif4k" } +sarif4k-jvm = { module = "io.github.detekt.sarif4k:sarif4k-jvm", version.ref = "sarif4k" } # apache apache-commons-cli = { module = "commons-cli:commons-cli", version.ref = "commons-cli" } diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/PublishingConfiguration.kt b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/PublishingConfiguration.kt index 4cc9fe9877..bdff8b904b 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/PublishingConfiguration.kt +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/PublishingConfiguration.kt @@ -88,29 +88,31 @@ internal fun Project.configurePublications() { this.pom { name.set(project.name) description.set(project.description ?: project.name) - url.set("https://github.com/saveourtool/save-cloud") + url.set("https://www.cqfn.org/diKTat/") licenses { license { name.set("MIT License") url.set("http://www.opensource.org/licenses/mit-license.php") - distribution.set("repo") } } developers { - developer { - id.set("petertrr") - name.set("Petr Trifanov") - email.set("peter.trifanov@gmail.com") - } developer { id.set("akuleshov7") name.set("Andrey Kuleshov") email.set("andrewkuleshov7@gmail.com") + url.set("https://github.com/akuleshov7") + } + developer { + id.set("petertrr") + name.set("Peter Trifanov") + email.set("peter.trifanov@gmail.com") + url.set("https://github.com/petertrr") } } scm { - url.set("https://github.com/saveourtool/save-cloud") - connection.set("scm:git:git://github.com/saveourtool/save-cloud.git") + connection.set("scm:git:git://github.com/saveourtool/diktat.git") + developerConnection.set("scm:git:ssh://github.com:saveourtool/diktat.git") + url.set("http://github.com/saveourtool/diktat/tree/master") } } } diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/code-quality-convention.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/code-quality-convention.gradle.kts index 01560d4128..8b9e9af033 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/code-quality-convention.gradle.kts +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/code-quality-convention.gradle.kts @@ -3,7 +3,7 @@ package com.saveourtool.save.buildutils plugins { id("com.saveourtool.save.buildutils.detekt-convention-configuration") id("com.saveourtool.save.buildutils.diktat-convention-configuration") -// id("com.saveourtool.save.buildutils.spotless-convention-configuration") + id("com.saveourtool.save.buildutils.spotless-convention-configuration") } // FixMe: only registers the task, doesn't actually install them diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/detekt-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/detekt-convention-configuration.gradle.kts index 3e5235a2ee..9834704a22 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/detekt-convention-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/detekt-convention-configuration.gradle.kts @@ -8,7 +8,7 @@ plugins { } detekt { - config = rootProject.files("detekt.yml") + config = rootProject.files("detekt-config.yml") basePath = rootDir.canonicalPath buildUponDefaultConfig = true } diff --git a/pom.xml b/pom.xml deleted file mode 100644 index a2f32f6b56..0000000000 --- a/pom.xml +++ /dev/null @@ -1,622 +0,0 @@ - - - 4.0.0 - - org.cqfn.diktat - diktat-parent - 1.2.4.3-SNAPSHOT - pom - - diktat - diKTat kotlin formatter and fixer - https://www.cqfn.org/diKTat/ - - - - MIT License - http://www.opensource.org/licenses/mit-license.php - - - - - scm:git:git://github.com/saveourtool/diktat.git - scm:git:ssh://github.com:saveourtool/diktat.git - http://github.com/saveourtool/diktat/tree/master - - - - - Andrey Kuleshov - andrewkuleshov7@gmail.com - https://github.com/akuleshov7 - - - Peter Trifanov - peter.trifanov@mail.ru - https://github.com/petertrr - - - - - 1.8 - 1.8 - UTF-8 - 1.8.10 - true - official - 1.5.0 - 0.46.1 - 5.9.2 - 1.9.2 - 1.1.0 - 31.1-jre - 1.5.0 - 1.2.4.2 - 1.12.0 - 1.22.0 - 1.8.10 - 0.8.8 - 3.8.1 - 1.24 - - 2.1.23 - - - - diktat-common - diktat-rules - diktat-test-framework - diktat-ruleset - diktat-maven-plugin - diktat-gradle-plugin - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - - - - - com.squareup - kotlinpoet - ${kotlinpoet.version} - - - org.jetbrains.kotlin - kotlin-stdlib - ${kotlin.version} - - - org.jetbrains.kotlin - kotlin-stdlib-jdk7 - ${kotlin.version} - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - ${kotlin.version} - - - org.jetbrains.kotlin - kotlin-stdlib-common - ${kotlin.version} - - - org.jetbrains.kotlin - kotlin-compiler-embeddable - ${kotlin.version} - - - org.jetbrains.kotlinx - kotlinx-serialization-core - ${kotlinx.serialization.version} - - - org.jetbrains.kotlinx - kotlinx-serialization-core-jvm - ${kotlinx.serialization.version} - - - org.jetbrains.kotlinx - kotlinx-serialization-json - ${kotlinx.serialization.version} - - - org.jetbrains.kotlinx - kotlinx-serialization-json-jvm - ${kotlinx.serialization.version} - - - com.pinterest.ktlint - ktlint-core - ${ktlint.version} - - - ch.qos.logback - logback-classic - - - - - com.pinterest.ktlint - ktlint-reporter-plain - ${ktlint.version} - - - com.pinterest.ktlint - ktlint-reporter-sarif - ${ktlint.version} - - - com.pinterest.ktlint - ktlint-reporter-json - ${ktlint.version} - - - com.pinterest.ktlint - ktlint-reporter-html - ${ktlint.version} - - - com.pinterest.ktlint - ktlint-reporter-baseline - ${ktlint.version} - - - com.charleskorn.kaml - kaml-jvm - 0.47.0 - - - com.google.guava - guava - ${guava.version} - - - commons-cli - commons-cli - ${commons-cli.version} - - - commons-io - commons-io - 2.11.0 - - - commons-configuration - commons-configuration - 1.10 - - - io.github.microutils - kotlin-logging-jvm - ${mu-logging.version} - - - io.github.petertrr - kotlin-multiplatform-diff-jvm - 0.4.0 - - - org.junit.jupiter - junit-jupiter - ${junit.version} - - - org.junit.platform - junit-platform-suite-engine - ${junit.platform.version} - - - org.assertj - assertj-core - 3.24.2 - - - org.mockito - mockito-all - 1.10.19 - test - - - - com.bpodgursky - jbool_expressions - ${jbool.version} - - - - - - - - - - org.apache.maven.plugins - maven-clean-plugin - 3.2.0 - - - org.apache.maven.plugins - maven-compiler-plugin - 3.11.0 - - - org.apache.maven.plugins - maven-deploy-plugin - 3.1.0 - - - org.apache.maven.plugins - maven-jar-plugin - 3.3.0 - - - org.apache.maven.plugins - maven-assembly-plugin - 3.5.0 - - - - true - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0-M9 - - - me.fabriciorby - maven-surefire-junit5-tree-reporter - ${surefire.junit5.tree-reporter.version} - - - - - - true - true - true - true - - - plain - - true - - - - true - true - - false - - - - - org.apache.maven.plugins - maven-plugin-plugin - ${maven-plugin-tools.version} - - - org.apache.maven.plugins - maven-failsafe-plugin - 3.0.0-M9 - - - me.fabriciorby - maven-surefire-junit5-tree-reporter - ${surefire.junit5.tree-reporter.version} - - - - - - true - true - true - true - - - plain - - - false - - - - true - true - - false - - - - - org.codehaus.mojo - versions-maven-plugin - 2.15.0 - - false - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.3.0 - - - org.jetbrains.kotlin - kotlin-maven-plugin - ${kotlin.version} - - 1.8 - - src/main/kotlin - src/main/resources - - - -Werror - -opt-in=kotlin.RequiresOptIn - - - true - - - org.codehaus.mojo - exec-maven-plugin - 3.1.0 - - - org.cqfn.diktat - diktat-maven-plugin - ${diktat-check.version} - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/test/kotlin - - - ${project.basedir}/src/main/kotlin/generated - - diktat-analysis.yml - - - - org.jacoco - jacoco-maven-plugin - ${jacoco.version} - - - - - - org.codehaus.mojo - versions-maven-plugin - - - com.rudikershaw.gitbuildhook - git-build-hook-maven-plugin - 3.4.1 - - - - .git-hooks/pre-commit.sh - .git-hooks/commit-msg.sh - - - false - - - install-git-hooks - initialize - - - install - - - - - - - - - maven-dependency-plugin - 3.5.0 - - - detekt - none - - build-classpath - - - maven.compile.classpath - ${path.separator} - - - - - - com.github.ozsie - detekt-maven-plugin - ${detekt.version} - - - detekt - none - - check - - - detekt-config.yml - true - ${maven.compile.classpath} - 1.8 - **/resources/**/*.kt,**/resources/**/*.kts - - - - - - - org.cqfn.diktat - diktat-maven-plugin - - - diktat - none - - check - fix - - - - - - - org.jacoco - jacoco-maven-plugin - - - **/generation/** - - - - - - prepare-agent - - - - report - test - - report - - - - - - - - - - release - - - - org.codehaus.mojo - build-helper-maven-plugin - - - - generate-sources - - add-source - - - - src/main/kotlin - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.1 - - - attach-sources - - jar - - - - - - org.jetbrains.dokka - dokka-maven-plugin - ${dokka.version} - - - package - - javadocJar - - - - - - ${project.basedir}/src/main/kotlin - - - - org.jetbrains.dokka - kotlin-as-java-plugin - ${dokka.version} - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 3.0.1 - - - sign-artifacts - verify - - sign - - - - - - - --pinentry-mode - loopback - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.8 - true - - ossrh - https://oss.sonatype.org/ - true - - - - - - - jdk11 - - [11, - - - 8 - - - - From a80649fd22fa0be061fd1577994e2d5c899a4315 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 10:58:06 +0300 Subject: [PATCH 17/50] fixed review notes --- build.gradle.kts | 8 --- diktat-gradle-plugin/build.gradle.kts | 7 +-- diktat-maven-plugin/build.gradle.kts | 2 +- .../ruleset/smoke/DiktatSmokeTestBase.kt | 2 +- .../{build.gradle_.kts => build.gradle.kts_} | 0 gradle/libs.versions.toml | 61 ++----------------- gradle/plugins/build.gradle.kts | 4 +- .../save/buildutils/JacocoConfiguration.kt | 7 ++- .../buildutils/VersioningConfiguration.kt | 4 +- ...otless-convention-configuration.gradle.kts | 5 +- 10 files changed, 25 insertions(+), 75 deletions(-) rename diktat-ruleset/src/test/resources/test/smoke/{build.gradle_.kts => build.gradle.kts_} (100%) diff --git a/build.gradle.kts b/build.gradle.kts index d9df4ccfd1..1ff074881c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,12 +20,4 @@ talaiot { } } -allprojects { - configurations.all { - // if SNAPSHOT dependencies are used, refresh them periodically - resolutionStrategy.cacheDynamicVersionsFor(10, TimeUnit.MINUTES) - resolutionStrategy.cacheChangingModulesFor(10, TimeUnit.MINUTES) - } -} - project.description = "diKTat kotlin formatter and fixer" diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index fa537044c7..5f6e5079c3 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -3,8 +3,8 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurr plugins { `java-gradle-plugin` - kotlin("jvm") - jacoco + id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") + id("com.saveourtool.save.buildutils.code-quality-convention") id("pl.droidsonroids.jacoco.testkit") version "1.0.9" id("org.gradle.test-retry") version "1.5.2" } @@ -83,11 +83,10 @@ val functionalTestTask by tasks.register("functionalTest") tasks.withType { useJUnitPlatform() } -jacoco.toolVersion = libs.versions.jacoco.get() // === integration testing // fixme: should probably use KotlinSourceSet instead -val functionalTest = sourceSets.create("functionalTest") { +val functionalTest: SourceSet = sourceSets.create("functionalTest") { compileClasspath += sourceSets.main.get().output + configurations.testRuntimeClasspath.get() runtimeClasspath += output + compileClasspath } diff --git a/diktat-maven-plugin/build.gradle.kts b/diktat-maven-plugin/build.gradle.kts index cc12f9e55d..bc89ea641f 100644 --- a/diktat-maven-plugin/build.gradle.kts +++ b/diktat-maven-plugin/build.gradle.kts @@ -40,7 +40,7 @@ tasks.withType { } mavenPlugin { -// goalPrefix.set("diktat") + goalPrefix.set("diktat") } publishing { diff --git a/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSmokeTestBase.kt b/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSmokeTestBase.kt index cf31ebe8cd..785b50ccff 100644 --- a/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSmokeTestBase.kt +++ b/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSmokeTestBase.kt @@ -383,7 +383,7 @@ abstract class DiktatSmokeTestBase { @Suppress("AVOID_NULL_CHECKS") internal fun createTmpFiles() { listOf( - "$RESOURCE_FILE_PATH/../../../build.gradle_.kts" to "build.gradle.kts", + "$RESOURCE_FILE_PATH/../../../build.gradle.kts_" to "build.gradle.kts", "$RESOURCE_FILE_PATH/Example1Test.kt" to "Example1-2Test.kt", ) .map { (resource, targetFileName) -> diff --git a/diktat-ruleset/src/test/resources/test/smoke/build.gradle_.kts b/diktat-ruleset/src/test/resources/test/smoke/build.gradle.kts_ similarity index 100% rename from diktat-ruleset/src/test/resources/test/smoke/build.gradle_.kts rename to diktat-ruleset/src/test/resources/test/smoke/build.gradle.kts_ diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8e2f6804f0..e1a86938b3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,7 +24,7 @@ mu-logging = "2.1.23" kaml = "0.47.0" kotlin-multiplatform-diff = "0.4.0" sarif4k = "0.3.0" -jupiter-itf-extension = "0.11.0" +jupiter-itf-extension = "0.12.0" # FIXME: need to migrate to mockito mockito-all = "1.10.19" @@ -91,7 +91,9 @@ kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = # kotlinx serialization +kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialization" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" } +kotlinx-serialization-json-jvm = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-jvm", version.ref = "serialization" } # another serialization kaml = { module = "com.charleskorn.kaml:kaml", version.ref = "kaml" } @@ -141,67 +143,16 @@ plexus-cipher = { module = "org.codehaus.plexus:plexus-cipher", version.ref = "p ######### copied from save-cloud kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotlin-plugin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" } -kotlin-plugin-allopen = { module = "org.jetbrains.kotlin:kotlin-allopen", version.ref = "kotlin" } -kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialization" } -kotlinx-serialization-json-jvm = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-jvm", version.ref = "serialization" } -kotlinx-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "serialization" } -kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" } -kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-reactor = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactor", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-core-linuxx64 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core-linuxx64", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } + jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "jetbrains-annotations" } -ktoml-core = { module = "com.akuleshov7:ktoml-core", version.ref = "ktoml" } -ktoml-file = { module = "com.akuleshov7:ktoml-file", version.ref = "ktoml" } - -ktor-client-apache = { module = "io.ktor:ktor-client-apache", version.ref = "ktor" } -ktor-client-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" } -ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } -ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" } -ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" } -ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" } -ktor-client-serialization = { module = "io.ktor:ktor-client-serialization", version.ref = "ktor" } -ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" } -ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" } -ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" } -ktor-http = { module = "io.ktor:ktor-http", version.ref = "ktor" } - -ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" } -ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" } -ktor-server-cio = { module = "io.ktor:ktor-server-cio", version.ref = "ktor" } -ktor-server-content-negotiation = { module = "io.ktor:ktor-server-content-negotiation", version.ref = "ktor" } # java core libraries validation-api = { module = "jakarta.validation:jakarta.validation-api"} annotation-api = { module = "jakarta.annotation:jakarta.annotation-api"} -# testing -testcontainers = { module = "org.testcontainers:testcontainers", version.ref = "testcontainers" } -testcontainers-mysql = { module = "org.testcontainers:mysql", version.ref = "testcontainers" } -testcontainers-junit-jupiter = { module = "org.testcontainers:junit-jupiter", version.ref = "testcontainers" } -okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp3" } -okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp3" } -mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "mockito-kotlin" } -mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" } -kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } -kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version = "5.5.5" } - -okio = { module = "com.squareup.okio:okio", version.ref = "okio" } -slf4j-api = { module = "org.slf4j:slf4j-api" } -log4j = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" } -log4j-slf4j-impl = { module = "org.apache.logging.log4j:log4j-slf4j-impl", version.ref = "log4j" } -logback-core = { module = "ch.qos.logback:logback-core" } - -junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" } - +# code quality diktat-gradle-plugin = { module = "org.cqfn.diktat:diktat-gradle-plugin", version.ref = "diktat" } detekt-gradle-plugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" } -reckon-gradle-plugin = { module = "org.ajoberstar.reckon:reckon-gradle", version.ref = "reckon" } -commons-compress = { module = "org.apache.commons:commons-compress", version.ref = "commons-compress" } - -kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli", version.ref = "kotlinx-cli" } - gradle-plugin-spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" } - -arrow-kt-core = { module = "io.arrow-kt:arrow-core", version.ref = "arrow-kt"} +reckon-gradle-plugin = { module = "org.ajoberstar.reckon:reckon-gradle", version.ref = "reckon" } diff --git a/gradle/plugins/build.gradle.kts b/gradle/plugins/build.gradle.kts index 91b1c86957..2d9ac0c176 100644 --- a/gradle/plugins/build.gradle.kts +++ b/gradle/plugins/build.gradle.kts @@ -13,8 +13,6 @@ dependencies { // workaround https://github.com/gradle/gradle/issues/15383 implementation(files(project.libs.javaClass.superclass.protectionDomain.codeSource.location)) implementation(libs.kotlin.gradle.plugin) - implementation(libs.kotlin.plugin.allopen) - implementation(libs.download.plugin) implementation(libs.reckon.gradle.plugin) implementation(libs.detekt.gradle.plugin) { exclude("io.github.detekt.sarif4k", "sarif4k") @@ -22,10 +20,10 @@ dependencies { implementation(libs.diktat.gradle.plugin) { exclude("io.github.detekt.sarif4k", "sarif4k") } + implementation(libs.sarif4k) implementation(libs.gradle.plugin.spotless) implementation(libs.publish.gradle.plugin) // extra dependencies - implementation(libs.okio) implementation(libs.kotlin.stdlib) implementation(libs.kotlin.stdlib.common) implementation(libs.kotlin.stdlib.jdk7) diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/JacocoConfiguration.kt b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/JacocoConfiguration.kt index da96417936..194c48d7f6 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/JacocoConfiguration.kt +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/JacocoConfiguration.kt @@ -4,11 +4,13 @@ package com.saveourtool.save.buildutils +import org.gradle.accessors.dm.LibrariesForLibs import org.gradle.api.Project import org.gradle.api.tasks.testing.Test import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.named +import org.gradle.kotlin.dsl.the import org.gradle.testing.jacoco.plugins.JacocoPlugin import org.gradle.testing.jacoco.plugins.JacocoPluginExtension import org.gradle.testing.jacoco.tasks.JacocoReport @@ -20,7 +22,10 @@ fun Project.configureJacoco() { apply() configure { - toolVersion = "0.8.7" + toolVersion = the() + .versions + .jacoco + .get() } tasks.named("test") { diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/VersioningConfiguration.kt b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/VersioningConfiguration.kt index 8f258452be..f37ecb5e36 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/VersioningConfiguration.kt +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/VersioningConfiguration.kt @@ -9,7 +9,9 @@ import org.ajoberstar.grgit.gradle.GrgitServicePlugin import org.ajoberstar.reckon.gradle.ReckonExtension import org.ajoberstar.reckon.gradle.ReckonPlugin import org.gradle.api.Project -import org.gradle.kotlin.dsl.* +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.getByType /** * Configures reckon plugin for [this] project, should be applied for root project only diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/spotless-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/spotless-convention-configuration.gradle.kts index 21fd6d3fe7..dac1203af5 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/spotless-convention-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/spotless-convention-configuration.gradle.kts @@ -30,7 +30,10 @@ spotless { ) } else { target("**/*.kts") - targetExclude("build/**/*.kts") + targetExclude( + "build/**/*.kts", + "src/test/**/*.kts", + ) } } } From 269e10d0586470758141765a7a3e981a9754f253 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 10:58:33 +0300 Subject: [PATCH 18/50] upgraded itf version --- .../diktat/plugin/maven/DiktatMavenPluginIntegrationTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 927ded578b..95d8e6f5d1 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 @@ -57,7 +57,7 @@ class DiktatMavenPluginIntegrationTest { assertThat(mavenLog).contains("[FILE_NAME_MATCH_CLASS]") val method = testInfo.testMethod.get() - File(result.mavenProjectResult.targetProjectDirectory, "target/jacoco-it.exec").copyTo( + File(result.mavenProjectResult.targetProjectDirectory.toFile(), "target/jacoco-it.exec").copyTo( File("target/jacoco-it-${method.name}.exec") ) } @@ -82,7 +82,7 @@ class DiktatMavenPluginIntegrationTest { } val method = testInfo.testMethod.get() - File(result.mavenProjectResult.targetProjectDirectory, "target/jacoco-it.exec").copyTo( + File(result.mavenProjectResult.targetProjectDirectory.toFile(), "target/jacoco-it.exec").copyTo( File("target/jacoco-it-${method.name}.exec") ) } From c95cc12577c8a9466fa72b6b1c8d98558209c58e Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 10:59:45 +0300 Subject: [PATCH 19/50] formatting --- .../ruleset/generation/EnumNamesSymbolProcessor.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt index c55c6ce322..180338eb06 100644 --- a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt +++ b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt @@ -57,15 +57,15 @@ class EnumNamesSymbolProcessor( } companion object { - /** * The comment that will be added to the generated sources file. */ - private val autoGenerationComment = """ - |/** - | * This document was auto generated, please don't modify it. - | * This document contains all enum properties from Warnings.kt as Strings. - | */ - """.trimMargin() + private val autoGenerationComment = + """ + |/** + | * This document was auto generated, please don't modify it. + | * This document contains all enum properties from Warnings.kt as Strings. + | */ + """.trimMargin() } } From e2e2ba0f24e8729cd6e76252f7e917ca0a84d9d3 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 11:10:52 +0300 Subject: [PATCH 20/50] fixed package name for gradle/plugins --- build.gradle.kts | 8 +++----- diktat-common/build.gradle.kts | 4 ++-- diktat-gradle-plugin/build.gradle.kts | 6 +++--- diktat-maven-plugin/build.gradle.kts | 6 +++--- diktat-rules/build.gradle.kts | 9 ++++----- .../org/cqfn/diktat/ruleset/generation/Generation.kt | 1 - diktat-ruleset/build.gradle.kts | 4 ++-- diktat-test-framework/build.gradle.kts | 4 ++-- .../save/buildutils/code-quality-convention.gradle.kts | 10 ---------- .../buildutils/versioning-configuration.gradle.kts | 3 --- .../cqfn/diktat}/buildutils/GitHookInstallation.kt | 2 +- .../cqfn/diktat}/buildutils/JacocoConfiguration.kt | 2 +- .../cqfn/diktat}/buildutils/PublishingConfiguration.kt | 6 +++--- .../cqfn/diktat}/buildutils/VersioningConfiguration.kt | 3 +-- .../buildutils/code-quality-convention.gradle.kts | 10 ++++++++++ .../detekt-convention-configuration.gradle.kts | 2 +- .../diktat-convention-configuration.gradle.kts | 2 +- .../buildutils/kotlin-jvm-configuration.gradle.kts | 2 +- .../buildutils/publishing-configuration.gradle.kts | 2 +- .../spotless-convention-configuration.gradle.kts | 2 +- .../buildutils/versioning-configuration.gradle.kts | 3 +++ 21 files changed, 43 insertions(+), 48 deletions(-) delete mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/code-quality-convention.gradle.kts delete mode 100644 gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/versioning-configuration.gradle.kts rename gradle/plugins/src/main/kotlin/{com/saveourtool/save => org/cqfn/diktat}/buildutils/GitHookInstallation.kt (94%) rename gradle/plugins/src/main/kotlin/{com/saveourtool/save => org/cqfn/diktat}/buildutils/JacocoConfiguration.kt (96%) rename gradle/plugins/src/main/kotlin/{com/saveourtool/save => org/cqfn/diktat}/buildutils/PublishingConfiguration.kt (97%) rename gradle/plugins/src/main/kotlin/{com/saveourtool/save => org/cqfn/diktat}/buildutils/VersioningConfiguration.kt (97%) create mode 100644 gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts rename gradle/plugins/src/main/kotlin/{com/saveourtool/save => org/cqfn/diktat}/buildutils/detekt-convention-configuration.gradle.kts (96%) rename gradle/plugins/src/main/kotlin/{com/saveourtool/save => org/cqfn/diktat}/buildutils/diktat-convention-configuration.gradle.kts (95%) rename gradle/plugins/src/main/kotlin/{com/saveourtool/save => org/cqfn/diktat}/buildutils/kotlin-jvm-configuration.gradle.kts (92%) rename gradle/plugins/src/main/kotlin/{com/saveourtool/save => org/cqfn/diktat}/buildutils/publishing-configuration.gradle.kts (95%) rename gradle/plugins/src/main/kotlin/{com/saveourtool/save => org/cqfn/diktat}/buildutils/spotless-convention-configuration.gradle.kts (96%) create mode 100644 gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/versioning-configuration.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts index 1ff074881c..d83c17de68 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,8 @@ -import com.saveourtool.save.buildutils.* - @Suppress("DSL_SCOPE_VIOLATION", "RUN_IN_SCRIPT") // https://github.com/gradle/gradle/issues/22797 plugins { - id("com.saveourtool.save.buildutils.versioning-configuration") - id("com.saveourtool.save.buildutils.code-quality-convention") - id("com.saveourtool.save.buildutils.publishing-configuration") + id("org.cqfn.diktat.buildutils.versioning-configuration") + id("org.cqfn.diktat.buildutils.code-quality-convention") + id("org.cqfn.diktat.buildutils.publishing-configuration") alias(libs.plugins.talaiot.base) java } diff --git a/diktat-common/build.gradle.kts b/diktat-common/build.gradle.kts index ed0ed942c9..486b4371a9 100644 --- a/diktat-common/build.gradle.kts +++ b/diktat-common/build.gradle.kts @@ -1,7 +1,7 @@ @Suppress("DSL_SCOPE_VIOLATION", "RUN_IN_SCRIPT") // https://github.com/gradle/gradle/issues/22797 plugins { - id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") - id("com.saveourtool.save.buildutils.code-quality-convention") + id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") + id("org.cqfn.diktat.buildutils.code-quality-convention") alias(libs.plugins.kotlin.plugin.serialization) } diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index 5f6e5079c3..6b3efef39c 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -1,10 +1,10 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { `java-gradle-plugin` - id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") - id("com.saveourtool.save.buildutils.code-quality-convention") + id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") + id("org.cqfn.diktat.buildutils.code-quality-convention") id("pl.droidsonroids.jacoco.testkit") version "1.0.9" id("org.gradle.test-retry") version "1.5.2" } diff --git a/diktat-maven-plugin/build.gradle.kts b/diktat-maven-plugin/build.gradle.kts index bc89ea641f..dedb953e63 100644 --- a/diktat-maven-plugin/build.gradle.kts +++ b/diktat-maven-plugin/build.gradle.kts @@ -1,9 +1,9 @@ -import de.benediktritter.maven.plugin.development.task.GenerateMavenPluginDescriptorTask import de.benediktritter.maven.plugin.development.task.GenerateHelpMojoSourcesTask +import de.benediktritter.maven.plugin.development.task.GenerateMavenPluginDescriptorTask plugins { - id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") - id("com.saveourtool.save.buildutils.code-quality-convention") + id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") + id("org.cqfn.diktat.buildutils.code-quality-convention") id("de.benediktritter.maven-plugin-development") version "0.4.1" `maven-publish` } diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index 1ccb519981..8b093c4b6a 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -1,9 +1,9 @@ -import java.time.LocalDate import java.nio.file.Files +import java.time.LocalDate plugins { - id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") - id("com.saveourtool.save.buildutils.code-quality-convention") + id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") + id("org.cqfn.diktat.buildutils.code-quality-convention") id("com.google.devtools.ksp") version "1.8.10-1.0.9" idea } @@ -82,9 +82,8 @@ tasks.named("compileTestKotlin") { idea { module { // Not using += due to https://github.com/gradle/gradle/issues/8749 - sourceDirs = sourceDirs + file("build/generated/ksp/main/kotlin") // or tasks["kspKotlin"].destination + sourceDirs = sourceDirs + file("build/generated/ksp/main/kotlin") // or tasks["kspKotlin"].destination testSourceDirs = testSourceDirs + file("build/generated/ksp/test/kotlin") generatedSourceDirs = generatedSourceDirs + file("build/generated/ksp/main/kotlin") + file("build/generated/ksp/test/kotlin") } } - diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt index 30e49be9b2..9429f21843 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt @@ -8,7 +8,6 @@ import org.cqfn.diktat.ruleset.rules.chapter2.comments.HeaderCommentRule.Compani import org.cqfn.diktat.ruleset.rules.chapter2.comments.HeaderCommentRule.Companion.curYear import org.cqfn.diktat.ruleset.rules.chapter2.comments.HeaderCommentRule.Companion.hyphenRegex - import java.nio.file.Files import java.nio.file.Paths diff --git a/diktat-ruleset/build.gradle.kts b/diktat-ruleset/build.gradle.kts index 6eefdfdd79..99c05148e6 100644 --- a/diktat-ruleset/build.gradle.kts +++ b/diktat-ruleset/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") - id("com.saveourtool.save.buildutils.code-quality-convention") + id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") + id("org.cqfn.diktat.buildutils.code-quality-convention") } project.description = "This module builds jar that can be used to run diktat using ktlint -R via command line" diff --git a/diktat-test-framework/build.gradle.kts b/diktat-test-framework/build.gradle.kts index 7f74b07e81..4101209074 100644 --- a/diktat-test-framework/build.gradle.kts +++ b/diktat-test-framework/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - id("com.saveourtool.save.buildutils.kotlin-jvm-configuration") - id("com.saveourtool.save.buildutils.code-quality-convention") + id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") + id("org.cqfn.diktat.buildutils.code-quality-convention") } project.description = "Test framework for diktat" diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/code-quality-convention.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/code-quality-convention.gradle.kts deleted file mode 100644 index 8b9e9af033..0000000000 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/code-quality-convention.gradle.kts +++ /dev/null @@ -1,10 +0,0 @@ -package com.saveourtool.save.buildutils - -plugins { - id("com.saveourtool.save.buildutils.detekt-convention-configuration") - id("com.saveourtool.save.buildutils.diktat-convention-configuration") - id("com.saveourtool.save.buildutils.spotless-convention-configuration") -} - -// FixMe: only registers the task, doesn't actually install them -installGitHooks() diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/versioning-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/versioning-configuration.gradle.kts deleted file mode 100644 index bea93a575e..0000000000 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/versioning-configuration.gradle.kts +++ /dev/null @@ -1,3 +0,0 @@ -package com.saveourtool.save.buildutils - -configureVersioning() diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/GitHookInstallation.kt b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/GitHookInstallation.kt similarity index 94% rename from gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/GitHookInstallation.kt rename to gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/GitHookInstallation.kt index 2183db4c90..08ed721a55 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/GitHookInstallation.kt +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/GitHookInstallation.kt @@ -2,7 +2,7 @@ * Gradle tasks to install git hooks as a part of the build */ -package com.saveourtool.save.buildutils +package org.cqfn.diktat.buildutils import org.gradle.api.Project import org.gradle.api.tasks.Copy diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/JacocoConfiguration.kt b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/JacocoConfiguration.kt similarity index 96% rename from gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/JacocoConfiguration.kt rename to gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/JacocoConfiguration.kt index 194c48d7f6..aac1062534 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/JacocoConfiguration.kt +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/JacocoConfiguration.kt @@ -2,7 +2,7 @@ * Configuration for code coverage calculation via Jacoco */ -package com.saveourtool.save.buildutils +package org.cqfn.diktat.buildutils import org.gradle.accessors.dm.LibrariesForLibs import org.gradle.api.Project diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/PublishingConfiguration.kt b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/PublishingConfiguration.kt similarity index 97% rename from gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/PublishingConfiguration.kt rename to gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/PublishingConfiguration.kt index bdff8b904b..9577cc28c2 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/PublishingConfiguration.kt +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/PublishingConfiguration.kt @@ -7,7 +7,7 @@ "MISSING_KDOC_ON_FUNCTION", ) -package com.saveourtool.save.buildutils +package org.cqfn.diktat.buildutils import io.github.gradlenexus.publishplugin.NexusPublishExtension import org.gradle.api.Named @@ -155,7 +155,7 @@ private fun Project.configureSigningCommon(useKeys: SigningExtension.() -> Unit } private fun Project.styledOut(logCategory: String): StyledTextOutput = - serviceOf().create(logCategory) + serviceOf().create(logCategory) /** * Determines if this project has all the given properties. @@ -165,4 +165,4 @@ private fun Project.styledOut(logCategory: String): StyledTextOutput = * @see Project.hasProperty */ private fun Project.hasProperties(vararg propertyNames: String): Boolean = - propertyNames.asSequence().all(this::hasProperty) + propertyNames.asSequence().all(this::hasProperty) diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/VersioningConfiguration.kt b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt similarity index 97% rename from gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/VersioningConfiguration.kt rename to gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt index f37ecb5e36..3c36d77744 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/VersioningConfiguration.kt +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt @@ -2,7 +2,7 @@ * Configuration for project versioning */ -package com.saveourtool.save.buildutils +package org.cqfn.diktat.buildutils import org.ajoberstar.grgit.gradle.GrgitServiceExtension import org.ajoberstar.grgit.gradle.GrgitServicePlugin @@ -45,4 +45,3 @@ fun Project.configureVersioning() { * @return true if this string denotes a snapshot version */ internal fun String.isSnapshot() = endsWith("SNAPSHOT") - diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts new file mode 100644 index 0000000000..857927582c --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts @@ -0,0 +1,10 @@ +package org.cqfn.diktat.buildutils + +plugins { + id("org.cqfn.diktat.buildutils.detekt-convention-configuration") + id("org.cqfn.diktat.buildutils.diktat-convention-configuration") + id("org.cqfn.diktat.buildutils.spotless-convention-configuration") +} + +// FixMe: only registers the task, doesn't actually install them +installGitHooks() diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/detekt-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/detekt-convention-configuration.gradle.kts similarity index 96% rename from gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/detekt-convention-configuration.gradle.kts rename to gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/detekt-convention-configuration.gradle.kts index 9834704a22..a63ca336e7 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/detekt-convention-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/detekt-convention-configuration.gradle.kts @@ -1,4 +1,4 @@ -package com.saveourtool.save.buildutils +package org.cqfn.diktat.buildutils import io.gitlab.arturbosch.detekt.Detekt import io.gitlab.arturbosch.detekt.report.ReportMergeTask diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/diktat-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-convention-configuration.gradle.kts similarity index 95% rename from gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/diktat-convention-configuration.gradle.kts rename to gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-convention-configuration.gradle.kts index eff795d654..74cd9f2947 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/diktat-convention-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-convention-configuration.gradle.kts @@ -1,4 +1,4 @@ -package com.saveourtool.save.buildutils +package org.cqfn.diktat.buildutils import Versions import org.cqfn.diktat.plugin.gradle.DiktatJavaExecTaskBase diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/kotlin-jvm-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts similarity index 92% rename from gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/kotlin-jvm-configuration.gradle.kts rename to gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts index c2396090ca..7faa369100 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/kotlin-jvm-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts @@ -1,4 +1,4 @@ -package com.saveourtool.save.buildutils +package org.cqfn.diktat.buildutils import org.gradle.api.tasks.testing.Test import org.gradle.kotlin.dsl.* diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/publishing-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/publishing-configuration.gradle.kts similarity index 95% rename from gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/publishing-configuration.gradle.kts rename to gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/publishing-configuration.gradle.kts index 2087d11f47..50ca4ce47c 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/publishing-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/publishing-configuration.gradle.kts @@ -1,4 +1,4 @@ -package com.saveourtool.save.buildutils +package org.cqfn.diktat.buildutils import io.github.gradlenexus.publishplugin.NexusPublishPlugin import org.gradle.kotlin.dsl.apply diff --git a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/spotless-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts similarity index 96% rename from gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/spotless-convention-configuration.gradle.kts rename to gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts index dac1203af5..caf598f147 100644 --- a/gradle/plugins/src/main/kotlin/com/saveourtool/save/buildutils/spotless-convention-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts @@ -1,4 +1,4 @@ -package com.saveourtool.save.buildutils +package org.cqfn.diktat.buildutils import org.gradle.accessors.dm.LibrariesForLibs diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/versioning-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/versioning-configuration.gradle.kts new file mode 100644 index 0000000000..0fa18c6248 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/versioning-configuration.gradle.kts @@ -0,0 +1,3 @@ +package org.cqfn.diktat.buildutils + +configureVersioning() From deecffac8f6434a1560673529773eea939401c0b Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 12:32:58 +0300 Subject: [PATCH 21/50] fixed github action --- .editorconfig | 3 + .github/workflows/build_and_test.yml | 115 +++++++++++++++------------ 2 files changed, 68 insertions(+), 50 deletions(-) diff --git a/.editorconfig b/.editorconfig index a54359c8a0..5f30b45a1d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,6 +14,9 @@ ij_smart_tabs = false ij_visual_guides = 80,120,180 ij_wrap_on_typing = false +[{*.yaml,*.yml}] +indent_size = 2 + [{*.kt,*.kts}] ij_kotlin_align_in_columns_case_branch = false ij_kotlin_align_multiline_binary_operation = false diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 44e38ee001..165d1b5947 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -7,8 +7,12 @@ on: branches: - 'master' -env: - GRADLE_OPTS: -Dorg.gradle.daemon=false +concurrency: + # https://docs.github.com/en/actions/using-jobs/using-concurrency + # The latest queued workflow is preferred; the ones already in progress get cancelled + # Workflows on master branch shouldn't be cancelled, that's why they are identified by commit SHA + group: ${{ github.ref == 'refs/heads/master' && format('{0}-{1}', github.workflow, github.sha) || format('{0}-{1}', github.workflow, github.ref) }} + cancel-in-progress: true jobs: build_and_test_with_code_coverage: @@ -17,27 +21,36 @@ jobs: steps: - uses: actions/checkout@v3 + with: + # required for correct codecov upload + fetch-depth: 0 - name: Set up JDK 11 uses: actions/setup-java@v3 with: - distribution: zulu java-version: 11 - - name: Cache local Gradle repository + distribution: temurin + - name: Retrieve Kotlin version + run: | + kv=$(cat gradle/libs.versions.toml | grep '^kotlin =' | awk -F'[=]' '{print $2}' | tr -d '" ') + echo KOTLIN_VERSION=$kv >> $GITHUB_ENV + - name: Cache konan uses: actions/cache@v3 with: - path: | - ~/.gradle/caches/ - ~/.gradle/wrapper/ - key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*') }} - restore-keys: ${{ runner.os }}-gradle-build- - - name: Gradle Build - run: gradlew build - - name: Code coverage report - uses: codecov/codecov-action@v3 + path: ~/.konan + key: ${{ runner.os }}-gradle-konan-${{ env.KOTLIN_VERSION }} + - name: Build all + uses: gradle/gradle-build-action@v2 with: - files: '**/target/site/jacoco*/jacoco.xml,**/reports/jacoco/**/*.xml' - flags: unittests - fail_ci_if_error: true # optional (default = false) + gradle-version: wrapper + gradle-home-cache-cleanup: true + + - name: Upload gradle reports + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: gradle-reports + path: '**/build/reports/' + retention-days: 1 - name: Upload diktat jar uses: actions/upload-artifact@v3 with: @@ -45,13 +58,10 @@ jobs: path: diktat-ruleset/target/diktat-*.jar # no need to store artifact longer, it is used only by dependant jobs retention-days: 1 - - name: Upload gradle reports - if: ${{ failure() }} - uses: actions/upload-artifact@v3 + - name: Code coverage report + uses: codecov/codecov-action@v3 with: - name: gradle-test-report-${{ runner.os }} - path: '**/build/reports/' - retention-days: 1 + fail_ci_if_error: false run_diktat_from_CLI: name: Run diktat via CLI @@ -64,10 +74,11 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Setup environment variables + + - name: Retrieve Ktlint version run: | - cat pom.xml | grep ".*" | head -1 | awk -F'[><]' '{ printf "DIKTAT_VERSION=%s\n",$3 }' >> $GITHUB_ENV - cat pom.xml | grep ".*" | head -1 | awk -F'[><]' '{ printf "KTLINT_VERSION=%s\n",$3 }' >> $GITHUB_ENV + ktlint_version=$(cat gradle/libs.versions.toml | grep '^ktlint =' | awk -F'[=]' '{print $2}' | tr -d '" ') + echo KTLINT_VERSION=$ktlint_version >> $GITHUB_ENV shell: bash - name: Setup environment @@ -81,10 +92,16 @@ jobs: with: name: diktat-ruleset + - name: Retrieve diktat jar file name + run: | + filename=$(ls diktat-*.jar) + echo DIKTAT_JAR=$filename >> $GITHUB_ENV + shell: bash + - name: Run diKTat from cli continue-on-error: true run: | - java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard 'examples/maven/src/main/kotlin/Test.kt' &>out.txt + java -jar ktlint -R ${{ env.DIKTAT_JAR }} --disabled_rules=standard 'examples/maven/src/main/kotlin/Test.kt' &>out.txt shell: bash - name: Check output @@ -98,14 +115,14 @@ jobs: continue-on-error: true if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} run: | - java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard "$PWD/examples/maven/src/main/kotlin/Test.kt" &>out.txt + java -jar ktlint -R ${{ env.DIKTAT_JAR }} --disabled_rules=standard "$PWD/examples/maven/src/main/kotlin/Test.kt" &>out.txt shell: bash - name: Run diKTat from cli on windows (absolute paths) continue-on-error: true if: runner.os == 'Windows' run: | - java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard "%cd%/examples/maven/src/main/kotlin/Test.kt" > out.txt 2>&1 + java -jar ktlint -R ${{ env.DIKTAT_JAR }} --disabled_rules=standard "%cd%/examples/maven/src/main/kotlin/Test.kt" > out.txt 2>&1 shell: cmd - name: Check output (absolute paths) @@ -118,7 +135,7 @@ jobs: - name: Run diKTat from cli (glob paths, 1 of 4) continue-on-error: true run: | - java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard 'examples/maven/src/main/kotlin/*.kt' &>out.txt + java -jar ktlint -R ${{ env.DIKTAT_JAR }} --disabled_rules=standard 'examples/maven/src/main/kotlin/*.kt' &>out.txt shell: bash - name: Check output (glob paths, 1 of 4) @@ -131,7 +148,7 @@ jobs: - name: Run diKTat from cli (glob paths, 2 of 4) continue-on-error: true run: | - java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard 'examples/**/main/kotlin/*.kt' &>out.txt + java -jar ktlint -R ${{ env.DIKTAT_JAR }} --disabled_rules=standard 'examples/**/main/kotlin/*.kt' &>out.txt shell: bash - name: Check output (glob paths, 2 of 4) @@ -144,7 +161,7 @@ jobs: - name: Run diKTat from cli (glob paths, 3 of 4) continue-on-error: true run: | - java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard 'examples/**/*.kt' &>out.txt + java -jar ktlint -R ${{ env.DIKTAT_JAR }} --disabled_rules=standard 'examples/**/*.kt' &>out.txt shell: bash - name: Check output (glob paths, 3 of 4) @@ -157,7 +174,7 @@ jobs: - name: Run diKTat from cli (glob paths, 4 of 4) continue-on-error: true run: | - java -jar ktlint -R diktat-${{ env.DIKTAT_VERSION }}.jar --disabled_rules=standard '**/*.kt' &>out.txt + java -jar ktlint -R ${{ env.DIKTAT_JAR }} --disabled_rules=standard '**/*.kt' &>out.txt shell: bash - name: Check output (glob paths, 4 of 4) @@ -186,31 +203,29 @@ jobs: steps: - uses: actions/checkout@v3 + with: + # required for correct codecov upload + fetch-depth: 0 - name: Set up JDK 11 uses: actions/setup-java@v3 with: - distribution: zulu java-version: 11 - - name: Cache local Gradle repository + distribution: temurin + - name: Retrieve Kotlin version + run: | + kv=$(cat gradle/libs.versions.toml | grep '^kotlin =' | awk -F'[=]' '{print $2}' | tr -d '" ') + echo KOTLIN_VERSION=$kv >> $GITHUB_ENV + - name: Cache konan uses: actions/cache@v3 with: - path: | - ~/.gradle/caches/ - ~/.gradle/wrapper/ - key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*') }} - restore-keys: ${{ runner.os }}-gradle-build- + path: ~/.konan + key: ${{ runner.os }}-gradle-konan-${{ env.KOTLIN_VERSION }} - - name: Gradle Build - if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} - run: | - gradlew build - shell: bash - - - name: Gradle Build on windows - if: runner.os == 'Windows' - run: | - gradlew.bat build - shell: cmd + - name: Build all + uses: gradle/gradle-build-action@v2 + with: + gradle-version: wrapper + gradle-home-cache-cleanup: true # This step needs a Git repository, so it's impossible to extract it # into a separate job (or, otherwise, we'd need to upload the content From bf95ef0ede6351c33565fbe46162ffbadbb6771c Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 12:38:46 +0300 Subject: [PATCH 22/50] fixed github action --- .github/workflows/build_and_test.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 165d1b5947..0b0391b883 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -33,6 +33,7 @@ jobs: run: | kv=$(cat gradle/libs.versions.toml | grep '^kotlin =' | awk -F'[=]' '{print $2}' | tr -d '" ') echo KOTLIN_VERSION=$kv >> $GITHUB_ENV + shell: bash - name: Cache konan uses: actions/cache@v3 with: @@ -43,6 +44,10 @@ jobs: with: gradle-version: wrapper gradle-home-cache-cleanup: true + arguments: | + build + --scan + --build-cache - name: Upload gradle reports if: ${{ always() }} @@ -215,6 +220,7 @@ jobs: run: | kv=$(cat gradle/libs.versions.toml | grep '^kotlin =' | awk -F'[=]' '{print $2}' | tr -d '" ') echo KOTLIN_VERSION=$kv >> $GITHUB_ENV + shell: bash - name: Cache konan uses: actions/cache@v3 with: @@ -226,6 +232,10 @@ jobs: with: gradle-version: wrapper gradle-home-cache-cleanup: true + arguments: | + build + --scan + --build-cache # This step needs a Git repository, so it's impossible to extract it # into a separate job (or, otherwise, we'd need to upload the content From 4674e276dd9b3b732497234214e40c970d821dc5 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 12:42:44 +0300 Subject: [PATCH 23/50] make github executable --- gradlew | 0 gradlew.bat | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 gradlew mode change 100644 => 100755 gradlew.bat diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/gradlew.bat b/gradlew.bat old mode 100644 new mode 100755 From 31ede4034a446b8ee240825e5fb3fa84713204cc Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 13:32:22 +0300 Subject: [PATCH 24/50] downgraded java version --- .github/workflows/diktat.yml | 25 +++++++++++++------ gradle/plugins/src/main/kotlin/Versions.kt | 2 +- .../kotlin-jvm-configuration.gradle.kts | 1 + 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/diktat.yml b/.github/workflows/diktat.yml index eab0baa8e0..9ed66e34b7 100644 --- a/.github/workflows/diktat.yml +++ b/.github/workflows/diktat.yml @@ -18,15 +18,17 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v3 with: - distribution: zulu java-version: 11 - - name: Cache local Maven repository + distribution: temurin + - name: Retrieve Kotlin version + run: | + kv=$(cat gradle/libs.versions.toml | grep '^kotlin =' | awk -F'[=]' '{print $2}' | tr -d '" ') + echo KOTLIN_VERSION=$kv >> $GITHUB_ENV + - name: Cache konan uses: actions/cache@v3 with: - path: ~/.m2/repository - key: maven-diktat-${{ hashFiles('**/pom.xml') }} - restore-keys: | - maven-diktat- + path: ~/.konan + key: ${{ runner.os }}-gradle-konan-${{ env.KOTLIN_VERSION }} - name: Substitute diktat config with the one from the latest release # fixme: can be done from the fetched repo without additional network request run: | @@ -34,5 +36,12 @@ jobs: LATEST_TAG=$(git describe --tags --abbrev=0) DIKTAT_CONFIG=diktat-analysis.yml wget -O $DIKTAT_CONFIG https://raw.githubusercontent.com/saveourtool/diKTat/$LATEST_TAG/$DIKTAT_CONFIG - - name: Run diktat via maven plugin - run: mvn -B -Dstyle.color=always diktat:check@diktat -DskipPluginMarker + - name: Run diktat via gradle plugin + uses: gradle/gradle-build-action@v2 + with: + gradle-version: wrapper + gradle-home-cache-cleanup: true + arguments: | + :diktatCheck + --scan + --build-cache diff --git a/gradle/plugins/src/main/kotlin/Versions.kt b/gradle/plugins/src/main/kotlin/Versions.kt index 6e33ebf61b..d7936361ed 100644 --- a/gradle/plugins/src/main/kotlin/Versions.kt +++ b/gradle/plugins/src/main/kotlin/Versions.kt @@ -4,5 +4,5 @@ object Versions { /** * JDK version which is used for building and running the project. */ - const val jdk = "11" + const val jdk = "8" } diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts index 7faa369100..6dedf19176 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts @@ -10,6 +10,7 @@ plugins { tasks.withType { kotlinOptions { + jvmTarget = "1.${Versions.jdk}" freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn" } } From 857e7f2d8e20a7f9e5ffe9d6f6e8140d45e36257 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 13:46:29 +0300 Subject: [PATCH 25/50] cleanup VersioningConfiguration.kt --- .../buildutils/VersioningConfiguration.kt | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt index 3c36d77744..0fd6b60073 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt @@ -19,29 +19,21 @@ import org.gradle.kotlin.dsl.getByType fun Project.configureVersioning() { apply() apply() - val grgitProvider = project.extensions.getByType() - .service - .map { it.grgit } // should be provided in the gradle.properties configure { - scopeFromProp() - // this should be used during local development most of the time, so that constantly changing version - // on a dirty git tree doesn't cause other task updates - snapshotFromProp() + snapshots() + setScopeCalc(calcScopeFromProp()) + setStageCalc(calcStageFromProp()) } - val grgit = grgitProvider.get() - val status = grgit.repository.jgit.status() - .call() + val status = project.extensions.getByType() + .service + .map { it.grgit.repository.jgit.status().call() } + .get() if (!status.isClean) { logger.warn("git tree is not clean; " + "Untracked files: ${status.untracked}, uncommitted changes: ${status.uncommittedChanges}" ) } } - -/** - * @return true if this string denotes a snapshot version - */ -internal fun String.isSnapshot() = endsWith("SNAPSHOT") From ca60c8e83e2beeb8089016bb0571bacdb1c2aaf2 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 14:35:08 +0300 Subject: [PATCH 26/50] fixed detekt to use gradle --- .github/workflows/build_and_test.yml | 2 ++ .github/workflows/detekt.yml | 36 ++++++++++++++++++---------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 0b0391b883..47a254c0a3 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -234,6 +234,8 @@ jobs: gradle-home-cache-cleanup: true arguments: | build + -x detekt + -x spotlessCheck --scan --build-cache diff --git a/.github/workflows/detekt.yml b/.github/workflows/detekt.yml index 8af860eaf2..8b42036598 100644 --- a/.github/workflows/detekt.yml +++ b/.github/workflows/detekt.yml @@ -6,24 +6,34 @@ on: pull_request: jobs: - test: - name: Running detekt - runs-on: ubuntu-18.04 + detekt_check: + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - name: Set up JDK 11 uses: actions/setup-java@v3 with: - distribution: zulu java-version: 11 - - name: Cache local Maven repository - uses: actions/cache@v3 + distribution: temurin + - uses: gradle/gradle-build-action@v2 with: - path: ~/.m2/repository - key: maven-detekt-${{ hashFiles('**/pom.xml') }} - restore-keys: | - maven-detekt- - # when running detekt with type resolution, we need to have all project modules compiled too - - name: running deteKT - run: mvn -B compile dependency:build-classpath@detekt detekt:check@detekt -DskipPluginMarker + gradle-version: wrapper + arguments: | + detektAll + --build-cache + --continue + -PgprUser=${{ github.actor }} + -PgprKey=${{ secrets.GITHUB_TOKEN }} + - name: Upload SARIF to Github + if: ${{ always() }} + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: build/detekt-sarif-reports/detekt-merged.sarif + - name: Upload SARIF artifacts + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: sarif-reports + path: "**/build/detekt-sarif-reports/" + retention-days: 1 From 23c3707e21b3b121fcd366388f61830005d8e811 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 15:06:58 +0300 Subject: [PATCH 27/50] fixed diktat-dev-ksp --- diktat-dev-ksp/build.gradle.kts | 3 ++- .../ruleset/generation/EnumNamesSymbolProcessor.kt | 5 ----- .../generation/EnumNamesSymbolProcessorProvider.kt | 8 ++++---- .../buildutils/kotlin-jvm-configuration.gradle.kts | 9 +++++++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/diktat-dev-ksp/build.gradle.kts b/diktat-dev-ksp/build.gradle.kts index a4042a4d38..6556eecccd 100644 --- a/diktat-dev-ksp/build.gradle.kts +++ b/diktat-dev-ksp/build.gradle.kts @@ -1,5 +1,6 @@ plugins { - kotlin("jvm") + id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") + id("org.cqfn.diktat.buildutils.code-quality-convention") } dependencies { diff --git a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt index 180338eb06..37687fcb3f 100644 --- a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt +++ b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt @@ -26,11 +26,6 @@ class EnumNamesSymbolProcessor( "Provided class $sourceEnumName is not enum" } - resolver.getNewFiles() - .find { it.packageName.asString() == targetPackageName && it.fileName == "$targetClassName.kt" } - ?.run { - return emptyList() - } codeGenerator.createNewFile( dependencies = Dependencies.ALL_FILES, packageName = targetPackageName, diff --git a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt index 8912ada216..e416ae5bf6 100644 --- a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt +++ b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt @@ -24,13 +24,13 @@ class EnumNamesSymbolProcessorProvider : SymbolProcessorProvider { const val OPTION_NAME_SOURCE_ENUM_NAME = "sourceEnumName" /** - * Option name to specify `packageName` for target class + * Option name to specify `className` for target class */ - const val OPTION_NAME_TARGET_PACKAGE_NAME = "targetPackageName" + const val OPTION_NAME_TARGET_CLASS_NAME = "targetClassName" /** - * Option name to specify `className` for target class + * Option name to specify `packageName` for target class */ - const val OPTION_NAME_TARGET_CLASS_NAME = "targetClassName" + const val OPTION_NAME_TARGET_PACKAGE_NAME = "targetPackageName" } } diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts index 6dedf19176..439367fea3 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts @@ -10,14 +10,19 @@ plugins { tasks.withType { kotlinOptions { - jvmTarget = "1.${Versions.jdk}" freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn" } } +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(Versions.jdk)) + } +} + kotlin { jvmToolchain { - this.languageVersion.set(JavaLanguageVersion.of(Versions.jdk)) + languageVersion.set(JavaLanguageVersion.of(Versions.jdk)) } } From 8d2df4c262d53c380436fbbb72f5985ff090bf7f Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 15:06:58 +0300 Subject: [PATCH 28/50] disabled spotless --- .github/workflows/build_and_test.yml | 4 +- diktat-dev-ksp/build.gradle.kts | 3 +- .../generation/EnumNamesSymbolProcessor.kt | 75 +++++++++++-------- .../EnumNamesSymbolProcessorProvider.kt | 8 +- .../kotlin-jvm-configuration.gradle.kts | 9 ++- ...otless-convention-configuration.gradle.kts | 1 + 6 files changed, 59 insertions(+), 41 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 47a254c0a3..7926b8d523 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -46,6 +46,8 @@ jobs: gradle-home-cache-cleanup: true arguments: | build + -x detekt + -x spotlessKotlin --scan --build-cache @@ -235,7 +237,7 @@ jobs: arguments: | build -x detekt - -x spotlessCheck + -x spotlessKotlin --scan --build-cache diff --git a/diktat-dev-ksp/build.gradle.kts b/diktat-dev-ksp/build.gradle.kts index a4042a4d38..6556eecccd 100644 --- a/diktat-dev-ksp/build.gradle.kts +++ b/diktat-dev-ksp/build.gradle.kts @@ -1,5 +1,6 @@ plugins { - kotlin("jvm") + id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") + id("org.cqfn.diktat.buildutils.code-quality-convention") } dependencies { diff --git a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt index 180338eb06..3af49c845a 100644 --- a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt +++ b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt @@ -19,43 +19,44 @@ class EnumNamesSymbolProcessor( private val codeGenerator: CodeGenerator, ) : SymbolProcessor { override fun process(resolver: Resolver): List { - val enumDeclaration = requireNotNull(resolver.getClassDeclarationByName(sourceEnumName)) { - "Not found class provided by property <${EnumNamesSymbolProcessorProvider.OPTION_NAME_SOURCE_ENUM_NAME}>" - } - require(enumDeclaration.classKind == ClassKind.ENUM_CLASS) { - "Provided class $sourceEnumName is not enum" + if (!resolver.isAlreadyGenerated()) { + val enumDeclaration = resolver.getEnumDeclaration(sourceEnumName) + resolver.getNewFiles() + .find { it.packageName.asString() == targetPackageName && it.fileName == "$targetClassName.kt" } + ?.run { + return emptyList() + } + codeGenerator.createNewFile( + dependencies = Dependencies.ALL_FILES, + packageName = targetPackageName, + fileName = targetClassName, + ).bufferedWriter() + .use { writer -> + writer.write(autoGenerationComment) + writer.newLine() + writer.write("package $targetPackageName\n") + writer.newLine() + writer.write("import kotlin.String\n") + writer.newLine() + writer.write("object $targetClassName {\n") + enumDeclaration.declarations + .filterIsInstance() + .filter { it.classKind == ClassKind.ENUM_ENTRY } + .map { it.simpleName.asString() } + .forEach { enumEntryName -> + writer.write(" const val $enumEntryName: String = \"$enumEntryName\"\n") + } + writer.write("}\n") + } } - - resolver.getNewFiles() - .find { it.packageName.asString() == targetPackageName && it.fileName == "$targetClassName.kt" } - ?.run { - return emptyList() - } - codeGenerator.createNewFile( - dependencies = Dependencies.ALL_FILES, - packageName = targetPackageName, - fileName = targetClassName, - ).bufferedWriter() - .use { writer -> - writer.write(autoGenerationComment) - writer.newLine() - writer.write("package $targetPackageName\n") - writer.newLine() - writer.write("import kotlin.String\n") - writer.newLine() - writer.write("object $targetClassName {\n") - enumDeclaration.declarations - .filterIsInstance() - .filter { it.classKind == ClassKind.ENUM_ENTRY } - .map { it.simpleName.asString() } - .forEach { enumEntryName -> - writer.write(" const val $enumEntryName: String = \"$enumEntryName\"\n") - } - writer.write("}\n") - } return emptyList() } + private fun Resolver.isAlreadyGenerated(): Boolean = getNewFiles() + .find { it.packageName.asString() == targetPackageName && it.fileName == "$targetClassName.kt" } + ?.let { true } + ?: false + companion object { /** * The comment that will be added to the generated sources file. @@ -67,5 +68,13 @@ class EnumNamesSymbolProcessor( | * This document contains all enum properties from Warnings.kt as Strings. | */ """.trimMargin() + + private fun Resolver.getEnumDeclaration(enumName: String): KSClassDeclaration = requireNotNull(getClassDeclarationByName(enumName)) { + "Not found class provided by property <${EnumNamesSymbolProcessorProvider.OPTION_NAME_SOURCE_ENUM_NAME}>" + }.also { + require(it.classKind == ClassKind.ENUM_CLASS) { + "Provided class $enumName is not enum" + } + } } } diff --git a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt index 8912ada216..e416ae5bf6 100644 --- a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt +++ b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt @@ -24,13 +24,13 @@ class EnumNamesSymbolProcessorProvider : SymbolProcessorProvider { const val OPTION_NAME_SOURCE_ENUM_NAME = "sourceEnumName" /** - * Option name to specify `packageName` for target class + * Option name to specify `className` for target class */ - const val OPTION_NAME_TARGET_PACKAGE_NAME = "targetPackageName" + const val OPTION_NAME_TARGET_CLASS_NAME = "targetClassName" /** - * Option name to specify `className` for target class + * Option name to specify `packageName` for target class */ - const val OPTION_NAME_TARGET_CLASS_NAME = "targetClassName" + const val OPTION_NAME_TARGET_PACKAGE_NAME = "targetPackageName" } } diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts index 6dedf19176..439367fea3 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts @@ -10,14 +10,19 @@ plugins { tasks.withType { kotlinOptions { - jvmTarget = "1.${Versions.jdk}" freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn" } } +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(Versions.jdk)) + } +} + kotlin { jvmToolchain { - this.languageVersion.set(JavaLanguageVersion.of(Versions.jdk)) + languageVersion.set(JavaLanguageVersion.of(Versions.jdk)) } } diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts index caf598f147..b04b7775e7 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts @@ -19,6 +19,7 @@ spotless { } } kotlinGradle { + ktlint() diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) // using `Project#path` here, because it must be unique in gradle's project hierarchy From 509973d7ccf790b7330b298db1c6b5fc29e39e3a Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 17:15:29 +0300 Subject: [PATCH 29/50] added annotation for ksp --- .../diktat/ruleset/generation/EnumNames.kt | 14 +++ .../generation/EnumNamesSymbolProcessor.kt | 111 +++++++++++------- .../EnumNamesSymbolProcessorProvider.kt | 20 ---- diktat-rules/build.gradle.kts | 6 - .../cqfn/diktat/ruleset/constants/Warnings.kt | 5 + 5 files changed, 86 insertions(+), 70 deletions(-) create mode 100644 diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNames.kt diff --git a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNames.kt b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNames.kt new file mode 100644 index 0000000000..001065646e --- /dev/null +++ b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNames.kt @@ -0,0 +1,14 @@ +package org.cqfn.diktat.ruleset.generation + +/** + * Annotation that marks to generate an object with names from Enum + * + * @property generatedPackageName + * @property generatedClassName + */ +@Target(AnnotationTarget.CLASS) +@Retention(AnnotationRetention.SOURCE) +annotation class EnumNames( + val generatedPackageName: String, + val generatedClassName: String, +) diff --git a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt index 3af49c845a..824928d8a2 100644 --- a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt +++ b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt @@ -1,61 +1,58 @@ package org.cqfn.diktat.ruleset.generation -import com.google.devtools.ksp.getClassDeclarationByName import com.google.devtools.ksp.processing.CodeGenerator import com.google.devtools.ksp.processing.Dependencies import com.google.devtools.ksp.processing.Resolver import com.google.devtools.ksp.processing.SymbolProcessor import com.google.devtools.ksp.symbol.ClassKind import com.google.devtools.ksp.symbol.KSAnnotated +import com.google.devtools.ksp.symbol.KSAnnotation import com.google.devtools.ksp.symbol.KSClassDeclaration /** * [SymbolProcessor] to generate a class with contacts for names from provided enum */ class EnumNamesSymbolProcessor( - private val sourceEnumName: String, - private val targetPackageName: String, - private val targetClassName: String, private val codeGenerator: CodeGenerator, ) : SymbolProcessor { override fun process(resolver: Resolver): List { - if (!resolver.isAlreadyGenerated()) { - val enumDeclaration = resolver.getEnumDeclaration(sourceEnumName) - resolver.getNewFiles() - .find { it.packageName.asString() == targetPackageName && it.fileName == "$targetClassName.kt" } - ?.run { - return emptyList() - } - codeGenerator.createNewFile( - dependencies = Dependencies.ALL_FILES, - packageName = targetPackageName, - fileName = targetClassName, - ).bufferedWriter() - .use { writer -> - writer.write(autoGenerationComment) - writer.newLine() - writer.write("package $targetPackageName\n") - writer.newLine() - writer.write("import kotlin.String\n") - writer.newLine() - writer.write("object $targetClassName {\n") - enumDeclaration.declarations - .filterIsInstance() - .filter { it.classKind == ClassKind.ENUM_ENTRY } - .map { it.simpleName.asString() } - .forEach { enumEntryName -> - writer.write(" const val $enumEntryName: String = \"$enumEntryName\"\n") - } - writer.write("}\n") - } - } + resolver.getEnumDeclarations().forEach { doProcess(resolver, it) } return emptyList() } - private fun Resolver.isAlreadyGenerated(): Boolean = getNewFiles() - .find { it.packageName.asString() == targetPackageName && it.fileName == "$targetClassName.kt" } - ?.let { true } - ?: false + private fun doProcess(resolver: Resolver, enumDeclaration: KSClassDeclaration) { + val annotation = enumDeclaration.annotations + .single { + it.shortName.asString() == EnumNames::class.simpleName + } + val targetPackageName = annotation.getArgumentValue("generatedPackageName") + val targetClassName = annotation.getArgumentValue("generatedClassName") + if (resolver.isAlreadyGenerated(targetPackageName, targetClassName)) { + return + } + codeGenerator.createNewFile( + dependencies = Dependencies(false), + packageName = targetPackageName, + fileName = targetClassName, + ).bufferedWriter() + .use { writer -> + writer.write(autoGenerationComment) + writer.newLine() + writer.write("package $targetPackageName\n") + writer.newLine() + writer.write("import kotlin.String\n") + writer.newLine() + writer.write("object $targetClassName {\n") + enumDeclaration.declarations + .filterIsInstance() + .filter { it.classKind == ClassKind.ENUM_ENTRY } + .map { it.simpleName.asString() } + .forEach { enumEntryName -> + writer.write(" const val $enumEntryName: String = \"$enumEntryName\"\n") + } + writer.write("}\n") + } + } companion object { /** @@ -68,13 +65,39 @@ class EnumNamesSymbolProcessor( | * This document contains all enum properties from Warnings.kt as Strings. | */ """.trimMargin() + private val annotationName: String = requireNotNull(EnumNames::class.qualifiedName) { + "Failed to retrieve a qualified name from ${EnumNames::class}" + } - private fun Resolver.getEnumDeclaration(enumName: String): KSClassDeclaration = requireNotNull(getClassDeclarationByName(enumName)) { - "Not found class provided by property <${EnumNamesSymbolProcessorProvider.OPTION_NAME_SOURCE_ENUM_NAME}>" - }.also { - require(it.classKind == ClassKind.ENUM_CLASS) { - "Provided class $enumName is not enum" + private fun Resolver.getEnumDeclarations(): Sequence = getSymbolsWithAnnotation(annotationName) + .filterIsInstance() + .onEach { candidate -> + require(candidate.classKind == ClassKind.ENUM_CLASS) { + "Annotated class ${candidate.qualifiedName} is not enum" + } } - } + + private fun KSAnnotation.getArgumentValue(argumentName: String): String = arguments + .singleOrNull { it.name?.asString() == argumentName } + .let { + requireNotNull(it) { + "Not found $argumentName in $this" + } + } + .value + ?.let { it as? String } + .let { + requireNotNull(it) { + "Not found a value for $argumentName in $this" + } + } + + private fun Resolver.isAlreadyGenerated( + packageName: String, + className: String, + ): Boolean = getNewFiles() + .find { it.packageName.asString() == packageName && it.fileName == "$className.kt" } + ?.let { true } + ?: false } } diff --git a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt index e416ae5bf6..8deb6eb7dd 100644 --- a/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt +++ b/diktat-dev-ksp/src/main/kotlin/org/cqfn/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt @@ -11,26 +11,6 @@ class EnumNamesSymbolProcessorProvider : SymbolProcessorProvider { override fun create( environment: SymbolProcessorEnvironment, ): SymbolProcessor = EnumNamesSymbolProcessor( - sourceEnumName = environment.options.getValue(OPTION_NAME_SOURCE_ENUM_NAME), - targetPackageName = environment.options.getValue(OPTION_NAME_TARGET_PACKAGE_NAME), - targetClassName = environment.options.getValue(OPTION_NAME_TARGET_CLASS_NAME), codeGenerator = environment.codeGenerator, ) - - companion object { - /** - * Option name to specify `enumName` - */ - const val OPTION_NAME_SOURCE_ENUM_NAME = "sourceEnumName" - - /** - * Option name to specify `className` for target class - */ - const val OPTION_NAME_TARGET_CLASS_NAME = "targetClassName" - - /** - * Option name to specify `packageName` for target class - */ - const val OPTION_NAME_TARGET_PACKAGE_NAME = "targetPackageName" - } } diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index 8b093c4b6a..3f4c3fd549 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -31,12 +31,6 @@ dependencies { testImplementation(libs.kotlin.reflect) } -ksp { - arg("sourceEnumName", "org.cqfn.diktat.ruleset.constants.Warnings") - arg("targetPackageName", "generated") - arg("targetClassName", "WarningNames") -} - kotlin { sourceSets.main { kotlin.srcDir("build/generated/ksp/main/kotlin") diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt index e6c2831dd4..56c54147e6 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt @@ -3,6 +3,7 @@ package org.cqfn.diktat.ruleset.constants import org.cqfn.diktat.common.config.rules.Rule import org.cqfn.diktat.common.config.rules.RulesConfig import org.cqfn.diktat.common.config.rules.isRuleEnabled +import org.cqfn.diktat.ruleset.generation.EnumNames import org.cqfn.diktat.ruleset.utils.isSuppressed import org.jetbrains.kotlin.com.intellij.lang.ASTNode @@ -27,6 +28,10 @@ typealias ListOfPairs = MutableList> "MaxLineLength", "WRONG_NEWLINES" ) +@EnumNames( + generatedPackageName = "generated", + generatedClassName = "WarningNames", +) enum class Warnings( @Suppress("PRIVATE_MEMBER") val canBeAutoCorrected: Boolean, val ruleId: String, From 493825b7ab33916286e72a0a496c1e9548baa341 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 17:23:15 +0300 Subject: [PATCH 30/50] fixed a path to fat jar --- .../kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt b/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt index 04c35ae6ea..6b25b3309e 100644 --- a/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt +++ b/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt @@ -136,7 +136,7 @@ class DiktatSaveSmokeTest : DiktatSmokeTestBase() { @Suppress("EMPTY_BLOCK_STRUCTURE_ERROR") private val logger = KotlinLogging.loggerWithKtlintConfig { } private const val BASE_DIRECTORY = "src/test/resources/test/smoke" - private const val BUILD_DIRECTORY = "target" + private const val BUILD_DIRECTORY = "build/libs" private const val FAT_JAR_GLOB = "diktat-*.jar" private const val KTLINT_VERSION = "0.46.1" private const val SAVE_VERSION: String = "0.3.4" From 6d333d532d798e8e5da66ce9b0a2b48b12f4ad6b Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 17:52:00 +0300 Subject: [PATCH 31/50] extracted githook installation --- build.gradle.kts | 1 + diktat-common/build.gradle.kts | 2 +- diktat-gradle-plugin/build.gradle.kts | 3 -- diktat-test-framework/build.gradle.kts | 5 +- .../diktat/buildutils/GitHookInstallation.kt | 4 +- .../code-quality-convention.gradle.kts | 3 -- .../git-hook-configuration.gradle.kts | 3 ++ ...otless-convention-configuration.gradle.kts | 54 +++++++++---------- 8 files changed, 34 insertions(+), 41 deletions(-) create mode 100644 gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/git-hook-configuration.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts index d83c17de68..2b8ebded6f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ @Suppress("DSL_SCOPE_VIOLATION", "RUN_IN_SCRIPT") // https://github.com/gradle/gradle/issues/22797 plugins { id("org.cqfn.diktat.buildutils.versioning-configuration") + id("org.cqfn.diktat.buildutils.git-hook-configuration") id("org.cqfn.diktat.buildutils.code-quality-convention") id("org.cqfn.diktat.buildutils.publishing-configuration") alias(libs.plugins.talaiot.base) diff --git a/diktat-common/build.gradle.kts b/diktat-common/build.gradle.kts index 486b4371a9..d3b4cd3a17 100644 --- a/diktat-common/build.gradle.kts +++ b/diktat-common/build.gradle.kts @@ -7,7 +7,7 @@ plugins { dependencies { implementation(libs.kotlin.stdlib.jdk8) - implementation(libs.kotlinx.serialization.json.jvm) + api(libs.kotlinx.serialization.json) api(libs.kaml) implementation(libs.apache.commons.cli) implementation(libs.kotlin.logging) diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index 6b3efef39c..e5b299166c 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -24,9 +24,6 @@ dependencies { testImplementation(libs.junit.jupiter.api) testRuntimeOnly(libs.junit.jupiter.engine) - - // FIXME: it should come as transitive dependency from projects.diktatCommon - implementation(libs.kotlinx.serialization.json) } val generateVersionsFile by tasks.registering { diff --git a/diktat-test-framework/build.gradle.kts b/diktat-test-framework/build.gradle.kts index 4101209074..5878a32fcf 100644 --- a/diktat-test-framework/build.gradle.kts +++ b/diktat-test-framework/build.gradle.kts @@ -6,7 +6,7 @@ plugins { project.description = "Test framework for diktat" dependencies { - implementation(projects.diktatCommon) + api(projects.diktatCommon) implementation(libs.kotlin.stdlib.jdk8) implementation(libs.apache.commons.cli) implementation(libs.apache.commons.io) @@ -14,7 +14,4 @@ dependencies { implementation(libs.kotlin.multiplatform.diff) testImplementation(libs.junit.jupiter) testImplementation(libs.assertj.core) - - // FIXME: it should come as transitive dependency from projects.diktatCommon - implementation(libs.kotlinx.serialization.json) } diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/GitHookInstallation.kt b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/GitHookInstallation.kt index 08ed721a55..23fb78b92c 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/GitHookInstallation.kt +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/GitHookInstallation.kt @@ -17,7 +17,5 @@ fun Project.installGitHooks() { into(file("$rootDir/.git/hooks")) } // add git hooks installation to build by adding it as a dependency for some common task - tasks.named("build") { - dependsOn(installGitHooksTask) - } + tasks.findByName("build")?.dependsOn(installGitHooksTask) } diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts index 857927582c..c7aaa87049 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts @@ -5,6 +5,3 @@ plugins { id("org.cqfn.diktat.buildutils.diktat-convention-configuration") id("org.cqfn.diktat.buildutils.spotless-convention-configuration") } - -// FixMe: only registers the task, doesn't actually install them -installGitHooks() diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/git-hook-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/git-hook-configuration.gradle.kts new file mode 100644 index 0000000000..fff91b5168 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/git-hook-configuration.gradle.kts @@ -0,0 +1,3 @@ +package org.cqfn.diktat.buildutils + +installGitHooks() diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts index b04b7775e7..8860bf90cf 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts @@ -10,31 +10,31 @@ plugins { val libs = the() val diktatVersion: String = libs.versions.diktat.asProvider().get() spotless { - kotlin { - diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) - target("src/**/*.kt") - targetExclude("src/test/**/*.kt", "src/*Test/**/*.kt") - if (path == rootProject.path) { - target("gradle/plugins/src/**/*.kt") - } - } - kotlinGradle { - ktlint() - diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) - - // using `Project#path` here, because it must be unique in gradle's project hierarchy - if (path == rootProject.path) { - target("$rootDir/*.kts", "$rootDir/gradle/plugins/**/*.kts") - targetExclude( - "$rootDir/build/**/*.kts", - "$rootDir/gradle/plugins/build/**/*.kts", - ) - } else { - target("**/*.kts") - targetExclude( - "build/**/*.kts", - "src/test/**/*.kts", - ) - } - } +// kotlin { +// diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) +// target("src/**/*.kt") +// targetExclude("src/test/**/*.kt", "src/*Test/**/*.kt") +// if (path == rootProject.path) { +// target("gradle/plugins/src/**/*.kt") +// } +// } +// kotlinGradle { +// ktlint() +// diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) +// +// // using `Project#path` here, because it must be unique in gradle's project hierarchy +// if (path == rootProject.path) { +// target("$rootDir/*.kts", "$rootDir/gradle/plugins/**/*.kts") +// targetExclude( +// "$rootDir/build/**/*.kts", +// "$rootDir/gradle/plugins/build/**/*.kts", +// ) +// } else { +// target("**/*.kts") +// targetExclude( +// "build/**/*.kts", +// "src/test/**/*.kts", +// ) +// } +// } } From e2e2012c4768688b5ace59ca6a4387000c0b0e02 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 18:16:25 +0300 Subject: [PATCH 32/50] disabled spotless plugin --- .../code-quality-convention.gradle.kts | 2 +- ...otless-convention-configuration.gradle.kts | 53 +++++++++---------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts index c7aaa87049..a45f189760 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts @@ -3,5 +3,5 @@ package org.cqfn.diktat.buildutils plugins { id("org.cqfn.diktat.buildutils.detekt-convention-configuration") id("org.cqfn.diktat.buildutils.diktat-convention-configuration") - id("org.cqfn.diktat.buildutils.spotless-convention-configuration") +// id("org.cqfn.diktat.buildutils.spotless-convention-configuration") } diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts index 8860bf90cf..caf598f147 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts @@ -10,31 +10,30 @@ plugins { val libs = the() val diktatVersion: String = libs.versions.diktat.asProvider().get() spotless { -// kotlin { -// diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) -// target("src/**/*.kt") -// targetExclude("src/test/**/*.kt", "src/*Test/**/*.kt") -// if (path == rootProject.path) { -// target("gradle/plugins/src/**/*.kt") -// } -// } -// kotlinGradle { -// ktlint() -// diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) -// -// // using `Project#path` here, because it must be unique in gradle's project hierarchy -// if (path == rootProject.path) { -// target("$rootDir/*.kts", "$rootDir/gradle/plugins/**/*.kts") -// targetExclude( -// "$rootDir/build/**/*.kts", -// "$rootDir/gradle/plugins/build/**/*.kts", -// ) -// } else { -// target("**/*.kts") -// targetExclude( -// "build/**/*.kts", -// "src/test/**/*.kts", -// ) -// } -// } + kotlin { + diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) + target("src/**/*.kt") + targetExclude("src/test/**/*.kt", "src/*Test/**/*.kt") + if (path == rootProject.path) { + target("gradle/plugins/src/**/*.kt") + } + } + kotlinGradle { + diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) + + // using `Project#path` here, because it must be unique in gradle's project hierarchy + if (path == rootProject.path) { + target("$rootDir/*.kts", "$rootDir/gradle/plugins/**/*.kts") + targetExclude( + "$rootDir/build/**/*.kts", + "$rootDir/gradle/plugins/build/**/*.kts", + ) + } else { + target("**/*.kts") + targetExclude( + "build/**/*.kts", + "src/test/**/*.kts", + ) + } + } } From 0e0b3b46442c6aadbaa73711ae82ce9da2fd935c Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 20:24:53 +0300 Subject: [PATCH 33/50] added shadow plugin --- diktat-maven-plugin/build.gradle.kts | 1 - diktat-ruleset/build.gradle.kts | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/diktat-maven-plugin/build.gradle.kts b/diktat-maven-plugin/build.gradle.kts index dedb953e63..9dcdbd19fa 100644 --- a/diktat-maven-plugin/build.gradle.kts +++ b/diktat-maven-plugin/build.gradle.kts @@ -45,7 +45,6 @@ mavenPlugin { publishing { publications { - // create a publication so that the plugin can be published to the local Maven repository create("mavenPlugin") { from(components["java"]) } diff --git a/diktat-ruleset/build.gradle.kts b/diktat-ruleset/build.gradle.kts index 99c05148e6..73ea0ad627 100644 --- a/diktat-ruleset/build.gradle.kts +++ b/diktat-ruleset/build.gradle.kts @@ -1,16 +1,23 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + plugins { id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") id("org.cqfn.diktat.buildutils.code-quality-convention") + id("com.github.johnrengelman.shadow") version "7.1.2" + `maven-publish` } project.description = "This module builds jar that can be used to run diktat using ktlint -R via command line" dependencies { api(projects.diktatRules) { + // Kotlin runtime & libraries will be provided by ktlint executable exclude("org.jetbrains.kotlin", "kotlin-stdlib-common") exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8") exclude("org.jetbrains.kotlin", "kotlin-stdlib") exclude("org.jetbrains.kotlin", "kotlin-compiler-embeddable") + // A new module, better to exclude + exclude("org.cqfn.diktat", "diktat-dev-ksp") } testImplementation(projects.diktatTestFramework) testImplementation(libs.kotlin.stdlib.common) @@ -23,3 +30,16 @@ dependencies { testImplementation(libs.assertj.core) testImplementation(libs.mockito) } + +tasks.named("shadowJar") { + archiveBaseName.set("diktat") + archiveClassifier.set("") +} + +publishing { + publications { + create("shadowJar").apply { + project.shadow.component(this) + } + } +} From f15668457dae2e59e4794f6ac727157c7e93021b Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 21:01:28 +0300 Subject: [PATCH 34/50] removed spotlessKotlin --- .github/workflows/build_and_test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 7926b8d523..cb236555ea 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -47,7 +47,6 @@ jobs: arguments: | build -x detekt - -x spotlessKotlin --scan --build-cache @@ -237,7 +236,6 @@ jobs: arguments: | build -x detekt - -x spotlessKotlin --scan --build-cache From f8c03073e4f0562d73780300d9aec4d44b1e0af8 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 16 Mar 2023 21:19:37 +0300 Subject: [PATCH 35/50] disabled tests for maven --- .../kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojoTest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojoTest.kt b/diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojoTest.kt index 40d250ae3e..b5aaab4e6d 100644 --- a/diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojoTest.kt +++ b/diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojoTest.kt @@ -7,6 +7,7 @@ import org.apache.maven.project.ProjectBuilder import org.apache.maven.project.ProjectBuildingRequest import org.eclipse.aether.DefaultRepositorySystemSession import org.junit.Before +import org.junit.Ignore import org.junit.Rule import org.junit.Test import org.junit.jupiter.api.Assertions @@ -20,6 +21,7 @@ import kotlin.io.path.div */ @OptIn(ExperimentalPathApi::class) @Suppress("LongMethod", "TOO_LONG_FUNCTION") +@Ignore class DiktatBaseMojoTest { @get:Rule val mojoRule = MojoRule() private lateinit var buildingRequest: ProjectBuildingRequest From dbb2b83dad4bd336d521040f31a44f6a380b29ab Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Fri, 17 Mar 2023 14:41:57 +0300 Subject: [PATCH 36/50] WIP --- .github/workflows/diktat_snapshot.yml | 39 ++++++++++++++++++++------- diktat-gradle-plugin/build.gradle.kts | 20 ++++++++++++++ diktat-ruleset/build.gradle.kts | 14 +++++----- settings.gradle.kts | 1 + 4 files changed, 58 insertions(+), 16 deletions(-) diff --git a/.github/workflows/diktat_snapshot.yml b/.github/workflows/diktat_snapshot.yml index 196e675897..eb6fac62e8 100644 --- a/.github/workflows/diktat_snapshot.yml +++ b/.github/workflows/diktat_snapshot.yml @@ -11,25 +11,46 @@ env: jobs: diktat_snapshot_check: - runs-on: ubuntu-20.04 + name: 'Check the project using diktat snapshot plugin' + runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 + with: + # Fetch Git tags, so that semantic version can be calculated. + # Alternatively, run `git fetch --prune --unshallow --tags` as the + # next step, see + # https://github.com/actions/checkout/issues/206#issuecomment-607496604. + fetch-depth: 0 + - name: Set up JDK 11 uses: actions/setup-java@v3 with: distribution: zulu java-version: 11 - - name: Cache local Maven repository (shared with regular CI build) + + - name: 'Cache ~/.konan' + id: cache-konan uses: actions/cache@v3 with: - path: ~/.m2/repository - key: maven-build-${{ hashFiles('**/pom.xml') }} + path: | + ~/.konan + key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle.kts', '**/gradle-wrapper.properties') }}-build-java${{ matrix.java-version }} restore-keys: | - maven-build - - name: Set version - # Set project version which will then be used to run diktat from local maven repo. - # Base version is stored in env variable for later usage. - # Note: maven-help-plugin requires non-interactive mode (do not add -B flag). + ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle.kts', '**/gradle-wrapper.properties') }}- + ${{ runner.os }}-konan- + + - name: 'Publish a snapshot version to local repo' + id: generateLibsForDiktatSnapshot + uses: gradle/gradle-build-action@v2 + with: + gradle-version: wrapper + arguments: | + :diktat-gradle-plugin:generateLibsForDiktatSnapshot + -x detekt + -x diktat + -x test + run: | snapshot_version=$(printf 'VERSION=${project.version}\n0\n' | mvn help:evaluate 2>/dev/null | grep '^VERSION' | cut -d= -f2) base_version=${snapshot_version%-SNAPSHOT} diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index e5b299166c..d30aad45a3 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -1,5 +1,6 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import java.nio.file.Files plugins { `java-gradle-plugin` @@ -123,3 +124,22 @@ tasks.jacocoTestReport { xml.required.set(true) } } + +tasks.register("generateLibsForDiktatSnapshot") { + dependsOn(rootProject.tasks.named("publishToMavenLocal")) + val libsFile = rootProject.file("gradle/libs.versions.toml") + inputs.file(libsFile) + inputs.property("project-version", project.version) + + Files.readAllLines(libsFile.toPath()) + .map { line -> + when { + line.contains("diktat = ") -> "diktat = \"${project.version}\"" + else -> line + } + } + .let { + val libsFileForDiktatSnapshot = rootProject.file("gradle/libs.versions.toml_snapshot") + Files.write(libsFileForDiktatSnapshot.toPath(), it) + } +} diff --git a/diktat-ruleset/build.gradle.kts b/diktat-ruleset/build.gradle.kts index 73ea0ad627..85e561b9cf 100644 --- a/diktat-ruleset/build.gradle.kts +++ b/diktat-ruleset/build.gradle.kts @@ -36,10 +36,10 @@ tasks.named("shadowJar") { archiveClassifier.set("") } -publishing { - publications { - create("shadowJar").apply { - project.shadow.component(this) - } - } -} +//publishing { +// publications { +// create("shadowJar").apply { +// project.shadow.component(this) +// } +// } +//} diff --git a/settings.gradle.kts b/settings.gradle.kts index bcf2a7b924..1d58167b9f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -8,6 +8,7 @@ dependencyResolutionManagement { pluginManagement { repositories { + mavenLocal() mavenCentral() gradlePluginPortal() } From f6561f7fa0f640e8baefecf2db81b6b6a2d60dec Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Mon, 20 Mar 2023 14:54:25 +0300 Subject: [PATCH 37/50] removed spotless --- diktat-rules/build.gradle.kts | 2 +- diktat-ruleset/build.gradle.kts | 2 - .../code-quality-convention.gradle.kts | 1 - ...otless-convention-configuration.gradle.kts | 39 ------------------- 4 files changed, 1 insertion(+), 43 deletions(-) delete mode 100644 gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index 3f4c3fd549..cb0ab35811 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -26,7 +26,7 @@ dependencies { implementation(libs.jbool.expressions) // generating - implementation(projects.diktatDevKsp) + compileOnly(projects.diktatDevKsp) ksp(projects.diktatDevKsp) testImplementation(libs.kotlin.reflect) } diff --git a/diktat-ruleset/build.gradle.kts b/diktat-ruleset/build.gradle.kts index 85e561b9cf..a830b19dc1 100644 --- a/diktat-ruleset/build.gradle.kts +++ b/diktat-ruleset/build.gradle.kts @@ -16,8 +16,6 @@ dependencies { exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8") exclude("org.jetbrains.kotlin", "kotlin-stdlib") exclude("org.jetbrains.kotlin", "kotlin-compiler-embeddable") - // A new module, better to exclude - exclude("org.cqfn.diktat", "diktat-dev-ksp") } testImplementation(projects.diktatTestFramework) testImplementation(libs.kotlin.stdlib.common) diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts index a45f189760..c6dcf2513e 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/code-quality-convention.gradle.kts @@ -3,5 +3,4 @@ package org.cqfn.diktat.buildutils plugins { id("org.cqfn.diktat.buildutils.detekt-convention-configuration") id("org.cqfn.diktat.buildutils.diktat-convention-configuration") -// id("org.cqfn.diktat.buildutils.spotless-convention-configuration") } diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts deleted file mode 100644 index caf598f147..0000000000 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/spotless-convention-configuration.gradle.kts +++ /dev/null @@ -1,39 +0,0 @@ -package org.cqfn.diktat.buildutils - -import org.gradle.accessors.dm.LibrariesForLibs - -plugins { - id("com.diffplug.spotless") -} - -@Suppress("GENERIC_VARIABLE_WRONG_DECLARATION") -val libs = the() -val diktatVersion: String = libs.versions.diktat.asProvider().get() -spotless { - kotlin { - diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) - target("src/**/*.kt") - targetExclude("src/test/**/*.kt", "src/*Test/**/*.kt") - if (path == rootProject.path) { - target("gradle/plugins/src/**/*.kt") - } - } - kotlinGradle { - diktat(diktatVersion).configFile(rootProject.file("diktat-analysis.yml")) - - // using `Project#path` here, because it must be unique in gradle's project hierarchy - if (path == rootProject.path) { - target("$rootDir/*.kts", "$rootDir/gradle/plugins/**/*.kts") - targetExclude( - "$rootDir/build/**/*.kts", - "$rootDir/gradle/plugins/build/**/*.kts", - ) - } else { - target("**/*.kts") - targetExclude( - "build/**/*.kts", - "src/test/**/*.kts", - ) - } - } -} From c564f4c87cbf99e2791fd9f06d600b92d55bf3d5 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Mon, 20 Mar 2023 14:57:19 +0300 Subject: [PATCH 38/50] updated .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 45550fe9ee..1d8b85b767 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ out/ *.swp *.sarif + +# a generated file for github action +/gradle/libs.versions.toml_snapshot From 77a8599501e955e2b8ca12ac0e4d58f491b8bbfd Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Mon, 20 Mar 2023 15:32:15 +0300 Subject: [PATCH 39/50] WIP --- diktat-gradle-plugin/build.gradle.kts | 6 ++++-- .../diktat/buildutils/GitHookInstallation.kt | 21 ------------------- .../buildutils/VersioningConfiguration.kt | 1 + .../git-hook-configuration.gradle.kts | 11 +++++++++- .../kotlin-jvm-configuration.gradle.kts | 2 +- 5 files changed, 16 insertions(+), 25 deletions(-) delete mode 100644 gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/GitHookInstallation.kt diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index d30aad45a3..762762ca07 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -88,7 +88,7 @@ val functionalTest: SourceSet = sourceSets.create("functionalTest") { compileClasspath += sourceSets.main.get().output + configurations.testRuntimeClasspath.get() runtimeClasspath += output + compileClasspath } -tasks.getByName("functionalTest") { +val functionalTestProvider: TaskProvider = tasks.named("functionalTest") { shouldRunAfter("test") testClassesDirs = functionalTest.output.classesDirs classpath = functionalTest.runtimeClasspath @@ -109,8 +109,10 @@ tasks.getByName("functionalTest") { finalizedBy(tasks.jacocoTestReport) } tasks.check { dependsOn(tasks.jacocoTestReport) } + jacocoTestKit { - applyTo("functionalTestRuntimeOnly", tasks.named("functionalTest")) + @Suppress("UNCHECKED_CAST") + applyTo("functionalTestRuntimeOnly", functionalTestProvider as TaskProvider) } tasks.jacocoTestReport { shouldRunAfter(tasks.withType()) diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/GitHookInstallation.kt b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/GitHookInstallation.kt deleted file mode 100644 index 23fb78b92c..0000000000 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/GitHookInstallation.kt +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Gradle tasks to install git hooks as a part of the build - */ - -package org.cqfn.diktat.buildutils - -import org.gradle.api.Project -import org.gradle.api.tasks.Copy -import org.gradle.kotlin.dsl.register - -/** - * Task of type [Copy] that install git hooks from directory in repo to .git directory - */ -fun Project.installGitHooks() { - val installGitHooksTask = tasks.register("installGitHooks", Copy::class) { - from(file("$rootDir/.git-hooks")) - into(file("$rootDir/.git/hooks")) - } - // add git hooks installation to build by adding it as a dependency for some common task - tasks.findByName("build")?.dependsOn(installGitHooksTask) -} diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt index 0fd6b60073..b802a42288 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt @@ -6,6 +6,7 @@ package org.cqfn.diktat.buildutils import org.ajoberstar.grgit.gradle.GrgitServiceExtension import org.ajoberstar.grgit.gradle.GrgitServicePlugin +import org.ajoberstar.reckon.core.Scope import org.ajoberstar.reckon.gradle.ReckonExtension import org.ajoberstar.reckon.gradle.ReckonPlugin import org.gradle.api.Project diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/git-hook-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/git-hook-configuration.gradle.kts index fff91b5168..530ef2ce07 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/git-hook-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/git-hook-configuration.gradle.kts @@ -1,3 +1,12 @@ package org.cqfn.diktat.buildutils -installGitHooks() +/** + * Task of type [Copy] that install git hooks from directory in repo to .git directory + */ +val installGitHooksTask = tasks.register("installGitHooks", Copy::class) { + from(file("$rootDir/.git-hooks")) + into(file("$rootDir/.git/hooks")) +} + +// add git hooks installation to build by adding it as a dependency for some common task +tasks.findByName("build")?.dependsOn(installGitHooksTask) diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts index 439367fea3..1df7b65414 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts @@ -10,7 +10,7 @@ plugins { tasks.withType { kotlinOptions { - freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn" + freeCompilerArgs = freeCompilerArgs + "-Werror -opt-in=kotlin.RequiresOptIn" } } From 03641f68fee6dc52766525912f3a5dbfb04c3808 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Wed, 22 Mar 2023 18:50:13 +0300 Subject: [PATCH 40/50] WIP --- build.gradle.kts | 4 ++ diktat-gradle-plugin/build.gradle.kts | 39 ++------------- diktat-ruleset/build.gradle.kts | 10 +--- .../ruleset/smoke/DiktatSaveSmokeTest.kt | 5 +- ...ktat-version-file-configuration.gradle.kts | 50 +++++++++++++++++++ .../kotlin-jvm-configuration.gradle.kts | 3 +- 6 files changed, 66 insertions(+), 45 deletions(-) create mode 100644 gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-version-file-configuration.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts index 2b8ebded6f..b7f21d63c7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import org.cqfn.diktat.buildutils.configureSigning + @Suppress("DSL_SCOPE_VIOLATION", "RUN_IN_SCRIPT") // https://github.com/gradle/gradle/issues/22797 plugins { id("org.cqfn.diktat.buildutils.versioning-configuration") @@ -20,3 +22,5 @@ talaiot { } project.description = "diKTat kotlin formatter and fixer" + +configureSigning() diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index 762762ca07..3338f9c19f 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -3,11 +3,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.nio.file.Files plugins { - `java-gradle-plugin` id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") id("org.cqfn.diktat.buildutils.code-quality-convention") + id("org.cqfn.diktat.buildutils.diktat-version-file-configuration") id("pl.droidsonroids.jacoco.testkit") version "1.0.9" id("org.gradle.test-retry") version "1.5.2" + id("com.gradle.plugin-publish") version "1.1.0" } dependencies { @@ -27,40 +28,14 @@ dependencies { testRuntimeOnly(libs.junit.jupiter.engine) } -val generateVersionsFile by tasks.registering { - val versionsFile = File("$buildDir/generated/src/generated/Versions.kt") - val diktatVersion = project.version.toString() - val ktlintVersion = libs.versions.ktlint.get() - - inputs.property("diktat version", diktatVersion) - inputs.property("ktlint version", ktlintVersion) - - outputs.file(versionsFile) - - doFirst { - versionsFile.parentFile.mkdirs() - versionsFile.writeText( - """ - package generated - - internal const val DIKTAT_VERSION = "$diktatVersion" - internal const val KTLINT_VERSION = "$ktlintVersion" - - """.trimIndent() - ) - } -} -kotlin.sourceSets["main"].kotlin.srcDir("$buildDir/generated/src") - tasks.withType { kotlinOptions { // fixme: kotlin 1.3 is required for gradle <6.8 languageVersion = "1.3" apiVersion = "1.3" jvmTarget = "1.8" + freeCompilerArgs = freeCompilerArgs - "-Werror" } - - dependsOn.add(generateVersionsFile) } gradlePlugin { @@ -72,10 +47,6 @@ gradlePlugin { } } -java { - withSourcesJar() -} - // === testing & code coverage, jacoco is run independent from maven val functionalTestTask by tasks.register("functionalTest") tasks.withType { @@ -131,12 +102,12 @@ tasks.register("generateLibsForDiktatSnapshot") { dependsOn(rootProject.tasks.named("publishToMavenLocal")) val libsFile = rootProject.file("gradle/libs.versions.toml") inputs.file(libsFile) - inputs.property("project-version", project.version) + inputs.property("project-version", version) Files.readAllLines(libsFile.toPath()) .map { line -> when { - line.contains("diktat = ") -> "diktat = \"${project.version}\"" + line.contains("diktat = ") -> "diktat = \"${version}\"" else -> line } } diff --git a/diktat-ruleset/build.gradle.kts b/diktat-ruleset/build.gradle.kts index a830b19dc1..8907bf287f 100644 --- a/diktat-ruleset/build.gradle.kts +++ b/diktat-ruleset/build.gradle.kts @@ -29,15 +29,7 @@ dependencies { testImplementation(libs.mockito) } -tasks.named("shadowJar") { +val shadowJar: Provider = tasks.named("shadowJar") { archiveBaseName.set("diktat") archiveClassifier.set("") } - -//publishing { -// publications { -// create("shadowJar").apply { -// project.shadow.component(this) -// } -// } -//} diff --git a/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt b/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt index 6b25b3309e..5c4725b066 100644 --- a/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt +++ b/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt @@ -27,6 +27,7 @@ import kotlin.io.path.createDirectories import kotlin.io.path.div import kotlin.io.path.exists import kotlin.io.path.listDirectoryEntries +import kotlin.io.path.name import kotlin.io.path.outputStream import kotlin.io.path.readText import kotlin.io.path.relativeTo @@ -209,7 +210,9 @@ class DiktatSaveSmokeTest : DiktatSmokeTestBase() { val diktatFrom = Path(BUILD_DIRECTORY) .takeIf(Path::exists) ?.listDirectoryEntries(FAT_JAR_GLOB) - ?.singleOrNull() + ?.singleOrNull { + !it.name.contains("ruleset") + } assertThat(diktatFrom) .describedAs(diktatFrom?.toString() ?: "$BUILD_DIRECTORY/$FAT_JAR_GLOB") .isNotNull diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-version-file-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-version-file-configuration.gradle.kts new file mode 100644 index 0000000000..fa5f3267f2 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-version-file-configuration.gradle.kts @@ -0,0 +1,50 @@ +package org.cqfn.diktat.buildutils + +import org.gradle.accessors.dm.LibrariesForLibs +import org.gradle.kotlin.dsl.getValue +import org.gradle.kotlin.dsl.kotlin +import org.gradle.kotlin.dsl.provideDelegate +import org.gradle.kotlin.dsl.registering +import org.gradle.kotlin.dsl.the +import java.io.File + +plugins { + kotlin("jvm") +} + +val ktlintVersion: String = the() + .versions + .ktlint + .get() + +val generateVersionsFile by tasks.registering { + val outputDir = File("$buildDir/generated/src") + val versionsFile = outputDir.resolve("generated/Versions.kt") + + val diktatVersion = version.toString() + + inputs.property("diktat version", diktatVersion) + inputs.property("ktlint version", ktlintVersion) + outputs.dir(outputDir) + + doFirst { + versionsFile.parentFile.mkdirs() + versionsFile.writeText( + """ + package generated + + internal const val DIKTAT_VERSION = "$diktatVersion" + internal const val KTLINT_VERSION = "$ktlintVersion" + + """.trimIndent() + ) + } +} + +kotlin.sourceSets.getByName("main") { + kotlin.srcDir( + generateVersionsFile.map { + it.outputs.files.singleFile + } + ) +} diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts index 1df7b65414..d5a2820961 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts @@ -10,7 +10,8 @@ plugins { tasks.withType { kotlinOptions { - freeCompilerArgs = freeCompilerArgs + "-Werror -opt-in=kotlin.RequiresOptIn" + freeCompilerArgs = freeCompilerArgs + + "-opt-in=kotlin.RequiresOptIn" + "-Werror" } } From a5161cda76ff5a6f1a1965777bb86dd15c1bbd04 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 23 Mar 2023 10:40:16 +0300 Subject: [PATCH 41/50] fixed shadowJar --- diktat-ruleset/build.gradle.kts | 27 ++++++++++++++++++- .../ruleset/smoke/DiktatSaveSmokeTest.kt | 4 +-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/diktat-ruleset/build.gradle.kts b/diktat-ruleset/build.gradle.kts index 8907bf287f..10f3263cd3 100644 --- a/diktat-ruleset/build.gradle.kts +++ b/diktat-ruleset/build.gradle.kts @@ -1,3 +1,4 @@ +import com.github.jengelman.gradle.plugins.shadow.ShadowExtension import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { @@ -29,7 +30,31 @@ dependencies { testImplementation(libs.mockito) } -val shadowJar: Provider = tasks.named("shadowJar") { +tasks.named("shadowJar") { archiveBaseName.set("diktat") archiveClassifier.set("") } + +// disable default jar +tasks.named("jar") { + enabled = false +} + +// it triggers shadowJar with default build +tasks { + build { + dependsOn(shadowJar) + } +} + +// it creates a publication for shadowJar +publishing { + publications { + create("shadow") { + // https://github.com/johnrengelman/shadow/issues/417#issuecomment-830668442 + project.extensions.configure { + component(this@create) + } + } + } +} diff --git a/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt b/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt index 5c4725b066..005a17077a 100644 --- a/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt +++ b/diktat-ruleset/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/DiktatSaveSmokeTest.kt @@ -210,9 +210,7 @@ class DiktatSaveSmokeTest : DiktatSmokeTestBase() { val diktatFrom = Path(BUILD_DIRECTORY) .takeIf(Path::exists) ?.listDirectoryEntries(FAT_JAR_GLOB) - ?.singleOrNull { - !it.name.contains("ruleset") - } + ?.singleOrNull() assertThat(diktatFrom) .describedAs(diktatFrom?.toString() ?: "$BUILD_DIRECTORY/$FAT_JAR_GLOB") .isNotNull From 7ad975721eebb65560c6505c34fb38c197b5365b Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 23 Mar 2023 10:48:48 +0300 Subject: [PATCH 42/50] updated detekt.yml, diktat.yml and codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 22 ++++++++++-- .github/workflows/detekt.yml | 9 +++-- .github/workflows/diktat.yml | 49 +++++++++++++-------------- 3 files changed, 49 insertions(+), 31 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 3601aaad0e..0ca1abf585 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -24,7 +24,7 @@ jobs: matrix: # Override automatic language detection by changing the below list # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] - language: ['java'] + language: ['kotlin'] # Learn more... # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection @@ -58,8 +58,24 @@ jobs: # and modify them (or add more) to build your code if your project # uses a compiled language - - run: | - mvn clean install + - uses: gradle/gradle-build-action@v2 + with: + gradle-version: wrapper + # The `--continue` flag is necessary so that Gradle keeps going after the 1st test failure. + # By default, when test for all MPP targets are executed, Kotlin Gradle Plugin generates a single aggregated HTML report. + # Property `kotlin.tests.individualTaskReports` enables individual Junit-style XML reports. + # See org.jetbrains.kotlin.gradle.testing.internal.KotlinTestReport. + arguments: | + build + --continue + -x detekt + -Pkotlin.tests.individualTaskReports=true + -Porg.gradle.caching=true + -Pdetekt.multiplatform.disabled=true + -PdisableRedundantTargets=true + -PenabledExecutables=debug + -PgprUser=${{ github.actor }} + -PgprKey=${{ secrets.GITHUB_TOKEN }} - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/detekt.yml b/.github/workflows/detekt.yml index 8b42036598..d43c342a6e 100644 --- a/.github/workflows/detekt.yml +++ b/.github/workflows/detekt.yml @@ -7,7 +7,10 @@ on: jobs: detekt_check: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest + permissions: + # required for all workflows + security-events: write steps: - uses: actions/checkout@v3 @@ -25,9 +28,9 @@ jobs: --continue -PgprUser=${{ github.actor }} -PgprKey=${{ secrets.GITHUB_TOKEN }} - - name: Upload SARIF to Github - if: ${{ always() }} + - name: Upload SARIF report to Github uses: github/codeql-action/upload-sarif@v2 + if: ${{ always() }} with: sarif_file: build/detekt-sarif-reports/detekt-merged.sarif - name: Upload SARIF artifacts diff --git a/.github/workflows/diktat.yml b/.github/workflows/diktat.yml index 9ed66e34b7..5ac6eeab5d 100644 --- a/.github/workflows/diktat.yml +++ b/.github/workflows/diktat.yml @@ -8,40 +8,39 @@ on: jobs: diktat_check: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest + permissions: + # required for all workflows + security-events: write steps: - uses: actions/checkout@v3 - with: - # set this to 0 to fetch all tags too and be able to use them later - fetch-depth: 0 - name: Set up JDK 11 uses: actions/setup-java@v3 with: java-version: 11 distribution: temurin - - name: Retrieve Kotlin version - run: | - kv=$(cat gradle/libs.versions.toml | grep '^kotlin =' | awk -F'[=]' '{print $2}' | tr -d '" ') - echo KOTLIN_VERSION=$kv >> $GITHUB_ENV - - name: Cache konan - uses: actions/cache@v3 - with: - path: ~/.konan - key: ${{ runner.os }}-gradle-konan-${{ env.KOTLIN_VERSION }} - - name: Substitute diktat config with the one from the latest release - # fixme: can be done from the fetched repo without additional network request - run: | - git fetch --tags - LATEST_TAG=$(git describe --tags --abbrev=0) - DIKTAT_CONFIG=diktat-analysis.yml - wget -O $DIKTAT_CONFIG https://raw.githubusercontent.com/saveourtool/diKTat/$LATEST_TAG/$DIKTAT_CONFIG - - name: Run diktat via gradle plugin - uses: gradle/gradle-build-action@v2 + - uses: gradle/gradle-build-action@v2 with: gradle-version: wrapper - gradle-home-cache-cleanup: true arguments: | - :diktatCheck - --scan + diktatCheck + mergeDiktatReports + -Pdiktat.githubActions=true + -Pdetekt.multiplatform.disabled=true --build-cache + --continue + -PgprUser=${{ github.actor }} + -PgprKey=${{ secrets.GITHUB_TOKEN }} + - name: Upload SARIF report to Github + uses: github/codeql-action/upload-sarif@v2 + if: ${{ always() }} + with: + sarif_file: build/reports/diktat/diktat-merged.sarif + - name: Upload SARIF artifacts + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: sarif-reports + path: "**/build/reports/diktat" + retention-days: 1 From 08620fb2831e521a34d25763a04fa800cfe475bc Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 23 Mar 2023 10:56:43 +0300 Subject: [PATCH 43/50] update diktat_snapshot.yml --- .github/workflows/diktat_snapshot.yml | 47 ++++++++++++++++----------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/.github/workflows/diktat_snapshot.yml b/.github/workflows/diktat_snapshot.yml index eb6fac62e8..744d4eb4c0 100644 --- a/.github/workflows/diktat_snapshot.yml +++ b/.github/workflows/diktat_snapshot.yml @@ -48,28 +48,37 @@ jobs: arguments: | :diktat-gradle-plugin:generateLibsForDiktatSnapshot -x detekt - -x diktat + -x diktatCheck -x test + - name: 'Override ' run: | - snapshot_version=$(printf 'VERSION=${project.version}\n0\n' | mvn help:evaluate 2>/dev/null | grep '^VERSION' | cut -d= -f2) - base_version=${snapshot_version%-SNAPSHOT} - echo "BASE_VERSION=$base_version" >> $GITHUB_ENV - mvn -B versions:set -DnewVersion=$base_version-pre - - name: Build and install - # install diktat with version 'base_version-pre' to local maven repo - run: mvn -B -Dstyle.color=always clean install -DskipTests=true --projects diktat-maven-plugin --also-make - - name: Revert project version and set proper version for diktat check - # revert project version to avoid cycle dependency - # set diktat version in plugin dependencies to the version which was built in the previous step - run: | - mvn -B versions:set -DnewVersion=${{ env.BASE_VERSION }}-SNAPSHOT - mvn -B versions:set-property -Dproperty=diktat-check.version -DnewVersion=${{ env.BASE_VERSION }}-pre - - name: Run diktat snapshot via maven plugin - run: | - mvn -B -X -Dstyle.color=always diktat:check@diktat -Ddiktat.debug=true -Ddiktat.githubActions=true - - name: Upload SARIF to Github using the upload-sarif action + mv gradle/libs.versions.toml gradle/libs.versions.toml_current + mv gradle/libs.versions.toml_snapshot gradle/libs.versions.toml + # copied from .github/workflows/diktat.yml + - uses: gradle/gradle-build-action@v2 + with: + gradle-version: wrapper + arguments: | + diktatCheck + mergeDiktatReports + -Pdiktat.githubActions=true + -Pdetekt.multiplatform.disabled=true + --build-cache + --continue + -PgprUser=${{ github.actor }} + -PgprKey=${{ secrets.GITHUB_TOKEN }} + - name: Upload SARIF report to Github uses: github/codeql-action/upload-sarif@v2 if: ${{ always() }} with: - sarif_file: ${{ github.workspace }} + sarif_file: build/reports/diktat/diktat-merged.sarif + # override category to have a different with release version + category: diktat (snapshot) + - name: Upload SARIF artifacts + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: sarif-reports + path: "**/build/reports/diktat" + retention-days: 1 From 69f3f0dad7536eac82be62611cc999a34884ea67 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 23 Mar 2023 11:02:26 +0300 Subject: [PATCH 44/50] added codecov to common build --- .github/workflows/build_and_test.yml | 11 ++++--- .github/workflows/metrics_for_master.yml | 39 ------------------------ 2 files changed, 7 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/metrics_for_master.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index cb236555ea..f25df0650c 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -248,7 +248,7 @@ jobs: with: name: JUnit Tests (${{ runner.os }}, dorny/test-reporter@v1) # Comma-separated values. - path: "**/target/*-reports/TEST-*.xml, **/build/test-results/*/TEST-*.xml" + path: "**/build/test-results/*/TEST-*.xml" reporter: java-junit # Ignore the "Resource not accessible by integration" error when a PR # originates from a non-collaborator. This is @@ -262,17 +262,20 @@ jobs: with: name: xml-test-reports-${{ runner.os }} path: | - **/target/*-reports/TEST-*.xml **/build/test-results/*/TEST-*.xml retention-days: 1 - name: Upload gradle reports - if: ${{ failure() }} + if: ${{ always() }} uses: actions/upload-artifact@v3 with: name: gradle-test-report-${{ matrix.os }} - path: 'diktat-gradle-plugin/build/reports/' + path: '**/build/reports/' retention-days: 1 + - name: Code coverage report + uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: false report: name: Publish JUnit test results diff --git a/.github/workflows/metrics_for_master.yml b/.github/workflows/metrics_for_master.yml deleted file mode 100644 index 09c83c91ed..0000000000 --- a/.github/workflows/metrics_for_master.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Update metrics for master branch - -on: - push: - branches: - - 'master' - -env: - GRADLE_OPTS: -Dorg.gradle.daemon=false - -jobs: - master_flow: - name: Master branch update - runs-on: ubuntu-18.04 - - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 11 - - name: Cache local Maven repository - uses: actions/cache@v3 - # keys are the same as in build_and_test workflow to make cache available for PRs - with: - path: ~/.m2/repository - key: maven-build-${{ hashFiles('**/pom.xml') }} - restore-keys: | - maven-build- - - name: Run tests - # we need to run `install` goal here so that gradle will be able to resolve dependencies and run tests on diktat-gradle-plugin - run: mvn -B -Dstyle.color=always install -DskipPluginMarker - - name: Generate code coverage report - uses: codecov/codecov-action@v3 - with: - files: '**/target/site/jacoco*/jacoco.xml,**/reports/jacoco/**/*.xml' - flags: unittests - fail_ci_if_error: true # optional (default = false) From 043ed6bd104cd650ab5e1fc599dfd2f3cefc80ce Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 23 Mar 2023 11:57:48 +0300 Subject: [PATCH 45/50] upgraded diktat and fixed detekt issues --- .../org/cqfn/diktat/plugin/gradle/Utils.kt | 31 ++++++++++--------- .../plugin/gradle/DiktatJavaExecTaskBase.kt | 1 + gradle/libs.versions.toml | 3 +- ...diktat-convention-configuration.gradle.kts | 4 +-- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/diktat-gradle-plugin/src/functionalTest/kotlin/org/cqfn/diktat/plugin/gradle/Utils.kt b/diktat-gradle-plugin/src/functionalTest/kotlin/org/cqfn/diktat/plugin/gradle/Utils.kt index 1a973dc9ee..76db1c642d 100644 --- a/diktat-gradle-plugin/src/functionalTest/kotlin/org/cqfn/diktat/plugin/gradle/Utils.kt +++ b/diktat-gradle-plugin/src/functionalTest/kotlin/org/cqfn/diktat/plugin/gradle/Utils.kt @@ -18,20 +18,18 @@ internal fun createExampleProject(testProjectDir: TemporaryFolder, exampleProject.copyRecursively(testProjectDir.root) val buildFileName = buildInitDsl.fileNameFor("build") File(testProjectDir.root, buildFileName).delete() - testProjectDir.newFile(buildFileName).apply { - writeText( - """ - plugins { - id("org.cqfn.diktat.diktat-gradle-plugin") - } + testProjectDir.newFile(buildFileName).writeText( + """ + plugins { + id("org.cqfn.diktat.diktat-gradle-plugin") + } - repositories { - mavenLocal() - mavenCentral() - } - """.trimIndent() - ) - } + repositories { + mavenLocal() + mavenCentral() + } + """.trimIndent() + ) } /** @@ -57,7 +55,12 @@ internal fun runDiktat(testProjectDir: TemporaryFolder, "Running gradle returned exception $ex, cause: ${ex?.cause}" } } - .getOrNull()!! + .getOrNull() + .let { + requireNotNull(it) { + "Failed to get build result from running diktat" + } + } /** * This is support for jacoco reports in tests run with gradle TestKit 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 abd9e6fccf..7c11bd46fc 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 @@ -78,6 +78,7 @@ open class DiktatJavaExecTaskBase @Inject constructor( // `main` is deprecated and replaced with `mainClass` since gradle 6.4 mainClass.set("com.pinterest.ktlint.Main") } else { + @Suppress("Deprecation") main = "com.pinterest.ktlint.Main" } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e1a86938b3..f98d588b81 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,6 @@ junit-platfrom = "1.9.1" guava = "31.1-jre" commons-cli = "1.5.0" commons-io = "2.11.0" -diktat-check = "1.2.4.2" kotlinpoet = "1.12.0" detekt = "1.22.0" dokka = "1.7.20" @@ -37,7 +36,7 @@ okio = "3.3.0" kotlinx-datetime = "0.4.0" kotlinx-coroutines = "1.6.4" assertj = "3.24.2" -diktat = "1.2.4.2" +diktat = "1.2.5" jgit = "6.5.0.202303070854-r" mockito = "5.2.0" mockito-kotlin = "4.1.0" diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-convention-configuration.gradle.kts index 74cd9f2947..d3f5d16829 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-convention-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-convention-configuration.gradle.kts @@ -1,6 +1,5 @@ package org.cqfn.diktat.buildutils -import Versions import org.cqfn.diktat.plugin.gradle.DiktatJavaExecTaskBase plugins { @@ -24,6 +23,7 @@ diktat { tasks.withType().configureEach { javaLauncher.set(project.extensions.getByType().launcherFor { - languageVersion.set(JavaLanguageVersion.of(Versions.jdk)) + // a temporary workaround -- diktat-gradle-plugin doesn't detect java version of `javaLauncher` + languageVersion.set(JavaLanguageVersion.of(11)) }) } From 2437a7f925ed4ac598ebe6129a3756a6f670bf73 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 23 Mar 2023 15:09:12 +0300 Subject: [PATCH 46/50] setup snapshot diktat check --- .github/workflows/diktat_snapshot.yml | 7 +- build.gradle.kts | 81 +++++++++++++++++++ diktat-common/build.gradle.kts | 1 + diktat-gradle-plugin/build.gradle.kts | 23 +----- diktat-maven-plugin/build.gradle.kts | 1 + diktat-rules/build.gradle.kts | 1 + diktat-ruleset/build.gradle.kts | 1 + gradle/plugins/build.gradle.kts | 7 ++ .../buildutils/VersioningConfiguration.kt | 1 - .../git-hook-configuration.gradle.kts | 4 +- .../kotlin-jvm-configuration.gradle.kts | 1 - ...g-signing-default-configuration.gradle.kts | 21 +++++ settings.gradle.kts | 15 +++- 13 files changed, 139 insertions(+), 25 deletions(-) create mode 100644 gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/publishing-signing-default-configuration.gradle.kts diff --git a/.github/workflows/diktat_snapshot.yml b/.github/workflows/diktat_snapshot.yml index 744d4eb4c0..b3c2b3abda 100644 --- a/.github/workflows/diktat_snapshot.yml +++ b/.github/workflows/diktat_snapshot.yml @@ -46,7 +46,10 @@ jobs: with: gradle-version: wrapper arguments: | - :diktat-gradle-plugin:generateLibsForDiktatSnapshot + :diktat-common:publishToMavenLocal + :diktat-rules:publishToMavenLocal + :diktat-gradle-plugin:publishToMavenLocal + :generateLibsForDiktatSnapshot -x detekt -x diktatCheck -x test @@ -54,7 +57,7 @@ jobs: - name: 'Override ' run: | mv gradle/libs.versions.toml gradle/libs.versions.toml_current - mv gradle/libs.versions.toml_snapshot gradle/libs.versions.toml + mv build/diktat-snapshot/libs.versions.toml_snapshot gradle/libs.versions.toml # copied from .github/workflows/diktat.yml - uses: gradle/gradle-build-action@v2 with: diff --git a/build.gradle.kts b/build.gradle.kts index b7f21d63c7..5aa39ce7d0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,6 @@ import org.cqfn.diktat.buildutils.configureSigning +import org.jetbrains.kotlin.incremental.createDirectory +import java.nio.file.Files @Suppress("DSL_SCOPE_VIOLATION", "RUN_IN_SCRIPT") // https://github.com/gradle/gradle/issues/22797 plugins { @@ -8,6 +10,7 @@ plugins { id("org.cqfn.diktat.buildutils.publishing-configuration") alias(libs.plugins.talaiot.base) java + `maven-publish` } talaiot { @@ -24,3 +27,81 @@ talaiot { project.description = "diKTat kotlin formatter and fixer" configureSigning() + +tasks.create("generateLibsForDiktatSnapshot") { + val dir = rootProject.buildDir.resolve("diktat-snapshot") + + val dependencies = setOf( + projects.diktatCommon, + projects.diktatRules, + projects.diktatGradlePlugin, + ) + mustRunAfter(dependencies.map { ":${it.name}:publishToMavenLocal" }) + val libsFile = rootProject.file("gradle/libs.versions.toml") + + inputs.file(libsFile) + inputs.files(dependencies.map { it.pomFile() }) + inputs.files(dependencies.map { it.artifactFile() }) + inputs.property("project-version", version.toString()) + outputs.dir(dir) + + doFirst { + dir.deleteRecursively() + dir.createDirectory() + } + doLast { + Files.readAllLines(libsFile.toPath()) + .map { line -> + when { + line.contains("diktat = ") -> "diktat = \"$version\"" + else -> line + } + } + .let { + val libsFileForDiktatSnapshot = dir.resolve("libs.versions.toml_snapshot") + Files.write(libsFileForDiktatSnapshot.toPath(), it) + } + + dependencies.forEach { dependency -> + val artifactDir = dir.pathToMavenArtifact(dependency) + .also { it.createDirectory() } + Files.copy(dependency.pomFile().toPath(), artifactDir.resolve(dependency.pomFileName()).toPath()) + Files.copy(dependency.artifactFile().toPath(), artifactDir.resolve(dependency.artifactFileName()).toPath()) + } + } +} + +/** + * @return resolved path to directory according to maven coordinate + */ +fun File.pathToMavenArtifact(projectDependency: ProjectDependency): File = projectDependency.group.toString() + .split(".") + .fold(this) { dirToArtifact, newPart -> dirToArtifact.resolve(newPart) } + .resolve(projectDependency.name) + .resolve(projectDependency.version.toString()) + +/** + * @return generated pom.xml for project dependency + */ +fun ProjectDependency.pomFile(): File = rootProject.file("$name/build/publications/") + .let { publicationsDir -> + publicationsDir.resolve("pluginMaven") + .takeIf { it.exists() } + ?: publicationsDir.resolve("maven") + } + .resolve("pom-default.xml") + +/** + * @return file name of pom.xml for project dependency + */ +fun ProjectDependency.pomFileName(): String = "$name-$version.pom" + +/** + * @return generated artifact for project dependency + */ +fun ProjectDependency.artifactFile(): File = rootProject.file("$name/build/libs/$name-$version.jar") + +/** + * @return file name of artifact for project dependency + */ +fun ProjectDependency.artifactFileName(): String = "$name-$version.jar" diff --git a/diktat-common/build.gradle.kts b/diktat-common/build.gradle.kts index d3b4cd3a17..3dd6061bcc 100644 --- a/diktat-common/build.gradle.kts +++ b/diktat-common/build.gradle.kts @@ -2,6 +2,7 @@ plugins { id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") id("org.cqfn.diktat.buildutils.code-quality-convention") + id("org.cqfn.diktat.buildutils.publishing-signing-default-configuration") alias(libs.plugins.kotlin.plugin.serialization) } diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index 3338f9c19f..17b97d0feb 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -1,6 +1,6 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import java.nio.file.Files +import org.cqfn.diktat.buildutils.configureSigning plugins { id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") @@ -59,6 +59,8 @@ val functionalTest: SourceSet = sourceSets.create("functionalTest") { compileClasspath += sourceSets.main.get().output + configurations.testRuntimeClasspath.get() runtimeClasspath += output + compileClasspath } + +@Suppress("GENERIC_VARIABLE_WRONG_DECLARATION") val functionalTestProvider: TaskProvider = tasks.named("functionalTest") { shouldRunAfter("test") testClassesDirs = functionalTest.output.classesDirs @@ -98,21 +100,4 @@ tasks.jacocoTestReport { } } -tasks.register("generateLibsForDiktatSnapshot") { - dependsOn(rootProject.tasks.named("publishToMavenLocal")) - val libsFile = rootProject.file("gradle/libs.versions.toml") - inputs.file(libsFile) - inputs.property("project-version", version) - - Files.readAllLines(libsFile.toPath()) - .map { line -> - when { - line.contains("diktat = ") -> "diktat = \"${version}\"" - else -> line - } - } - .let { - val libsFileForDiktatSnapshot = rootProject.file("gradle/libs.versions.toml_snapshot") - Files.write(libsFileForDiktatSnapshot.toPath(), it) - } -} +configureSigning() diff --git a/diktat-maven-plugin/build.gradle.kts b/diktat-maven-plugin/build.gradle.kts index 9dcdbd19fa..ba822027cb 100644 --- a/diktat-maven-plugin/build.gradle.kts +++ b/diktat-maven-plugin/build.gradle.kts @@ -4,6 +4,7 @@ import de.benediktritter.maven.plugin.development.task.GenerateMavenPluginDescri plugins { id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") id("org.cqfn.diktat.buildutils.code-quality-convention") + id("org.cqfn.diktat.buildutils.publishing-configuration") id("de.benediktritter.maven-plugin-development") version "0.4.1" `maven-publish` } diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index cb0ab35811..5911cd2495 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -4,6 +4,7 @@ import java.time.LocalDate plugins { id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") id("org.cqfn.diktat.buildutils.code-quality-convention") + id("org.cqfn.diktat.buildutils.publishing-signing-default-configuration") id("com.google.devtools.ksp") version "1.8.10-1.0.9" idea } diff --git a/diktat-ruleset/build.gradle.kts b/diktat-ruleset/build.gradle.kts index 10f3263cd3..e5f043e33a 100644 --- a/diktat-ruleset/build.gradle.kts +++ b/diktat-ruleset/build.gradle.kts @@ -4,6 +4,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") id("org.cqfn.diktat.buildutils.code-quality-convention") + id("org.cqfn.diktat.buildutils.publishing-configuration") id("com.github.johnrengelman.shadow") version "7.1.2" `maven-publish` } diff --git a/gradle/plugins/build.gradle.kts b/gradle/plugins/build.gradle.kts index 2d9ac0c176..e51ffc142a 100644 --- a/gradle/plugins/build.gradle.kts +++ b/gradle/plugins/build.gradle.kts @@ -5,6 +5,13 @@ plugins { } repositories { + file("$rootDir/../../build/diktat-snapshot") + .takeIf { it.exists() } + ?.run { + maven { + url = this@run.toURI() + } + } mavenCentral() gradlePluginPortal() } diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt index b802a42288..0fd6b60073 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/VersioningConfiguration.kt @@ -6,7 +6,6 @@ package org.cqfn.diktat.buildutils import org.ajoberstar.grgit.gradle.GrgitServiceExtension import org.ajoberstar.grgit.gradle.GrgitServicePlugin -import org.ajoberstar.reckon.core.Scope import org.ajoberstar.reckon.gradle.ReckonExtension import org.ajoberstar.reckon.gradle.ReckonPlugin import org.gradle.api.Project diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/git-hook-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/git-hook-configuration.gradle.kts index 530ef2ce07..33882d3f25 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/git-hook-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/git-hook-configuration.gradle.kts @@ -9,4 +9,6 @@ val installGitHooksTask = tasks.register("installGitHooks", Copy::class) { } // add git hooks installation to build by adding it as a dependency for some common task -tasks.findByName("build")?.dependsOn(installGitHooksTask) +run { + tasks.findByName("build")?.dependsOn(installGitHooksTask) +} diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts index d5a2820961..e844ca9b75 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/kotlin-jvm-configuration.gradle.kts @@ -1,7 +1,6 @@ package org.cqfn.diktat.buildutils import org.gradle.api.tasks.testing.Test -import org.gradle.kotlin.dsl.* import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/publishing-signing-default-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/publishing-signing-default-configuration.gradle.kts new file mode 100644 index 0000000000..d53e3a5ad6 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/publishing-signing-default-configuration.gradle.kts @@ -0,0 +1,21 @@ +package org.cqfn.diktat.buildutils + +import org.gradle.api.publish.maven.MavenPublication +import org.gradle.kotlin.dsl.create +import org.gradle.kotlin.dsl.get + +plugins { + id("org.cqfn.diktat.buildutils.publishing-configuration") +} + +run { + publishing { + publications { + create("maven") { + from(components["java"]) + } + } + } + + configureSigning() +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 1d58167b9f..706f7906d4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,13 +2,26 @@ rootProject.name = "diktat" dependencyResolutionManagement { repositories { + file("$rootDir/build/diktat-snapshot") + .takeIf { it.exists() } + ?.run { + maven { + url = this@run.toURI() + } + } mavenCentral() } } pluginManagement { repositories { - mavenLocal() + file("$rootDir/build/diktat-snapshot") + .takeIf { it.exists() } + ?.run { + maven { + url = this@run.toURI() + } + } mavenCentral() gradlePluginPortal() } From 3f9294e6ed7d19a778d801ed16146f51ed9a4505 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 23 Mar 2023 15:27:06 +0300 Subject: [PATCH 47/50] diktatFix --- .github/workflows/diktat_snapshot.yml | 9 +++++---- build.gradle.kts | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/diktat_snapshot.yml b/.github/workflows/diktat_snapshot.yml index b3c2b3abda..6ab4b7e62f 100644 --- a/.github/workflows/diktat_snapshot.yml +++ b/.github/workflows/diktat_snapshot.yml @@ -6,13 +6,13 @@ on: pull_request: branches: [ master ] -env: - GRADLE_OPTS: -Dorg.gradle.daemon=false - jobs: diktat_snapshot_check: name: 'Check the project using diktat snapshot plugin' runs-on: ubuntu-latest + permissions: + # required for all workflows + security-events: write steps: - uses: actions/checkout@v3 @@ -26,8 +26,8 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v3 with: - distribution: zulu java-version: 11 + distribution: temurin - name: 'Cache ~/.konan' id: cache-konan @@ -58,6 +58,7 @@ jobs: run: | mv gradle/libs.versions.toml gradle/libs.versions.toml_current mv build/diktat-snapshot/libs.versions.toml_snapshot gradle/libs.versions.toml + # copied from .github/workflows/diktat.yml - uses: gradle/gradle-build-action@v2 with: diff --git a/build.gradle.kts b/build.gradle.kts index 5aa39ce7d0..f4c6c56c5c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -72,6 +72,7 @@ tasks.create("generateLibsForDiktatSnapshot") { } /** + * @param projectDependency * @return resolved path to directory according to maven coordinate */ fun File.pathToMavenArtifact(projectDependency: ProjectDependency): File = projectDependency.group.toString() From f260fe314b2567633e12524602ea455cc9243954 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 23 Mar 2023 15:46:49 +0300 Subject: [PATCH 48/50] diktatFix --- diktat-gradle-plugin/build.gradle.kts | 4 ++-- .../buildutils/diktat-convention-configuration.gradle.kts | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts index 17b97d0feb..2fc6a6626e 100644 --- a/diktat-gradle-plugin/build.gradle.kts +++ b/diktat-gradle-plugin/build.gradle.kts @@ -1,6 +1,6 @@ +import org.cqfn.diktat.buildutils.configureSigning import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.cqfn.diktat.buildutils.configureSigning plugins { id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") @@ -60,7 +60,7 @@ val functionalTest: SourceSet = sourceSets.create("functionalTest") { runtimeClasspath += output + compileClasspath } -@Suppress("GENERIC_VARIABLE_WRONG_DECLARATION") +@Suppress("GENERIC_VARIABLE_WRONG_DECLARATION", "MAGIC_NUMBER") val functionalTestProvider: TaskProvider = tasks.named("functionalTest") { shouldRunAfter("test") testClassesDirs = functionalTest.output.classesDirs diff --git a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-convention-configuration.gradle.kts b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-convention-configuration.gradle.kts index d3f5d16829..49bf317b0e 100644 --- a/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-convention-configuration.gradle.kts +++ b/gradle/plugins/src/main/kotlin/org/cqfn/diktat/buildutils/diktat-convention-configuration.gradle.kts @@ -16,7 +16,12 @@ diktat { exclude("gradle/plugins/build/**") } else { include("src/**/*.kt", "**/*.kts") - exclude("src/test/**/*.kt", "src/*Test/**/*.kt") + exclude( + "src/test/**/*.kt", + "src/test/**/*.kts", + "src/*Test/**/*.kt", + "build/**/*.kts", + ) } } } From 327f07bb2e52e7b245bb187f8d251d040c075f65 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 23 Mar 2023 15:55:19 +0300 Subject: [PATCH 49/50] fixed a path to artifact of diktat-*.jar --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index f25df0650c..981a3fae74 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -61,7 +61,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: diktat-ruleset - path: diktat-ruleset/target/diktat-*.jar + path: diktat-ruleset/build/libs/diktat-*.jar # no need to store artifact longer, it is used only by dependant jobs retention-days: 1 - name: Code coverage report From 289ed172164e9574f3bf643e7ad55bc0054f67b8 Mon Sep 17 00:00:00 2001 From: Nariman Abdullin Date: Thu, 23 Mar 2023 17:20:46 +0300 Subject: [PATCH 50/50] supported changes after merge --- diktat-rules/build.gradle.kts | 39 ----------------------------------- 1 file changed, 39 deletions(-) diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index 5911cd2495..cde215dbc4 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -1,6 +1,3 @@ -import java.nio.file.Files -import java.time.LocalDate - plugins { id("org.cqfn.diktat.buildutils.kotlin-jvm-configuration") id("org.cqfn.diktat.buildutils.code-quality-convention") @@ -38,42 +35,6 @@ kotlin { } } -val updateCopyrightYearInTestTaskProvider = tasks.register("updateCopyrightYearInTest") { - val headerDir = "$projectDir/src/test/resources/test/paragraph2/header" - inputs.dir(headerDir) - outputs.dir(headerDir) - - val hyphenRegex = Regex("""\d+-\d+""") - val afterCopyrightRegex = Regex("""((©|\([cC]\))+ *\d+)""") - val curYear = LocalDate.now().year - fileTree(headerDir) - .filter { !it.name.contains("CopyrightDifferentYearTest.kt") } - .map { it.toPath() } - .forEach { file -> - val updatedLines = Files.readAllLines(file).map { line -> - when { - line.contains(hyphenRegex) -> line.replace(hyphenRegex) { - val years = it.value.split("-") - "${years[0]}-$curYear" - } - line.contains(afterCopyrightRegex) -> line.replace(afterCopyrightRegex) { - val copyrightYears = it.value.split("(c)", "(C)", "©") - "${copyrightYears[0]}-$curYear" - } - else -> line - } - } - val tempFile = temporaryDir.toPath().resolve(file.fileName) - Files.write(tempFile, updatedLines) - Files.delete(file) - Files.move(tempFile, file) - } -} - -tasks.named("compileTestKotlin") { - dependsOn(updateCopyrightYearInTestTaskProvider) -} - idea { module { // Not using += due to https://github.com/gradle/gradle/issues/8749