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

UnusedPrivateMember: don't report parameters in expect/actual functions #2643

Merged
merged 2 commits into from
Apr 29, 2020

Conversation

t-kameyama
Copy link
Contributor

Fixes #2636

@codecov
Copy link

codecov bot commented Apr 28, 2020

Codecov Report

Merging #2643 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2643   +/-   ##
=========================================
  Coverage     80.01%   80.01%           
  Complexity     2292     2292           
=========================================
  Files           379      379           
  Lines          6760     6761    +1     
  Branches       1222     1222           
=========================================
+ Hits           5409     5410    +1     
  Misses          740      740           
  Partials        611      611           
Impacted Files Coverage Δ Complexity Δ
...o/gitlab/arturbosch/detekt/rules/KtModifierList.kt 100.00% <100.00%> (ø) 0.00 <0.00> (ø)
...turbosch/detekt/rules/style/UnusedPrivateMember.kt 92.23% <100.00%> (ø) 5.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 b4a318d...24a7a48. Read the comment docs.

Copy link
Member

@schalkms schalkms left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this false-positive so quickly. In my opinion the behavior should be different. That’s why I requested changes.

}
}
"""
assertThat(subject.lint(code)).isEmpty()
Copy link
Member

Choose a reason for hiding this comment

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

Actual classes are an implementation concern. Thus, unused parameters should be reported.

@@ -55,6 +55,32 @@ class UnusedPrivateMemberSpec : Spek({
}
}

describe("expect functions") {

it("should not report parameters in expect functions") {
Copy link
Member

Choose a reason for hiding this comment

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

What happens when I just write an expect fun not inside a class? Unused parameters should not reported for this case. Maybe we should add a test case for quality and coverage reasons.

@schalkms schalkms merged commit 6e8e5ae into detekt:master Apr 29, 2020
@t-kameyama t-kameyama deleted the issue_2636 branch April 29, 2020 10:21
schalkms added a commit that referenced this pull request Apr 29, 2020
* Don't report unused private properties in expect class

This is a subsequent commit of #2643.
Further tests are added that check unused elements in expect and actual classes.

* Add a test for a public property in expect class
@arturbosch arturbosch added this to the 1.9.0 milestone May 12, 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.

UnusedPrivateMembers on expect class
3 participants