PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: analysis-dev/diktat (kotlin)

Issue:
Comments should be indented as the code they are commenting
For example,
```kotlin
foo
     // we are calling bar
    .bar
```
is corrected to
```kotlin
foo
// we are calling bar
    .bar
```
in diktat 0.1.5

Pull request:
### What's done:
* Fixed bug

This pull request closes #553

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 04edf11d74..416538cc93 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
@@ -178,11 +178,11 @@ internal class DotCallChecker(config: IndentationConfig) : CustomIndentationChec
 
     private fun ASTNode.isCommentBeforeDot() : Boolean {
         if (elementType == EOL_COMMENT || elementType == BLOCK_COMMENT) {
-            var nextNode = treeNext
+            var nextNode: ASTNode? = treeNext
             while (nextNode != null && (nextNode.elementType == WHITE_SPACE || nextNode.elementType == EOL_COMMENT)) {
                 nextNode = nextNode.treeNext
             }
-            return nextNode.isDotBeforeCallOrReference()
+            return nextNode?.isDotBeforeCallOrReference() ?: false
         }
         return false
     }


Test patch:
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 17cbeecbf4..9a0af62b9e 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
@@ -574,6 +574,22 @@ class IndentationRuleWarnTest : LintTestBase(::IndentationRule) {
         )
     }
 
+    @Test
+    @Tag(WarningNames.WRONG_INDENTATION)
+    fun `regression - npe with comments`() {
+        lintMethod(
+            """
+                |fun foo() {
+                |    bar.let {
+                |        baz(it)
+                |        // lorem ipsum
+                |    }
+                |}
+                |
+            """.trimMargin()
+        )
+    }
+
     @Test
     @Tag(WarningNames.WRONG_INDENTATION)
     @Disabled("https://github.com/cqfn/diKTat/issues/377")