-
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. EMPTY_BLOCK_STRUCTURE_ERROR shouldn't trigger on empty lambdas #803
Conversation
### What's done: * Fixed bug
### What's done: * Fixed bug
### What's done: * Fixed bug
Codecov Report
@@ Coverage Diff @@
## master #803 +/- ##
=========================================
Coverage 80.91% 80.92%
- Complexity 2213 2221 +8
=========================================
Files 98 98
Lines 5686 5694 +8
Branches 1763 1767 +4
=========================================
+ Hits 4601 4608 +7
Misses 286 286
- Partials 799 800 +1
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/chapter3/EmptyBlock.kt
Outdated
Show resolved
Hide resolved
return callExpression.treeParent.elementType != DOT_QUALIFIED_EXPRESSION | ||
} else if (parents.any { it.elementType == LAMBDA_EXPRESSION }) { | ||
val lambdaExpression = parents.find { it.elementType == LAMBDA_EXPRESSION }!! | ||
// cases like A({}). Here Lambda expression is used as a value parameter. |
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.
I remember that we have e.g. this case: https://github.com/cqfn/diKTat/blob/d9b6b6eff3f189aca9ac15f6ba25d230f047ff0c/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/KotlinParser.kt#L53, where the compiler suggests to remove explicit class name as redundant, but diktat would've raised an error. Please try to remove and see if you PR fixes it.
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.
Fixed and logic reworked a liitle bit
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/EmptyBlock.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/EmptyBlock.kt
Show resolved
Hide resolved
### What's done: * Fixed bug
### What's done: * Fixed bug
### What's done: * Fixed bug
info/guide/guide-chapter-3.md
Outdated
@@ -1,4 +1,4 @@ | |||
# <a name="c3"></a>3. General formatting (typesetting) | |||
__# <a name="c3"></a>3. General formatting (typesetting) |
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.
What is this underscore?
__# <a name="c3"></a>3. General formatting (typesetting) | |
# <a name="c3"></a>3. General formatting (typesetting) |
info/guide/guide-chapter-3.md
Outdated
@@ -318,6 +318,8 @@ fun doNothing() {} | |||
|
|||
fun doNothingElse() { | |||
} | |||
|
|||
fun foo(bar: () -> Unit = {})__ |
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.
fun foo(bar: () -> Unit = {})__ | |
fun foo(bar: () -> Unit = {}) |
### What's done: * Fixed bug
### What's done: * Fixed bug
What's done:
This pull request closes #796