Skip to content

Fix ValShouldBeVar false positive inside unknown type#4820

Merged
BraisGabin merged 2 commits into
detekt:mainfrom
themkat:GH-4736
May 9, 2022
Merged

Fix ValShouldBeVar false positive inside unknown type#4820
BraisGabin merged 2 commits into
detekt:mainfrom
themkat:GH-4736

Conversation

@themkat

@themkat themkat commented May 7, 2022

Copy link
Copy Markdown
Contributor

Attempt at fixing false positives for ValShouldBeVar when the assignment is inside an unknown type. This is the only logical solution I can think of at the moment. It basically assumes that if we can't resolve the type of the assignment, then it is from the inside of an unknown context (like a with-statement). Let me know if there is something I'm missing, and we can close/reject this PR...

Fixes #4736

@github-actions github-actions Bot added the rules label May 7, 2022
@codecov

codecov Bot commented May 7, 2022

Copy link
Copy Markdown

Codecov Report

Merging #4820 (62f7683) into main (faa985d) will increase coverage by 0.03%.
The diff coverage is 50.00%.

@@             Coverage Diff              @@
##               main    #4820      +/-   ##
============================================
+ Coverage     84.71%   84.74%   +0.03%     
  Complexity     3431     3431              
============================================
  Files           491      491              
  Lines         11267    11270       +3     
  Branches       2075     2074       -1     
============================================
+ Hits           9545     9551       +6     
  Misses          673      673              
+ Partials       1049     1046       -3     
Impacted Files Coverage Δ
...lab/arturbosch/detekt/rules/style/VarCouldBeVal.kt 81.55% <50.00%> (+1.16%) ⬆️
...turbosch/detekt/rules/complexity/NamedArguments.kt 83.33% <0.00%> (+1.19%) ⬆️
...lab/arturbosch/detekt/rules/style/UnusedImports.kt 89.87% <0.00%> (+2.53%) ⬆️

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 faa985d...62f7683. Read the comment docs.

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.

False positive: VarCouldBeVal

3 participants