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 UseSumOfInsteadOfFlatMapSize rule #5405
Conversation
.../src/test/kotlin/io/gitlab/arturbosch/detekt/rules/style/UseSumOfInsteadOfFlatMapSizeSpec.kt
Fixed
Show fixed
Hide fixed
2a131fc
to
4bb4b58
Compare
4bb4b58
to
9e7e38a
Compare
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.
Thank you, as always, for your valuable contributions :)
class Bar(val bar: Set<Int>) | ||
""".trimIndent() | ||
val actual = subject.compileAndLintWithContext(env, code) | ||
assertThat(actual).hasSize(1) |
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.
Could you add some tests to ensure that this rule doesn't flag all the flatMap
calls?
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.
@DisplayName("Reports flatMap and size") | ||
fun reportFlatMapAndSize() { |
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.
What's the reason why this is not:
fun `reports flatMap and size`() {
It seems like this goes a bit against the rest of the codebase convention.
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.
Fixes #5399