From ea318afea98108164bd95d2e2d19804b54c3faa7 Mon Sep 17 00:00:00 2001 From: Andrey Shcheglov Date: Fri, 27 May 2022 14:03:42 +0300 Subject: [PATCH 1/5] Rename `s/analysis-dev/saveourtool/g` in URLs ### What's done: * URLs (incl. those from badges) have been corrected to accommodate for the organization name change. --- README.md | 2 +- .../org/cqfn/diktat/plugin/gradle/DiktatJavaExecTaskBase.kt | 2 +- .../cqfn/diktat/ruleset/rules/chapter3/files/NewlinesRule.kt | 2 +- .../org/cqfn/diktat/ruleset/rules/chapter4/SmartCastRule.kt | 2 +- .../org/cqfn/diktat/ruleset/chapter4/SmartCastRuleWarnTest.kt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e07e3518fb..f2e5a8a7b2 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![Build and test](https://github.com/cqfn/diKTat/workflows/Build%20and%20test/badge.svg) ![deteKT static analysis](https://github.com/cqfn/diKTat/workflows/Run%20deteKT/badge.svg) ![diKTat code style](https://github.com/cqfn/diKTat/workflows/Run%20diKTat%20from%20release%20version/badge.svg?branch=master) -[![codecov](https://codecov.io/gh/analysis-dev/diKTat/branch/master/graph/badge.svg)](https://codecov.io/gh/analysis-dev/diKTat) +[![codecov](https://codecov.io/gh/saveourtool/diKTat/branch/master/graph/badge.svg)](https://codecov.io/gh/saveourtool/diKTat) [![Releases](https://img.shields.io/github/v/release/cqfn/diKTat)](https://github.com/cqfn/diKTat/releases) [![Maven Central](https://img.shields.io/maven-central/v/org.cqfn.diktat/diktat-rules)](https://mvnrepository.com/artifact/org.cqfn.diktat) 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 ff4f7aaa65..ac58b5c39e 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 @@ -219,7 +219,7 @@ open class DiktatJavaExecTaskBase @Inject constructor( val javaVersion = getJavaExecJvmVersion() project.logger.debug("For diktat execution jvm version $javaVersion will be used") if (javaVersion.majorVersion.toInt() >= MIN_JVM_REQUIRES_ADD_OPENS) { - // https://github.com/analysis-dev/diktat/issues/1182#issuecomment-1023099713 + // https://github.com/saveourtool/diktat/issues/1182#issuecomment-1023099713 project.logger.debug("Adding `--add-opens` flag for JVM version >=$MIN_JVM_REQUIRES_ADD_OPENS compatibility") jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED") } diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/NewlinesRule.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/NewlinesRule.kt index 9f4dc6c7c1..fd9719da36 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/NewlinesRule.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/files/NewlinesRule.kt @@ -220,7 +220,7 @@ class NewlinesRule(configRules: List) : DiktatRule( private fun checkForComplexExpression(node: ASTNode) { if (node.getRootNode().getFilePath().isGradleScript()) { - // this inspection is softened for gradle scripts, see https://github.com/analysis-dev/diktat/issues/1148 + // this inspection is softened for gradle scripts, see https://github.com/saveourtool/diktat/issues/1148 return } COMPLEX_EXPRESSION.warn(configRules, emitWarn, isFixMode, node.text, node.startOffset, node) diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter4/SmartCastRule.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter4/SmartCastRule.kt index 36973ca5c9..81417ed338 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter4/SmartCastRule.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter4/SmartCastRule.kt @@ -47,7 +47,7 @@ class SmartCastRule(configRules: List) : DiktatRule( } if (node.elementType == WHEN) { - // Rule is simplified after https://github.com/analysis-dev/diktat/issues/1168 + // Rule is simplified after https://github.com/saveourtool/diktat/issues/1168 return } } 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 00bdb1fbf7..3c3891d9b3 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 @@ -192,7 +192,7 @@ class SmartCastRuleWarnTest : LintTestBase(::SmartCastRule) { } @Test - @Disabled("Rule is simplified after https://github.com/analysis-dev/diktat/issues/1168") + @Disabled("Rule is simplified after https://github.com/saveourtool/diktat/issues/1168") @Tag(SMART_CAST_NEEDED) fun `smart cast in when bad`() { lintMethod( From b20c5723e225ae407c622f991f00299477299471 Mon Sep 17 00:00:00 2001 From: Andrey Shcheglov Date: Fri, 27 May 2022 16:12:57 +0300 Subject: [PATCH 2/5] Rename `s/(cqfn|analysis-dev)/saveourtool/g` in URLs ### What's done: * URLs (incl. those from badges) have been corrected to accommodate for the organization name change. --- .github/workflows/diktat.yml | 2 +- README.md | 20 +++++++++---------- .../cqfn/diktat/ruleset/rules/DiktatRule.kt | 2 +- .../smoke/RulesConfigValidationTest.kt | 2 +- pom.xml | 6 +++--- wp/sections/diKTat.tex | 2 +- wp/sections/work.tex | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/diktat.yml b/.github/workflows/diktat.yml index e67a2c8a20..aed8e167bc 100644 --- a/.github/workflows/diktat.yml +++ b/.github/workflows/diktat.yml @@ -33,6 +33,6 @@ jobs: git fetch --tags LATEST_TAG=$(git describe --tags --abbrev=0) DIKTAT_CONFIG=diktat-analysis.yml - wget -O $DIKTAT_CONFIG https://raw.githubusercontent.com/cqfn/diKTat/$LATEST_TAG/$DIKTAT_CONFIG + wget -O $DIKTAT_CONFIG https://raw.githubusercontent.com/saveourtool/diKTat/$LATEST_TAG/$DIKTAT_CONFIG - name: Run diktat via maven plugin run: mvn -B diktat:check@diktat -DskipPluginMarker diff --git a/README.md b/README.md index f2e5a8a7b2..7c4ac737ed 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -![Build and test](https://github.com/cqfn/diKTat/workflows/Build%20and%20test/badge.svg) -![deteKT static analysis](https://github.com/cqfn/diKTat/workflows/Run%20deteKT/badge.svg) -![diKTat code style](https://github.com/cqfn/diKTat/workflows/Run%20diKTat%20from%20release%20version/badge.svg?branch=master) +![Build and test](https://github.com/saveourtool/diKTat/workflows/Build%20and%20test/badge.svg) +![deteKT static analysis](https://github.com/saveourtool/diKTat/workflows/Run%20deteKT/badge.svg) +![diKTat code style](https://github.com/saveourtool/diKTat/workflows/Run%20diKTat%20from%20release%20version/badge.svg?branch=master) [![codecov](https://codecov.io/gh/saveourtool/diKTat/branch/master/graph/badge.svg)](https://codecov.io/gh/saveourtool/diKTat) -[![Releases](https://img.shields.io/github/v/release/cqfn/diKTat)](https://github.com/cqfn/diKTat/releases) +[![Releases](https://img.shields.io/github/v/release/saveourtool/diKTat)](https://github.com/saveourtool/diKTat/releases) [![Maven Central](https://img.shields.io/maven-central/v/org.cqfn.diktat/diktat-rules)](https://mvnrepository.com/artifact/org.cqfn.diktat) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcqfn%2FdiKTat.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcqfn%2FdiKTat?ref=badge_shield) [![Chat on Telegram](https://img.shields.io/badge/Chat%20on-Telegram-brightgreen.svg)](https://t.me/diktat_help) -[![Hits-of-Code](https://hitsofcode.com/github/cqfn/diktat)](https://hitsofcode.com/view/github/cqfn/diktat) -![Lines of code](https://img.shields.io/tokei/lines/github/cqfn/diktat) -![GitHub repo size](https://img.shields.io/github/repo-size/cqfn/diktat) +[![Hits-of-Code](https://hitsofcode.com/github/saveourtool/diktat)](https://hitsofcode.com/view/github/saveourtool/diktat) +![Lines of code](https://img.shields.io/tokei/lines/github/saveourtool/diktat) +![GitHub repo size](https://img.shields.io/github/repo-size/saveourtool/diktat) [![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) @@ -56,11 +56,11 @@ Main features of diktat are the following: curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.43.2/ktlint && chmod a+x ktlint ``` -2. Load diKTat manually: [here](https://github.com/cqfn/diKTat/releases/download/v1.1.0/diktat-1.1.0.jar) +2. Load diKTat manually: [here](https://github.com/saveourtool/diKTat/releases/download/v1.1.0/diktat-1.1.0.jar) **OR** use curl: ```bash -$ curl -sSLO https://github.com/cqfn/diKTat/releases/download/v1.1.0/diktat-1.1.0.jar +$ curl -sSLO https://github.com/saveourtool/diKTat/releases/download/v1.1.0/diktat-1.1.0.jar ``` @@ -87,7 +87,7 @@ export MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED" ``` This plugin is available since version 0.1.3. You can see how it is configured in our project for self-checks: [pom.xml](pom.xml). -If you use it and encounter any problems, feel free to open issues on [github](https://github.com/cqfn/diktat/issues). +If you use it and encounter any problems, feel free to open issues on [github](https://github.com/saveourtool/diktat/issues).
Add this plugin to your pom.xml: diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRule.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRule.kt index 06e76cba9f..eadeaae4bf 100644 --- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRule.kt +++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRule.kt @@ -51,7 +51,7 @@ abstract class DiktatRule( logic(node) } catch (internalError: Throwable) { log.error( - """Internal error has occurred in rule [$id]. Please make an issue on this bug at https://github.com/cqfn/diKTat/. + """Internal error has occurred in rule [$id]. Please make an issue on this bug at https://github.com/saveourtool/diKTat/. As a workaround you can disable these inspections in yml config: <$inspections>. Root cause of the problem is in [${node.getFilePath()}] file. """.trimIndent(), internalError diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/RulesConfigValidationTest.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/RulesConfigValidationTest.kt index e5de33f855..521be34cbb 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/RulesConfigValidationTest.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/smoke/RulesConfigValidationTest.kt @@ -60,7 +60,7 @@ class RulesConfigValidationTest { } @Test - @Disabled("https://github.com/cqfn/diKTat/issues/395") + @Disabled("https://github.com/saveourtool/diKTat/issues/395") fun `should throw error on invalid configuration section`() { file.writeText( """ diff --git a/pom.xml b/pom.xml index a1528130ab..7ff179d234 100644 --- a/pom.xml +++ b/pom.xml @@ -20,9 +20,9 @@ - scm:git:git://github.com/cqfn/diktat.git - scm:git:ssh://github.com:cqfn/diktat.git - http://github.com/cqfn/diktat/tree/master + scm:git:git://github.com/saveourtool/diktat.git + scm:git:ssh://github.com:saveourtool/diktat.git + http://github.com/saveourtool/diktat/tree/master diff --git a/wp/sections/diKTat.tex b/wp/sections/diKTat.tex index 3b852c781e..32d41111ec 100644 --- a/wp/sections/diKTat.tex +++ b/wp/sections/diKTat.tex @@ -1,5 +1,5 @@ \subsection{What is diKTat?} -DiKTat \footnote{\url{https://github.com/cqfn/diKTat}} - is a formal strict code-style for Kotlin language and a linter with a set of rules that implement this code-style. Basically, it is a collection of Kotlin code style rules implemented as AST visitors on top of KTlint framework \footnote{\url{https://github.com/pinterest/ktlint}}. Diktat detects and automatically fixes code style errors and code smells based on the configuration of rules. DiKTat is a highly configurable framework, that can be extended further by adding custom rules. It can be run as command line application or with maven or gradle plugins. In this paper, we will explain how diKTat works, describe its advantages and disadvantages and compare it with other static analyzers for Kotlin. The main idea is to use diktat in your CI/CD pipeline. +DiKTat \footnote{\url{https://github.com/saveourtool/diKTat}} - is a formal strict code-style for Kotlin language and a linter with a set of rules that implement this code-style. Basically, it is a collection of Kotlin code style rules implemented as AST visitors on top of KTlint framework \footnote{\url{https://github.com/pinterest/ktlint}}. Diktat detects and automatically fixes code style errors and code smells based on the configuration of rules. DiKTat is a highly configurable framework, that can be extended further by adding custom rules. It can be run as command line application or with maven or gradle plugins. In this paper, we will explain how diKTat works, describe its advantages and disadvantages and compare it with other static analyzers for Kotlin. The main idea is to use diktat in your CI/CD pipeline. \subsection{Why diKTat?} DiKTat permits formal flexible description or Rules and Inspections expressed by means of yml file. We looked at similar existing projects and realized that their functionality does not give us a chance to implement our own configurable code style. Most of rules which we wanted to implement were missing in other analyzers. Mostly all of those analyzers had hardcoded logic and prohibited configuration. That’s why we decided that we need to create convenient, user friendly and easily configured tool for developers. diff --git a/wp/sections/work.tex b/wp/sections/work.tex index eee8fd8cb4..1f171b3382 100644 --- a/wp/sections/work.tex +++ b/wp/sections/work.tex @@ -91,7 +91,7 @@ \subsection{DiKTat} Another feature of ktlint is that at it's startup you can provide a JAR file with additional ruleset(s), that will be discovered by the \texttt{ServiceLoader} and then all AST nodes will be passed to these rules. DiKTat uses this approach. -The only modification Diktat makes to the framework is that it adds a mechanism to disable Inspection from the code using annotations or configuration file. The set of all rules is described in the \textsl{DiktatRuleSetProvider}\footnote{\url{https://github.com/cqfn/diKTat/blob/v0.1.3/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt}} class. This class overrides the \textsl{get()} method of the \textsl{RuleSetProvider}\footnote{\url{https://github.com/pinterest/ktlint/blob/master/ktlint-core/src/main/kotlin/com/pinterest/ktlint/core/RuleSetProvider.kt}} interface, which returns a set of rules to be "traversed". But before returning this set Diktat is reading the configuration file where the user has independently configured all the Inspections. If there is no configuration file, then a warning will be displayed and Inspections will use the default configuration file. +The only modification Diktat makes to the framework is that it adds a mechanism to disable Inspection from the code using annotations or configuration file. The set of all rules is described in the \textsl{DiktatRuleSetProvider}\footnote{\url{https://github.com/saveourtool/diKTat/blob/v0.1.3/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt}} class. This class overrides the \textsl{get()} method of the \textsl{RuleSetProvider}\footnote{\url{https://github.com/pinterest/ktlint/blob/master/ktlint-core/src/main/kotlin/com/pinterest/ktlint/core/RuleSetProvider.kt}} interface, which returns a set of rules to be "traversed". But before returning this set Diktat is reading the configuration file where the user has independently configured all the Inspections. If there is no configuration file, then a warning will be displayed and Inspections will use the default configuration file. Each rule must implement the \textsl{visit} method of the abstract Rule class, which describes the logic of the rule. By the way it is a special case of a famous pattern Visitor \cite{ref:gang}. Implementation example of the simple Rule that contains one Inspections can be found below. \begin{lstlisting}[caption={Example of the Rule.}, label={lst:example1}, language=Kotlin] From 6a78aba3f2be5dc9ba6faefc4f9c2620fc961e89 Mon Sep 17 00:00:00 2001 From: Andrey Shcheglov Date: Fri, 27 May 2022 16:33:38 +0300 Subject: [PATCH 3/5] Rename `s/(cqfn|analysis-dev)/saveourtool/g` in URLs ### What's done: * URLs (incl. those from badges) have been corrected to accommodate for the organization name change. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c4ac737ed..e2c35703fe 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Releases](https://img.shields.io/github/v/release/saveourtool/diKTat)](https://github.com/saveourtool/diKTat/releases) [![Maven Central](https://img.shields.io/maven-central/v/org.cqfn.diktat/diktat-rules)](https://mvnrepository.com/artifact/org.cqfn.diktat) -[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcqfn%2FdiKTat.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcqfn%2FdiKTat?ref=badge_shield) +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsaveourtool%2FdiKTat.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsaveourtool%2FdiKTat?ref=badge_shield) [![Chat on Telegram](https://img.shields.io/badge/Chat%20on-Telegram-brightgreen.svg)](https://t.me/diktat_help) [![Hits-of-Code](https://hitsofcode.com/github/saveourtool/diktat)](https://hitsofcode.com/view/github/saveourtool/diktat) From f7ae02f2cf0464a3f1d35dec0904557bb47e0c5e Mon Sep 17 00:00:00 2001 From: Andrey Shcheglov Date: Fri, 27 May 2022 17:15:24 +0300 Subject: [PATCH 4/5] Set the dafault value of `WRONG_INDENTATION:extendedIndentOfParameters` to `false` ### What's done: * The `WRONG_INDENTATION:extendedIndentOfParameters` flag is now unset by default. This closes #1312. --- diktat-common/src/test/resources/test-rules-config.yml | 2 +- diktat-rules/src/main/resources/diktat-analysis-huawei.yml | 2 +- diktat-rules/src/main/resources/diktat-analysis.yml | 2 +- examples/gradle-groovy-dsl/diktat-analysis.yml | 2 +- examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml | 2 +- examples/gradle-kotlin-dsl/diktat-analysis.yml | 2 +- examples/maven/diktat-analysis.yml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/diktat-common/src/test/resources/test-rules-config.yml b/diktat-common/src/test/resources/test-rules-config.yml index 44b8b1dab6..c624736371 100644 --- a/diktat-common/src/test/resources/test-rules-config.yml +++ b/diktat-common/src/test/resources/test-rules-config.yml @@ -125,7 +125,7 @@ enabled: true configuration: newlineAtEnd: true - extendedIndentOfParameters: true + extendedIndentOfParameters: false alignedParameters: true extendedIndentAfterOperators: true indentationSize: 4 diff --git a/diktat-rules/src/main/resources/diktat-analysis-huawei.yml b/diktat-rules/src/main/resources/diktat-analysis-huawei.yml index 8a766b9792..9e6da6fe0a 100644 --- a/diktat-rules/src/main/resources/diktat-analysis-huawei.yml +++ b/diktat-rules/src/main/resources/diktat-analysis-huawei.yml @@ -202,7 +202,7 @@ # Is newline at the end of a file needed newlineAtEnd: true # If true: in parameter list when parameters are split by newline they are indented with two indentations instead of one - extendedIndentOfParameters: true + extendedIndentOfParameters: false # If true: if first parameter in parameter list is on the same line as opening parenthesis, then other parameters can be aligned with it alignedParameters: true # If true: if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one diff --git a/diktat-rules/src/main/resources/diktat-analysis.yml b/diktat-rules/src/main/resources/diktat-analysis.yml index 763fd01307..3164079e88 100644 --- a/diktat-rules/src/main/resources/diktat-analysis.yml +++ b/diktat-rules/src/main/resources/diktat-analysis.yml @@ -202,7 +202,7 @@ # Is newline at the end of a file needed newlineAtEnd: true # If true: in parameter list when parameters are split by newline they are indented with two indentations instead of one - extendedIndentOfParameters: true + extendedIndentOfParameters: false # If true: if first parameter in parameter list is on the same line as opening parenthesis, then other parameters can be aligned with it alignedParameters: true # If true: if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one diff --git a/examples/gradle-groovy-dsl/diktat-analysis.yml b/examples/gradle-groovy-dsl/diktat-analysis.yml index 2ca9d28455..c5945beb5b 100644 --- a/examples/gradle-groovy-dsl/diktat-analysis.yml +++ b/examples/gradle-groovy-dsl/diktat-analysis.yml @@ -202,7 +202,7 @@ # Is newline at the end of a file needed newlineAtEnd: true # If true: in parameter list when parameters are split by newline they are indented with two indentations instead of one - extendedIndentOfParameters: true + extendedIndentOfParameters: false # If true: if first parameter in parameter list is on the same line as opening parenthesis, then other parameters can be aligned with it alignedParameters: true # If true: if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one diff --git a/examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml b/examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml index bfcb7825fc..354c4d0fc4 100644 --- a/examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml +++ b/examples/gradle-kotlin-dsl-multiproject/diktat-analysis.yml @@ -126,7 +126,7 @@ enabled: true configuration: newlineAtEnd: true - extendedIndentOfParameters: true + extendedIndentOfParameters: false alignedParameters: true extendedIndentAfterOperators: true indentationSize: 4 diff --git a/examples/gradle-kotlin-dsl/diktat-analysis.yml b/examples/gradle-kotlin-dsl/diktat-analysis.yml index 2ca9d28455..c5945beb5b 100644 --- a/examples/gradle-kotlin-dsl/diktat-analysis.yml +++ b/examples/gradle-kotlin-dsl/diktat-analysis.yml @@ -202,7 +202,7 @@ # Is newline at the end of a file needed newlineAtEnd: true # If true: in parameter list when parameters are split by newline they are indented with two indentations instead of one - extendedIndentOfParameters: true + extendedIndentOfParameters: false # If true: if first parameter in parameter list is on the same line as opening parenthesis, then other parameters can be aligned with it alignedParameters: true # If true: if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one diff --git a/examples/maven/diktat-analysis.yml b/examples/maven/diktat-analysis.yml index 2ca9d28455..c5945beb5b 100644 --- a/examples/maven/diktat-analysis.yml +++ b/examples/maven/diktat-analysis.yml @@ -202,7 +202,7 @@ # Is newline at the end of a file needed newlineAtEnd: true # If true: in parameter list when parameters are split by newline they are indented with two indentations instead of one - extendedIndentOfParameters: true + extendedIndentOfParameters: false # If true: if first parameter in parameter list is on the same line as opening parenthesis, then other parameters can be aligned with it alignedParameters: true # If true: if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one From feea20c74c89d7768c6e6c5870be3fe0444b3bd2 Mon Sep 17 00:00:00 2001 From: Andrey Shcheglov Date: Fri, 27 May 2022 18:49:56 +0300 Subject: [PATCH 5/5] Set the default value of `WRONG_INDENTATION:extendedIndentOfParameters` to `false` ### What's done: * The `WRONG_INDENTATION:extendedIndentOfParameters` flag is now unset by default. This closes #1312. --- .../spaces/IndentationRuleWarnTest.kt | 30 +++++++++---------- .../org/cqfn/diktat/util/LintTestBase.kt | 3 +- 2 files changed, 17 insertions(+), 16 deletions(-) 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 72d081d508..8b971f6ea9 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 @@ -396,19 +396,19 @@ class IndentationRuleWarnTest : LintTestBase(::IndentationRule) { """ |fun foo() { | consume(Example( - | t1, t2, t3 + | t1, t2, t3 | )) | | bar(baz( - | 1, - | 2 + | 1, + | 2 | ) | ) | | bar(baz( - | 1, - | 2), - | 3 + | 1, + | 2), + | 3 | ) |} | @@ -484,15 +484,15 @@ class IndentationRuleWarnTest : LintTestBase(::IndentationRule) { """ |fun foo() { | bar( - | param1 = baz( - | 1, - | 2 - | ), - | param2 = { elem -> - | elem.qux() - | }, - | param3 = x - | .y() + | param1 = baz( + | 1, + | 2 + | ), + | param2 = { elem -> + | elem.qux() + | }, + | param3 = x + | .y() | ) |} | diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/LintTestBase.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/LintTestBase.kt index bd53570716..512e8c17cf 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/LintTestBase.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/LintTestBase.kt @@ -6,6 +6,7 @@ import com.pinterest.ktlint.core.KtLint import com.pinterest.ktlint.core.LintError import com.pinterest.ktlint.core.Rule import com.pinterest.ktlint.core.api.FeatureInAlphaState +import org.intellij.lang.annotations.Language /** * Base class for testing rules without fixing code. @@ -23,7 +24,7 @@ open class LintTestBase(private val ruleSupplier: (rulesConfigList: List? = null, fileName: String? = null