Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/overriden-kdoc-not-mandatory(#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
petertrr authored Nov 30, 2020
2 parents 040949b + 2349037 commit 1387770
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 1387770

Please sign in to comment.