Skip to content

Commit

Permalink
Consistent code style
Browse files Browse the repository at this point in the history
### What's done:
* Fixing code style
  • Loading branch information
petertrr committed Nov 30, 2020
1 parent 4ce391a commit 1872a98
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 1872a98

Please sign in to comment.