Repository: analysis-dev/diktat (kotlin)

Issue:
Support 'value' keyword from Kotlin 1.5
On the 

```
public value class TomlParser(private val config: TomlConfig) { }
```

we receive the following:

```
Warn (1:1) [WRONG_MULTIPLE_MODIFIERS_ORDER] sequence of modifier-keywords is incorrect: public should be on position 2, but is on position 1
Warn (1:8) [WRONG_MULTIPLE_MODIFIERS_ORDER] sequence of modifier-keywords is incorrect: value should be on position 1, but is on position 2
```

looks like we do not support `value` keyword

**Please also mark this inspection in the readme with Kotlin 1.6**

Pull request:
### What's done:
* Support 'value' keyword from Kotlin 1.6
Closes #1170

Patch:
diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/MultipleModifiersSequence.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/MultipleModifiersSequence.kt
index c5fb88d1dc..f33294118b 100644
--- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/MultipleModifiersSequence.kt
+++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/MultipleModifiersSequence.kt
@@ -79,7 +79,7 @@ class MultipleModifiersSequence(configRules: List<RulesConfig>) : DiktatRule(
             KtTokens.EXTERNAL_KEYWORD, KtTokens.OVERRIDE_KEYWORD, KtTokens.LATEINIT_KEYWORD, KtTokens.TAILREC_KEYWORD,
             KtTokens.CROSSINLINE_KEYWORD, KtTokens.VARARG_KEYWORD, KtTokens.SUSPEND_KEYWORD, KtTokens.INNER_KEYWORD,
             KtTokens.OUT_KEYWORD, KtTokens.ENUM_KEYWORD, KtTokens.ANNOTATION_KEYWORD, KtTokens.COMPANION_KEYWORD,
-            KtTokens.INLINE_KEYWORD, KtTokens.NOINLINE_KEYWORD, KtTokens.REIFIED_KEYWORD, KtTokens.INFIX_KEYWORD,
+            KtTokens.VALUE_KEYWORD, KtTokens.INLINE_KEYWORD, KtTokens.NOINLINE_KEYWORD, KtTokens.REIFIED_KEYWORD, KtTokens.INFIX_KEYWORD,
             KtTokens.OPERATOR_KEYWORD, KtTokens.DATA_KEYWORD, KtTokens.IN_KEYWORD, KtTokens.HEADER_KEYWORD,
             KtTokens.IMPL_KEYWORD)
     }
diff --git a/info/available-rules.md b/info/available-rules.md
index 31abb5625c..73e5139203 100644
--- a/info/available-rules.md
+++ b/info/available-rules.md
@@ -84,7 +84,7 @@
 |    3  |    3.14.3  |  MAGIC_NUMBER                             | Check: warns if there is magic numbers in the code                                                                                                                             | no    | ignoreNumbers, ignoreHashCodeFunction, ignorePropertyDeclaration, ignoreLocalVariableDeclaration, ignoreConstantDeclaration, ignoreCompanionObjectPropertyDeclaration, ignoreEnums, ignoreRanges, ignoreExtensionFunctions | no
 |    3  |     3.1.4  |  WRONG_DECLARATIONS_ORDER                                |  Check: if order of enum values or constant property inside companion isn't correct                                                                                            |  yes  |  no  |                                                                                      - |
 |    3  |    3.12.1  |  ANNOTATION_NEW_LINE                     |  Check: warns if annotation not on a new single line                                                                                                                           |  yes  |  no  |  - |
-|    3  |    3.14.1  |  WRONG_MULTIPLE_MODIFIERS_ORDER           |  Check: if multiple modifiers sequence is in the wrong order                                                                                                                   |  yes  |  no  |  - |
+|    3  |    3.14.1  |  WRONG_MULTIPLE_MODIFIERS_ORDER           |  Check: if multiple modifiers sequence is in the wrong order. Value identifier supported in Kotlin 1.5                                                                        |  yes  |  no  |  - |
 |    3  |    3.15.2  |  STRING_TEMPLATE_CURLY_BRACES                |  Check: warns if there is redundant curly braces in string template<br> Fix: deletes curly braces                  |  yes  |  no  |  + |
 |    3  |    3.15.2  |  STRING_TEMPLATE_QUOTES                       |  Check: warns if there are redundant quotes in string template<br> Fix: deletes quotes and $ symbol                    |  yes  |  no  |  + |
 |    3  |    3.16.1  |  COLLAPSE_IF_STATEMENTS                   | Check: warns if there are redundant nested if-statements, which could be collapsed into a single one by concatenating their conditions                                       |  yes  |  no    |   -  |
