Repository: analysis-dev/diktat (kotlin)

Issue:
NPE in IndentationRule (during autofix)
## Describe the bug
```kotlin
fun foo() {
    val diktatExtension = project.extensions.create(DIKTAT_EXTENSION, DiktatExtension::class.java)
    diktatExtension.inputs = project.fileTree("src").apply {
        include("**/*.kt")
    }
    diktatExtension.reporter = PlainReporter(System.out)
}
```
yields
```
Caused by: java.lang.IllegalStateException: whiteSpace.prevSibling must not be null
	at org.cqfn.diktat.ruleset.utils.indentation.AssignmentOperatorChecker.checkNode(Checkers.kt:55) ~[diktat-rules-0.1.4.jar:na]
	at org.cqfn.diktat.ruleset.rules.files.IndentationRule.visitWhiteSpace(IndentationRule.kt:174) ~[diktat-rules-0.1.4.jar:na]
	at org.cqfn.diktat.ruleset.rules.files.IndentationRule.access$visitWhiteSpace(IndentationRule.kt:57) ~[diktat-rules-0.1.4.jar:na]
	at org.cqfn.diktat.ruleset.rules.files.IndentationRule$checkIndentation$1.invoke(IndentationRule.kt:156) ~[diktat-rules-0.1.4.jar:na]
	at org.cqfn.diktat.ruleset.rules.files.IndentationRule$checkIndentation$1.invoke(IndentationRule.kt:57) ~[diktat-rules-0.1.4.jar:na]
```

## Environment information
* diktat version: 0.1.4 (same for 0.1.5)

Pull request description:
This PR fixes NPE in Indentation Rule

This pull request closes #555

Patch:
diff --git a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/indentation/Checkers.kt b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/indentation/Checkers.kt
index af063a0e45..9808668585 100644
--- a/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/indentation/Checkers.kt
+++ b/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/indentation/Checkers.kt
@@ -59,8 +59,8 @@ import org.jetbrains.kotlin.psi.psiUtil.siblings
  */
 internal class AssignmentOperatorChecker(configuration: IndentationConfig) : CustomIndentationChecker(configuration) {
     override fun checkNode(whiteSpace: PsiWhiteSpace, indentError: IndentationError): CheckResult? {
-        val prevNode = whiteSpace.prevSibling.node
-        if (prevNode.elementType == EQ && prevNode.treeNext.let { it.elementType == WHITE_SPACE && it.textContains('\n') }) {
+        val prevNode = whiteSpace.prevSibling?.node
+        if (prevNode?.elementType == EQ && prevNode.treeNext.let { it.elementType == WHITE_SPACE && it.textContains('\n') }) {
             return CheckResult.from(indentError.actual, (whiteSpace.parentIndent()
                 ?: indentError.expected) + (if (configuration.extendedIndentAfterOperators) 2 else 1) * configuration.indentationSize, true)
         }
@@ -256,8 +256,8 @@ internal class CustomGettersAndSettersChecker(config: IndentationConfig) : Custo
  */
 internal class ArrowInWhenChecker(configuration: IndentationConfig) : CustomIndentationChecker(configuration) {
     override fun checkNode(whiteSpace: PsiWhiteSpace, indentError: IndentationError): CheckResult? {
-        val prevNode = whiteSpace.prevSibling.node
-        if (prevNode.elementType == ARROW && whiteSpace.parent is KtWhenEntry) {
+        val prevNode = whiteSpace.prevSibling?.node
+        if (prevNode?.elementType == ARROW && whiteSpace.parent is KtWhenEntry) {
             return CheckResult.from(indentError.actual, (whiteSpace.parentIndent()
                 ?: indentError.expected) + configuration.indentationSize, true)
         }


Test patch:
diff --git a/diktat-rules/src/test/resources/test/chapter6/compact_initialization/ApplyWithValueArgumentExpected.kt b/diktat-rules/src/test/resources/test/chapter6/compact_initialization/ApplyWithValueArgumentExpected.kt
index 2a15290624..ade66872fe 100644
--- a/diktat-rules/src/test/resources/test/chapter6/compact_initialization/ApplyWithValueArgumentExpected.kt
+++ b/diktat-rules/src/test/resources/test/chapter6/compact_initialization/ApplyWithValueArgumentExpected.kt
@@ -9,4 +9,12 @@ httpClient.doRequest()
 
 fun setDefaultUrl(httpClient: HttpClient) {
     httpClient.url = "http://example.com"
+}
+
+fun foo() {
+    val diktatExtension = project.extensions.create(DIKTAT_EXTENSION, DiktatExtension::class.java).apply {
+    inputs = project.fileTree("src").apply {
+        include("**/*.kt")
+    }
+    reporter = PlainReporter(System.out)}
 }
\ No newline at end of file
diff --git a/diktat-rules/src/test/resources/test/chapter6/compact_initialization/ApplyWithValueArgumentTest.kt b/diktat-rules/src/test/resources/test/chapter6/compact_initialization/ApplyWithValueArgumentTest.kt
index 8abde5e9cd..517f2de76c 100644
--- a/diktat-rules/src/test/resources/test/chapter6/compact_initialization/ApplyWithValueArgumentTest.kt
+++ b/diktat-rules/src/test/resources/test/chapter6/compact_initialization/ApplyWithValueArgumentTest.kt
@@ -7,4 +7,12 @@ httpClient.doRequest()
 
 fun setDefaultUrl(httpClient: HttpClient) {
     httpClient.url = "http://example.com"
+}
+
+fun foo() {
+    val diktatExtension = project.extensions.create(DIKTAT_EXTENSION, DiktatExtension::class.java)
+    diktatExtension.inputs = project.fileTree("src").apply {
+        include("**/*.kt")
+    }
+    diktatExtension.reporter = PlainReporter(System.out)
 }
\ No newline at end of file