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

UnnecessaryApply: fix false negative for assignment #4948

Merged
merged 1 commit into from Jun 27, 2022
Merged

UnnecessaryApply: fix false negative for assignment #4948

merged 1 commit into from Jun 27, 2022

Conversation

dzirbel
Copy link
Contributor

@dzirbel dzirbel commented Jun 12, 2022

Fix a missed case of UnnecessaryApply where the apply contains a single field assignment but the result of the apply{} is unused. This pattern is actually used in 2/3 of the <noncompliant> examples and while it occurred in tests for false positives, no test actually checked that warnings were generated in the simple case.

I only added a few tests for the simple cases to avoid duplicating a number of the ones for function calls; more could be added for completeness but it would bloat the test file considerably.

@cortinico cortinico added this to the 1.21.0 milestone Jun 13, 2022
Fix a missed case of UnnecessaryApply where the apply contains a single field assignment but the result of the apply{} is unused. This pattern is actually used in 2/3 of the <noncompliant> examples and while it occurred in tests for false positives, no test actually checked that warnings were generated in the simple case.
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.

Thanks!

@schalkms schalkms merged commit c8eb24c into detekt:main Jun 27, 2022
@dzirbel dzirbel deleted the unnecessaryApplyAssignment branch June 27, 2022 19:22
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.

None yet

4 participants