Skip to content
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

Merged
merged 8 commits into from
Mar 19, 2021

Conversation

aktsay6
Copy link
Collaborator

@aktsay6 aktsay6 commented Mar 19, 2021

What's done:

  • Fixed bug

This pull request closes #796

### What's done:
  * Fixed bug
@aktsay6 aktsay6 added the bug Something isn't working label Mar 19, 2021
@aktsay6 aktsay6 requested review from petertrr and kentr0w March 19, 2021 10:20
aktsay6 added 2 commits March 19, 2021 13:21
### What's done:
  * Fixed bug
### What's done:
  * Fixed bug
@codecov
Copy link

codecov bot commented Mar 19, 2021

Codecov Report

Merging #803 (6c759e4) into master (d9b6b6e) will increase coverage by 0.00%.
The diff coverage is 81.81%.

Impacted file tree graph

@@            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     
Flag Coverage Δ Complexity Δ
unittests 80.92% <81.81%> (+<0.01%) 0.00 <15.00> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...g/cqfn/diktat/ruleset/rules/chapter3/EmptyBlock.kt 74.50% <80.00%> (+3.08%) 24.00 <15.00> (+8.00)
...tlin/org/cqfn/diktat/ruleset/utils/KotlinParser.kt 83.92% <100.00%> (-0.29%) 19.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d9b6b6e...6c759e4. Read the comment docs.

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.
Copy link
Member

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.

Copy link
Collaborator Author

@aktsay6 aktsay6 Mar 19, 2021

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

aktsay6 added 3 commits March 19, 2021 14:54
### What's done:
  * Fixed bug
### What's done:
  * Fixed bug
### What's done:
  * Fixed bug
@aktsay6 aktsay6 requested a review from petertrr March 19, 2021 13:11
@@ -1,4 +1,4 @@
# <a name="c3"></a>3. General formatting (typesetting)
__# <a name="c3"></a>3. General formatting (typesetting)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this underscore?

Suggested change
__# <a name="c3"></a>3. General formatting (typesetting)
# <a name="c3"></a>3. General formatting (typesetting)

@@ -318,6 +318,8 @@ fun doNothing() {}

fun doNothingElse() {
}

fun foo(bar: () -> Unit = {})__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fun foo(bar: () -> Unit = {})__
fun foo(bar: () -> Unit = {})

aktsay6 added 2 commits March 19, 2021 16:29
### What's done:
  * Fixed bug
### What's done:
  * Fixed bug
@petertrr petertrr merged commit 73cdc6f into master Mar 19, 2021
@petertrr petertrr deleted the bugfix/empty-lambdas(#796) branch March 19, 2021 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EMPTY_BLOCK_STRUCTURE_ERROR shouldn't trigger on empty lambdas
2 participants