Repository: analysis-dev/diktat (kotlin)

Issue:
`WRONG_DECLARATIONS_ORDER` conflicts with `ENUM_SEPARATED`
## Describe the bug
```kotlin
enum class E {
    A,
    C,
    B,
    D,
    ;
}
```
diktat swaps positions of `C` and `B`, but meanwhile it removes traling comma after `D`. Then,
```
Warn (1:1) [ENUMS_SEPARATED] enum is incorrectly formatted: last enum entry must end with a comma
```

## Environment information
* diktat version: 1.0.1

Pull request description:
### What's done:
* fixed order of rules
closes #1178

Patch:
diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt
index a8c6ce53f6..8d53632c7e 100644
--- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt
+++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt
@@ -159,7 +159,6 @@ class DiktatRuleSetProvider(private var diktatConfigFile: String = DIKTAT_ANALYS
             ::BracesInConditionalsAndLoopsRule,
             ::EmptyBlock,
             ::AvoidEmptyPrimaryConstructor,
-            ::EnumsSeparated,
             ::TopLevelOrderRule,
             ::SingleLineStatementsRule,
             ::MultipleModifiersSequence,
@@ -187,6 +186,7 @@ class DiktatRuleSetProvider(private var diktatConfigFile: String = DIKTAT_ANALYS
             ::NestedFunctionBlock,
             ::AnnotationNewLineRule,
             ::SortRule,
+            ::EnumsSeparated,
             ::StringConcatenationRule,
             ::StringTemplateFormatRule,
             ::AccurateCalculationsRule,


Test patch:
diff --git a/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example3Expected.kt b/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example3Expected.kt
index 7313188225..46f4f61784 100644
--- a/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example3Expected.kt
+++ b/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example3Expected.kt
@@ -52,6 +52,14 @@ enum class IssueType2 {
     companion object
 }
 
+enum class IssueType3 {
+    A,
+    B,
+    C,
+    D,
+    ;
+}
+
 class Foo {
     /**
      * @implNote lorem ipsum
diff --git a/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example3Test.kt b/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example3Test.kt
index 7ac28f6eec..bae900ceb9 100644
--- a/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example3Test.kt
+++ b/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/Example3Test.kt
@@ -52,6 +52,14 @@ enum class IssueType2 {
     fun foo(bar: Int) = bar
 }
 
+enum class IssueType3 {
+    A,
+    C,
+    B,
+    D,
+    ;
+}
+
 class Foo {
     /**
      * @implNote lorem ipsum