Skip to content

Introduce UseAnyOrNoneInsteadOfFind rule#4247

Merged
BraisGabin merged 4 commits into
detekt:mainfrom
t-kameyama:issue_4243
Nov 10, 2021
Merged

Introduce UseAnyOrNoneInsteadOfFind rule#4247
BraisGabin merged 4 commits into
detekt:mainfrom
t-kameyama:issue_4243

Conversation

@t-kameyama

Copy link
Copy Markdown
Contributor

Fixes #4243

@BraisGabin

Copy link
Copy Markdown
Member

As always, thanks for the contributions :)

@t-kameyama t-kameyama requested a review from BraisGabin November 9, 2021 14:26
@codecov

codecov Bot commented Nov 9, 2021

Copy link
Copy Markdown

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
Copy Markdown
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
@t-kameyama t-kameyama requested a review from cortinico November 9, 2021 23:19
@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