Skip to content

UnusedPrivateMember - Fix false positive in case of invoke operator #5717

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

Merged
merged 1 commit into from
Feb 21, 2023

Conversation

atulgpt
Copy link
Contributor

@atulgpt atulgpt commented Jan 21, 2023

Fixes #4435

@codecov
Copy link

codecov bot commented Jan 21, 2023

Codecov Report

Merging #5717 (bddd6e0) into main (b616a2f) will decrease coverage by 0.01%.
The diff coverage is 84.81%.

@@             Coverage Diff              @@
##               main    #5717      +/-   ##
============================================
- Coverage     84.59%   84.58%   -0.01%     
- Complexity     3768     3788      +20     
============================================
  Files           546      547       +1     
  Lines         12817    12894      +77     
  Branches       2236     2258      +22     
============================================
+ Hits          10842    10906      +64     
- Misses          860      861       +1     
- Partials       1115     1127      +12     
Impacted Files Coverage Δ
...osch/detekt/rules/style/StringShouldBeRawString.kt 84.21% <84.21%> (ø)
...turbosch/detekt/rules/style/UnusedPrivateMember.kt 89.90% <85.71%> (-2.32%) ⬇️
...rturbosch/detekt/rules/style/StyleGuideProvider.kt 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@atulgpt
Copy link
Contributor Author

atulgpt commented Feb 3, 2023

Hi, @BraisGabin / @TWiStErRob / @cortinico can you guys review this PR :) Let me know if any changes are required

Copy link
Member

@BraisGabin BraisGabin left a comment

Choose a reason for hiding this comment

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

LGTM Thanks!

@BraisGabin BraisGabin added this to the 1.23.0 milestone Feb 21, 2023
@BraisGabin
Copy link
Member

Sorry for the delay. Could you fix the conflicts? I think they are going to be big because this rule was splitted in 3. But the test and code looks good :)

@atulgpt
Copy link
Contributor Author

atulgpt commented Feb 21, 2023

Hi @BraisGabin one test RedundantVisibilityModifierRuleSpec > Explicit API mode > does not report public function in class if explicit API mode is set to strict() is failing while in the local same test is getting passes. Any idea how to make CI happy?

@BraisGabin
Copy link
Member

No idea, I'm re-running the task to see if it still happens.

@atulgpt
Copy link
Contributor Author

atulgpt commented Feb 21, 2023

@BraisGabin seemed like an intermittent issue. It got passed now. Pasting the stack trace of the intermittent failure below

RedundantVisibilityModifierRuleSpec > Explicit API mode > does not report public function in class if explicit API mode is set to strict() FAILED
    io.mockk.MockKException: Can't instantiate proxy for class org.jetbrains.kotlin.config.LanguageVersionSettings
        at io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:64)
        at io.mockk.impl.instantiation.AbstractMockFactory.newProxy$default(AbstractMockFactory.kt:24)
        at io.mockk.impl.instantiation.AbstractMockFactory.mockk(AbstractMockFactory.kt:59)
        at io.gitlab.arturbosch.detekt.rules.style.RedundantVisibilityModifierRuleSpec$Explicit API mode.mockCompilerResources(RedundantVisibilityModifierRuleSpec.kt:236)
        at io.gitlab.arturbosch.detekt.rules.style.RedundantVisibilityModifierRuleSpec$Explicit API mode.does not report public function in class if explicit API mode is set to strict(RedundantVisibilityModifierRuleSpec.kt:205)

        Caused by:
        io.mockk.proxy.MockKAgentException: Value for this result is not assigned
            at io.mockk.proxy.common.CancelableResult.get(CancelableResult.kt:18)
            at io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:44)
            ... 4 more

logs at here

@BraisGabin
Copy link
Member

It seems like an issue at mockk. I saw some issues related with that exception message at their repo. Anyway, merging!

@BraisGabin BraisGabin merged commit 7e99af7 into detekt:main Feb 21, 2023
@cortinico cortinico changed the title Fix false positive in case of invoke operator UnusedPrivateMember - Fix false positive in case of invoke operator Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UnusedPrivateMember - [invoke]: False positive: Used by public member function
2 participants