diff --git a/info/guide/guide-chapter-3.md b/info/guide/guide-chapter-3.md
index 2cb16e9e7f..117806d248 100644
--- a/info/guide/guide-chapter-3.md
+++ b/info/guide/guide-chapter-3.md
@@ -873,6 +873,7 @@ class SomeClass {
 This section contains recommendations regarding modifiers and constant values.
 #### <a name="r3.14.1"></a> 3.14.1 Declaration with multiple modifiers
 If a declaration has multiple modifiers, always follow the proper sequence.
+`Value` identifier supported in Kotlin 1.5
 **Valid sequence:**
 
 ```kotlin
@@ -890,7 +891,7 @@ inner
 out
 enum / annotation
 companion
-inline / noinline
+value / inline / noinline
 reified
 infix
 operator


Test patch:
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 3693eb93e3..21aca8657d 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
@@ -221,7 +221,7 @@ class HeaderCommentRuleTest : LintTestBase(::HeaderCommentRule) {
         lintMethod(
             """
                 /*
-                 * Copyright (c) 2021 My Company, Ltd. All rights reserved.
+                 * Copyright (c) 2022 My Company, Ltd. All rights reserved.
                  */
                 /**
                  * Very useful description, why this file has two classes
@@ -244,7 +244,7 @@ class HeaderCommentRuleTest : LintTestBase(::HeaderCommentRule) {
         lintMethod(
             """
                 /*
-                 * Copyright (c) My Company, Ltd. 2012-2021. All rights reserved.
+                 * Copyright (c) My Company, Ltd. 2012-2022. All rights reserved.
                  */
                 /**
                  * Very useful description, why this file has two classes
@@ -267,7 +267,7 @@ class HeaderCommentRuleTest : LintTestBase(::HeaderCommentRule) {
         lintMethod(
             """
                 /*
-                   Copyright (c) My Company, Ltd. 2021-2021. All rights reserved.
+                   Copyright (c) My Company, Ltd. 2021-2022. All rights reserved.
                  */
                 /**
                  * Very useful description, why this file has two classes
@@ -290,7 +290,7 @@ class HeaderCommentRuleTest : LintTestBase(::HeaderCommentRule) {
         lintMethod(
             """
                 /*
-                 *  Copyright (c) My Company, Ltd. 2002-2021. All rights reserved.
+                 *  Copyright (c) My Company, Ltd. 2002-2022. All rights reserved.
                  */
                 /**
                  * Very useful description, why this file has two classes
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 cd9b5cb86c..1a9488c75a 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
@@ -97,4 +97,15 @@ class MultipleModifiersSequenceWarnTest : LintTestBase(::MultipleModifiersSequen
             LintError(1, 8, ruleId, "${WRONG_MULTIPLE_MODIFIERS_ORDER.warnText()} @Annotation annotation should be before all modifiers", true)
         )
     }
+
+    @Test
+    @Tag(WarningNames.WRONG_MULTIPLE_MODIFIERS_ORDER)
+    fun `check correct order modifier for value`() {
+        lintMethod(
+            """
+                    |public value class Foo() {
+                    |}
+                """.trimMargin(),
+        )
+    }
 }
diff --git a/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example5Expected.kt b/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example5Expected.kt
index 0b93668d70..8258014d7a 100644
--- a/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example5Expected.kt
+++ b/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example5Expected.kt
@@ -1,5 +1,5 @@
 /*
-    Copyright 2018-2021 John Doe.
+    Copyright 2018-2022 John Doe.
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at