Skip to content

UnnecessaryInnerClass: add test for safe qualified expressions#4864

Merged
schalkms merged 1 commit intodetekt:mainfrom
dzirbel:unnecessaryInnerClassSafeQualified
May 27, 2022
Merged

UnnecessaryInnerClass: add test for safe qualified expressions#4864
schalkms merged 1 commit intodetekt:mainfrom
dzirbel:unnecessaryInnerClassSafeQualified

Conversation

@dzirbel
Copy link
Copy Markdown
Contributor

@dzirbel dzirbel commented May 26, 2022

Add a unit test for a bug in which safe qualified references to a nullable field
in the parent class (i.e. as ?.) would not be marked as warnings in release
1.20.0. This issue has been inadvertently fixed by
#4738, but adding a unit test will guard
against future regressions.

I was able to confirm this test fails by checking out the 1.20.0 tag and running
the unit test; against that tag the fix was to override the
visitSafeQualifiedExpression() function with the same logic as
visitCallExpression().

Add a unit test for a bug in which safe qualified references to a nullable field
in the parent class (i.e. as `?.`) would not be marked as warnings in release
1.20.0. This issue has been inadvertently fixed by
#4738, but adding a unit test will guard
against future regressions.

I was able to confirm this test fails by checking out the 1.20.0 tag and running
the unit test; against that tag the fix was to override the
visitSafeQualifiedExpression() function with the same logic as
visitCallExpression().
@codecov
Copy link
Copy Markdown

codecov bot commented May 26, 2022

Codecov Report

Merging #4864 (a43bc03) into main (fcd9c48) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main    #4864   +/-   ##
=========================================
  Coverage     84.79%   84.79%           
  Complexity     3447     3447           
=========================================
  Files           492      492           
  Lines         11315    11315           
  Branches       2083     2083           
=========================================
  Hits           9595     9595           
  Misses          673      673           
  Partials       1047     1047           

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 fcd9c48...a43bc03. Read the comment docs.

@dzirbel
Copy link
Copy Markdown
Contributor Author

dzirbel commented May 26, 2022

Hm, looks like some a checks on windows failed due to gradle running out of memory; is there any easy way to re-run the check?

@schalkms schalkms added this to the 1.21.0 milestone May 27, 2022
@schalkms schalkms merged commit 2e2d471 into detekt:main May 27, 2022
@dzirbel dzirbel deleted the unnecessaryInnerClassSafeQualified branch May 27, 2022 07:21
@schalkms
Copy link
Copy Markdown
Member

CI on Windows is sometimes flaky in this repo. Therefore, I triggered a rerun.
Thanks for the PR btw!

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.

2 participants