Repository: analysis-dev/diktat (kotlin)

Issue:
Add enable/disable configuration for debug logging in diktat and ktlint
Now it is awful:
```
if (debug) {
}
```

Pull request description:
* Fix `user.home` for diktat gradle plugin (attempt 2)
* Move log4j into scope `test` (diktat-common, diktat-rules)
* Remove deprecated properties of `DiktatExtension`
* Bump default version of diktat-rules in build.gradle.kts

Apparently ktlint still uses `--debug` option and we can keep it in our plugins for compatibility

There is no need for us to have logging implementation in dependencies: for CLI it's now provided by ktlint (they depend on logback) and specific config should be provided with the launch command; for maven and gradle plugins there is a logger provided by the build tool itself.

This pull request closes #76, closes #1269

Patch:
diff --git a/diktat-common/pom.xml b/diktat-common/pom.xml
index bae48e52b5..bfaac03c23 100644
--- a/diktat-common/pom.xml
+++ b/diktat-common/pom.xml
@@ -38,10 +38,12 @@
         <dependency>
             <groupId>org.apache.logging.log4j</groupId>
             <artifactId>log4j-core</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.logging.log4j</groupId>
             <artifactId>log4j-slf4j-impl</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
diff --git a/diktat-gradle-plugin/build.gradle.kts b/diktat-gradle-plugin/build.gradle.kts
index 3c579aa3ef..6e052c2052 100644
--- a/diktat-gradle-plugin/build.gradle.kts
+++ b/diktat-gradle-plugin/build.gradle.kts
@@ -28,7 +28,7 @@ repositories {
 
 // 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.43.0") as String
-val diktatVersion = project.version.takeIf { it.toString() != Project.DEFAULT_VERSION } ?: "0.5.2"
+val diktatVersion = project.version.takeIf { it.toString() != Project.DEFAULT_VERSION } ?: "1.1.0"
 val junitVersion = project.properties.getOrDefault("junitVersion", "5.8.1") as String
 val jacocoVersion = project.properties.getOrDefault("jacocoVersion", "0.8.7") as String
 dependencies {
diff --git a/diktat-gradle-plugin/src/main/kotlin/org/cqfn/diktat/plugin/gradle/DiktatExtension.kt b/diktat-gradle-plugin/src/main/kotlin/org/cqfn/diktat/plugin/gradle/DiktatExtension.kt
index b2fcd797fa..48595df852 100644
--- a/diktat-gradle-plugin/src/main/kotlin/org/cqfn/diktat/plugin/gradle/DiktatExtension.kt
+++ b/diktat-gradle-plugin/src/main/kotlin/org/cqfn/diktat/plugin/gradle/DiktatExtension.kt
@@ -1,6 +1,5 @@
 package org.cqfn.diktat.plugin.gradle
 
-import org.gradle.api.file.FileCollection
 import org.gradle.api.tasks.InputFile
 import org.gradle.api.tasks.PathSensitive
 import org.gradle.api.tasks.PathSensitivity
@@ -40,18 +39,6 @@ open class DiktatExtension(
      */
     var output: String = ""
 
-    /**
-     * Paths that will be excluded from diktat run
-     */
-    @Deprecated("Configuration via inputs/excludes is unsupported, use inputs(Action)")
-    var excludes: FileCollection? = null
-
-    /**
-     * Paths that will be scanned for .kt(s) files
-     */
-    @Deprecated("Configuration via inputs/excludes is unsupported, use inputs(Action)")
-    var inputs: FileCollection? = null
-
     /**
      * Baseline file, containing a list of errors that will be ignored.
      * If this file doesn't exist, it will be created on the first invocation.
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 249936dfc4..ff4f7aaa65 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
@@ -63,14 +63,6 @@ open class DiktatJavaExecTaskBase @Inject constructor(
     @get:PathSensitive(PathSensitivity.RELATIVE)
     @get:InputFiles
     val actualInputs: FileCollection by lazy {
-        with(diktatExtension) {
-            // validate configuration
-            require(inputs == null && excludes == null) {
-                "`inputs` and `excludes` arguments for diktat task are deprecated and now should be changed for `inputs {}` " +
-                        "with configuration for PatternFilterable. Please check https://github.com/analysis-dev/diktat/README.md for more info."
-            }
-        }
-
         if (inputs.includes.isEmpty() && inputs.excludes.isEmpty()) {
             inputs.include("src/**/*.kt")
         }
@@ -192,7 +184,7 @@ open class DiktatJavaExecTaskBase @Inject constructor(
         // githubActions should have higher priority than a custom input
         if (diktatExtension.githubActions) {
             // need to set user.home specially for ktlint, so it will be able to put a relative path URI in SARIF
-            systemProperty("user.home", project.projectDir.toString())
+            systemProperty("user.home", project.rootDir.toString())
             reporterFlag = "--reporter=sarif"
         }
 
diff --git a/diktat-rules/pom.xml b/diktat-rules/pom.xml
index 17b120b2a3..d99c981099 100644
--- a/diktat-rules/pom.xml
+++ b/diktat-rules/pom.xml
@@ -57,10 +57,12 @@
         <dependency>
             <groupId>org.apache.logging.log4j</groupId>
             <artifactId>log4j-core</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.logging.log4j</groupId>
             <artifactId>log4j-slf4j-impl</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>


Test patch:
diff --git a/diktat-common/src/main/resources/log4j2.properties b/diktat-common/src/test/resources/log4j2.properties
similarity index 100%
rename from diktat-common/src/main/resources/log4j2.properties
rename to diktat-common/src/test/resources/log4j2.properties
diff --git a/diktat-rules/src/main/resources/log4j2.properties b/diktat-rules/src/test/resources/log4j2.properties
similarity index 100%
rename from diktat-rules/src/main/resources/log4j2.properties
rename to diktat-rules/src/test/resources/log4j2.properties