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

Add UseSumOfInsteadOfFlatMapSize rule #5405

Merged
merged 2 commits into from Oct 14, 2022
Merged

Conversation

t-kameyama
Copy link
Contributor

Fixes #5399

@github-actions github-actions bot added the rules label Oct 12, 2022
@github-actions
Copy link

github-actions bot commented Oct 12, 2022

Messages
📖 Thanks for adding a new rule to Detekt ❤️

Generated by 🚫 dangerJS against dcb4891

Copy link
Collaborator

@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.

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)
Copy link
Collaborator

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BraisGabin BraisGabin added this to the 1.22.0 milestone Oct 14, 2022
@BraisGabin BraisGabin merged commit 9f4b0ca into detekt:main Oct 14, 2022
21 checks passed
@t-kameyama t-kameyama deleted the issue_5399 branch October 14, 2022 20:48
@cortinico cortinico added the notable changes Marker for notable changes in the changelog label Oct 14, 2022
@DisplayName("Reports flatMap and size")
fun reportFlatMapAndSize() {
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notable changes Marker for notable changes in the changelog rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New rule: UseSumInsteadOfFlatMapSize
4 participants