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

Introduce UseAnyOrNoneInsteadOfFind rule #4247

Merged
merged 4 commits into from
Nov 10, 2021
Merged

Conversation

t-kameyama
Copy link
Contributor

Fixes #4243

@BraisGabin
Copy link
Member

As always, thanks for the contributions :)

@codecov
Copy link

codecov bot commented Nov 9, 2021

Codecov Report

Merging #4247 (f1174c5) into main (6e20321) will decrease coverage by 0.03%.
The diff coverage is 69.44%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #4247      +/-   ##
============================================
- Coverage     84.32%   84.29%   -0.04%     
- Complexity     3243     3253      +10     
============================================
  Files           470      471       +1     
  Lines         10223    10261      +38     
  Branches       1787     1804      +17     
============================================
+ Hits           8621     8649      +28     
- Misses          663      664       +1     
- Partials        939      948       +9     
Impacted Files Coverage Δ
...tlab/arturbosch/detekt/rules/KtBinaryExpression.kt 0.00% <0.00%> (ø)
...gitlab/arturbosch/detekt/rules/KtCallExpression.kt 33.33% <50.00%> (+33.33%) ⬆️
...ch/detekt/rules/style/UseAnyOrNoneInsteadOfFind.kt 76.00% <76.00%> (ø)
...rturbosch/detekt/rules/style/StyleGuideProvider.kt 100.00% <100.00%> (ø)
...turbosch/detekt/rules/style/UnusedPrivateMember.kt 92.63% <0.00%> (+0.18%) ⬆️

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 6e20321...f1174c5. Read the comment docs.

it("Reports collections.find != null") {
val code = "val x = listOf(1, 2, 3).find { it == 4 } != null"
val actual = subject.compileAndLintWithContext(env, code)
Assertions.assertThat(actual).hasSize(1)
Copy link
Member

Choose a reason for hiding this comment

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

Can you import org.assertj.core.api.Assertions.assertThat so you won't have to repeat it in all the test?

@cortinico cortinico added this to the 1.19.0 milestone Nov 9, 2021
@cortinico cortinico added the rules label Nov 9, 2021
@BraisGabin BraisGabin merged commit dffde12 into detekt:main Nov 10, 2021
@t-kameyama t-kameyama deleted the issue_4243 branch November 10, 2021 08:37
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.

Rule: Use any instead of find
3 participants