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
Add new rule CouldBeSequence #4855
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff 🎉 Thanks for sendign this over!
...ormance/src/test/kotlin/io/gitlab/arturbosch/detekt/rules/performance/CouldBeSequenceSpec.kt
Show resolved
Hide resolved
...performance/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/performance/CouldBeSequence.kt
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## main #4855 +/- ##
============================================
+ Coverage 84.75% 84.80% +0.05%
- Complexity 3431 3477 +46
============================================
Files 491 494 +3
Lines 11278 11395 +117
Branches 2076 2099 +23
============================================
+ Hits 9559 9664 +105
- Misses 673 676 +3
- Partials 1046 1055 +9
Continue to review full report at Codecov.
|
@BraisGabin I don't think that the rule actually does completely resolve this issue. It only looks for a subset of the operations that can be chained. The rule should also apply for something like |
I agree with you, I would track that as an improvement or false negative on this rule. Can you define the missing cases in an issue and/or open a PR fixing those? |
My attempt at #4838
Some inspiration taken from
UnnecessaryFilter
, and theisCalling
method is stolen from there. (why re-invent the wheel?). A little unsure about the documentation parts, so very happy to hear about possible improvements. Would also love to hear if the code could be done in a more functional style that I might have missed.