-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPE in BlockStructureBraces #502
Conversation
### What's done: Fixed bug
Codecov Report
@@ Coverage Diff @@
## master #502 +/- ##
============================================
+ Coverage 81.87% 81.88% +0.01%
- Complexity 1618 1619 +1
============================================
Files 77 77
Lines 4083 4086 +3
Branches 1290 1291 +1
============================================
+ Hits 3343 3346 +3
Misses 218 218
Partials 522 522
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/BlockStructureBraces.kt
Outdated
Show resolved
Hide resolved
### What's done: Fixed after review
@@ -178,7 +178,7 @@ class BlockStructureBraces(private val configRules: List<RulesConfig>) : Rule("b | |||
if (braceSpace == null || braceSpace.elementType != WHITE_SPACE) { | |||
node.addChild(PsiWhiteSpaceImpl(" "), nodeBefore) | |||
} else { | |||
(braceSpace as LeafPsiElement).replaceWithText(" ") | |||
braceSpace.treeParent.replaceWhiteSpaceText(braceSpace, " ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here can be problems if treeParent
is not a WhiteSpace
or does not exist, need to be careful with that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But above, there is a check for this case checkBraceNode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
What's done:
Fixed bug
closes #481