From 6fd809641ceb2381a43578058e3ffd1e9e567271 Mon Sep 17 00:00:00 2001 From: DrAlexD Date: Tue, 19 Dec 2023 11:59:27 +0300 Subject: [PATCH] Updated examples for diktat release 2.0.0 ### What's done: - updated examples. --- examples/gradle-groovy-dsl/build.gradle | 2 +- .../src/main/kotlin/AnotherTest.kt | 15 +++++++++++++++ .../gradle-groovy-dsl/src/main/kotlin/Test.kt | 12 ++++++------ .../backend/build.gradle.kts | 2 +- .../backend/src/main/kotlin/AnotherTest.kt | 15 +++++++++++++++ .../backend/src/main/kotlin/Test.kt | 14 +++++++------- .../build.gradle.kts | 4 ++-- examples/gradle-kotlin-dsl/build.gradle.kts | 2 +- .../backend/src/main/kotlin/AnotherTest.kt | 15 +++++++++++++++ .../backend/src/main/kotlin/{Main.kt => Test.kt} | 0 .../frontend/src/main/kotlin/AnotherMain.kt | 13 ------------- examples/maven-multiproject/pom.xml | 9 +++------ examples/maven/pom.xml | 5 ++--- examples/maven/src/main/kotlin/AnotherTest.kt | 15 +++++++++++++++ examples/maven/src/main/kotlin/Test.kt | 12 ++++++------ 15 files changed, 89 insertions(+), 46 deletions(-) create mode 100644 examples/gradle-groovy-dsl/src/main/kotlin/AnotherTest.kt create mode 100644 examples/gradle-kotlin-dsl-multiproject/backend/src/main/kotlin/AnotherTest.kt create mode 100644 examples/maven-multiproject/backend/src/main/kotlin/AnotherTest.kt rename examples/maven-multiproject/backend/src/main/kotlin/{Main.kt => Test.kt} (100%) delete mode 100644 examples/maven-multiproject/frontend/src/main/kotlin/AnotherMain.kt create mode 100644 examples/maven/src/main/kotlin/AnotherTest.kt diff --git a/examples/gradle-groovy-dsl/build.gradle b/examples/gradle-groovy-dsl/build.gradle index bd9acd3387..d5929b75c8 100644 --- a/examples/gradle-groovy-dsl/build.gradle +++ b/examples/gradle-groovy-dsl/build.gradle @@ -1,5 +1,5 @@ plugins { - id "com.saveourtool.diktat.diktat-gradle-plugin" version "1.2.5" + id("com.saveourtool.diktat") version "2.0.0" } repositories { diff --git a/examples/gradle-groovy-dsl/src/main/kotlin/AnotherTest.kt b/examples/gradle-groovy-dsl/src/main/kotlin/AnotherTest.kt new file mode 100644 index 0000000000..f694d51893 --- /dev/null +++ b/examples/gradle-groovy-dsl/src/main/kotlin/AnotherTest.kt @@ -0,0 +1,15 @@ +package whate.ver + +fun String.createPluginConfig() { + val pluginConfig = TomlDecoder.decode( + serializer(), + fakeFileNode, + DecoderConf() + ) + pluginConfig.configLocation = this.toPath() + pluginConfig.prop1 = property1 + // comment1 + pluginConfig.configLocation2 = this.toPath() + // comment2 + pluginConfig.prop2 = property2 +} diff --git a/examples/gradle-groovy-dsl/src/main/kotlin/Test.kt b/examples/gradle-groovy-dsl/src/main/kotlin/Test.kt index 22c0f205f5..a6908961a8 100644 --- a/examples/gradle-groovy-dsl/src/main/kotlin/Test.kt +++ b/examples/gradle-groovy-dsl/src/main/kotlin/Test.kt @@ -2,12 +2,12 @@ package incorrect class incorrectname: Exception() { fun INCORRECT_FUNCTION() { - throw Exception() - } - - // fun myCommentedFunction() { - // } + throw Exception() + } -val Incorrect_Val = 5 + // fun myCommentedFunction() { + // } + + val Incorrect_Val = 5 } diff --git a/examples/gradle-kotlin-dsl-multiproject/backend/build.gradle.kts b/examples/gradle-kotlin-dsl-multiproject/backend/build.gradle.kts index 8990dfba43..d6761c7188 100644 --- a/examples/gradle-kotlin-dsl-multiproject/backend/build.gradle.kts +++ b/examples/gradle-kotlin-dsl-multiproject/backend/build.gradle.kts @@ -1,4 +1,4 @@ plugins { kotlin("jvm") - id("com.saveourtool.diktat.diktat-gradle-plugin") + id("com.saveourtool.diktat") version "2.0.0" } diff --git a/examples/gradle-kotlin-dsl-multiproject/backend/src/main/kotlin/AnotherTest.kt b/examples/gradle-kotlin-dsl-multiproject/backend/src/main/kotlin/AnotherTest.kt new file mode 100644 index 0000000000..f694d51893 --- /dev/null +++ b/examples/gradle-kotlin-dsl-multiproject/backend/src/main/kotlin/AnotherTest.kt @@ -0,0 +1,15 @@ +package whate.ver + +fun String.createPluginConfig() { + val pluginConfig = TomlDecoder.decode( + serializer(), + fakeFileNode, + DecoderConf() + ) + pluginConfig.configLocation = this.toPath() + pluginConfig.prop1 = property1 + // comment1 + pluginConfig.configLocation2 = this.toPath() + // comment2 + pluginConfig.prop2 = property2 +} diff --git a/examples/gradle-kotlin-dsl-multiproject/backend/src/main/kotlin/Test.kt b/examples/gradle-kotlin-dsl-multiproject/backend/src/main/kotlin/Test.kt index 80975f0974..a6908961a8 100644 --- a/examples/gradle-kotlin-dsl-multiproject/backend/src/main/kotlin/Test.kt +++ b/examples/gradle-kotlin-dsl-multiproject/backend/src/main/kotlin/Test.kt @@ -1,13 +1,13 @@ package incorrect -class incorrectname: Exception { - fun INCORRECT_FUNCTION() { - throw Exception() - } +class incorrectname: Exception() { + fun INCORRECT_FUNCTION() { + throw Exception() + } - // fun myCommentedFunction() { - // } + // fun myCommentedFunction() { + // } - val Incorrect_Val = 5 + val Incorrect_Val = 5 } diff --git a/examples/gradle-kotlin-dsl-multiproject/build.gradle.kts b/examples/gradle-kotlin-dsl-multiproject/build.gradle.kts index 48df7edf2f..3d8e2a8018 100644 --- a/examples/gradle-kotlin-dsl-multiproject/build.gradle.kts +++ b/examples/gradle-kotlin-dsl-multiproject/build.gradle.kts @@ -2,7 +2,7 @@ import com.saveourtool.diktat.plugin.gradle.DiktatExtension plugins { kotlin("jvm") version "1.9.21" - id("com.saveourtool.diktat.diktat-gradle-plugin") + id("com.saveourtool.diktat") version "2.0.0" } allprojects { @@ -10,7 +10,7 @@ allprojects { mavenLocal() mavenCentral() } - apply(plugin = "com.saveourtool.diktat.diktat-gradle-plugin") + apply(plugin = "com.saveourtool.diktat") configure { diktatConfigFile = rootProject.file("diktat-analysis.yml") inputs { include("src/**/*.kt") } diff --git a/examples/gradle-kotlin-dsl/build.gradle.kts b/examples/gradle-kotlin-dsl/build.gradle.kts index be4038109d..38717360ae 100644 --- a/examples/gradle-kotlin-dsl/build.gradle.kts +++ b/examples/gradle-kotlin-dsl/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("com.saveourtool.diktat.diktat-gradle-plugin") version "1.2.5" + id("com.saveourtool.diktat") version "2.0.0" } repositories { diff --git a/examples/maven-multiproject/backend/src/main/kotlin/AnotherTest.kt b/examples/maven-multiproject/backend/src/main/kotlin/AnotherTest.kt new file mode 100644 index 0000000000..f694d51893 --- /dev/null +++ b/examples/maven-multiproject/backend/src/main/kotlin/AnotherTest.kt @@ -0,0 +1,15 @@ +package whate.ver + +fun String.createPluginConfig() { + val pluginConfig = TomlDecoder.decode( + serializer(), + fakeFileNode, + DecoderConf() + ) + pluginConfig.configLocation = this.toPath() + pluginConfig.prop1 = property1 + // comment1 + pluginConfig.configLocation2 = this.toPath() + // comment2 + pluginConfig.prop2 = property2 +} diff --git a/examples/maven-multiproject/backend/src/main/kotlin/Main.kt b/examples/maven-multiproject/backend/src/main/kotlin/Test.kt similarity index 100% rename from examples/maven-multiproject/backend/src/main/kotlin/Main.kt rename to examples/maven-multiproject/backend/src/main/kotlin/Test.kt diff --git a/examples/maven-multiproject/frontend/src/main/kotlin/AnotherMain.kt b/examples/maven-multiproject/frontend/src/main/kotlin/AnotherMain.kt deleted file mode 100644 index c350958f09..0000000000 --- a/examples/maven-multiproject/frontend/src/main/kotlin/AnotherMain.kt +++ /dev/null @@ -1,13 +0,0 @@ -package incorrect - -class anotherincorrectname: Exception() { - fun ANOTHER_INCORRECT_FUNCTION() { - throw Exception() - } - - // fun anotherCommentedFunction() { - // } - - val Another_Incorrect_Val = 5 - -} diff --git a/examples/maven-multiproject/pom.xml b/examples/maven-multiproject/pom.xml index aaa5d6d39d..e768c10598 100644 --- a/examples/maven-multiproject/pom.xml +++ b/examples/maven-multiproject/pom.xml @@ -3,12 +3,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.saveourtool.diktat - diktat-examples-maven + diktat-examples-maven-multiproject pom - 1.2.6-SNAPSHOT + 2.0.0-SNAPSHOT - 1.2.5 + 2.0.0