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

OptionalUnit: fix false positive with 'else if' #2888

Merged
merged 1 commit into from
Jul 23, 2020

Conversation

t-kameyama
Copy link
Contributor

@t-kameyama t-kameyama commented Jul 22, 2020

Fixed false positive with 'else if' :

fun <T> T.foo() {
    println(this)
}

fun test(i: Int, j: Int) {
    when (i) {
        0 -> println(1)
        else -> {
            if (j == 1) {
                println(2)
            } else if (j == 2) {
                println(3)
            } else if (j == 3) {
                println(4)
            }
            Unit
        }
    }.foo()
}

Related: #2886

@t-kameyama t-kameyama changed the title OptionalUnit:: fix false positive case OptionalUnit: fix false positive case Jul 22, 2020
@t-kameyama t-kameyama changed the title OptionalUnit: fix false positive case OptionalUnit: fix false positive case with 'else if' Jul 22, 2020
@t-kameyama t-kameyama changed the title OptionalUnit: fix false positive case with 'else if' OptionalUnit: fix false positive with 'else if' Jul 22, 2020
@codecov
Copy link

codecov bot commented Jul 22, 2020

Codecov Report

Merging #2888 into master will decrease coverage by 0.01%.
The diff coverage is 75.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2888      +/-   ##
============================================
- Coverage     80.19%   80.18%   -0.02%     
  Complexity     2425     2425              
============================================
  Files           421      421              
  Lines          7368     7369       +1     
  Branches       1349     1349              
============================================
  Hits           5909     5909              
  Misses          761      761              
- Partials        698      699       +1     
Impacted Files Coverage Δ Complexity Δ
...rbosch/detekt/rules/style/optional/OptionalUnit.kt 77.77% <75.00%> (-1.77%) 26.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 c1cf9d7...2645609. Read the comment docs.

@schalkms schalkms merged commit 2747fe9 into detekt:master Jul 23, 2020
@t-kameyama t-kameyama deleted the issue_2452_2 branch July 23, 2020 16:09
@arturbosch arturbosch added this to the 1.10.1 milestone Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants