Skip to content

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

Merged
BraisGabin merged 1 commit into
detekt:mainfrom
atulgpt:fixes-4435
Feb 21, 2023
Merged

BraisGabin merged 1 commit into
detekt:mainfrom
atulgpt:fixes-4435

Conversation

@atulgpt

@atulgpt atulgpt commented Jan 21, 2023

Copy link
Copy Markdown
Contributor

Fixes #4435

@codecov

codecov Bot commented Jan 21, 2023 •

Copy link
Copy Markdown

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

atulgpt commented Feb 3, 2023

Copy link
Copy Markdown
Contributor Author

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

@BraisGabin BraisGabin left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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

atulgpt commented Feb 21, 2023

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Member

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

@atulgpt

atulgpt commented Feb 21, 2023 •

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
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

This branch was successfully deployed

1 active deployment
Preview — bddd6e0e Deployed Feb 21, 2023 by vercel[bot]
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

3 participants