-
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
Bugfix. Useless auto-fix in AVOID_NULL_CHECKS rule #848
Conversation
### What's done: * Fixed bug
Codecov Report
@@ Coverage Diff @@
## master #848 +/- ##
============================================
+ Coverage 81.00% 81.05% +0.04%
- Complexity 2282 2284 +2
============================================
Files 100 100
Lines 5843 5847 +4
Branches 1814 1813 -1
============================================
+ Hits 4733 4739 +6
Misses 286 286
+ Partials 824 822 -2
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/chapter4/NullChecksRule.kt
Outdated
Show resolved
Hide resolved
### What's done: * Fixed bug
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter4/NullChecksRule.kt
Outdated
Show resolved
Hide resolved
### What's done: * Fixed bug
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.
We can add the same logic for the opposite situation as well:
fun foo(y: Int?) {
val x = if (y == null) {
null
} else {
y + 2
}
}
we shouldn't have useless run { null }
block
### What's done: * Fixed bug
### What's done: * code style
What's done:
This pull request closes #840