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

Map { it } must return an error #2975

Closed
VovaStelmashchuk opened this issue Aug 17, 2020 · 4 comments · Fixed by #3182
Closed

Map { it } must return an error #2975

VovaStelmashchuk opened this issue Aug 17, 2020 · 4 comments · Fixed by #3182

Comments

@VovaStelmashchuk
Copy link
Contributor

        val data = listOf(0, 1, 2)

        val output = data.map { it }

Expected Behavior of the rule

Detekt return an error. For example map operator don't map

Are Detekt has rule for the case?

@BraisGabin
Copy link
Member

Detekt doesn't have a rule to flag that but I think that it would be a nice addition. I saw this issue in my projects too. Do you have the resources to implement it and generate a PR?

@VovaStelmashchuk
Copy link
Contributor Author

Yep
We will do this in next week

@VovaStelmashchuk
Copy link
Contributor Author

@BraisGabin Do you have any suggest about name of the rule and category (style, complexity, e.g.) ?

@BraisGabin
Copy link
Member

I suppose that erroprone is the best fit. Or complexity... I mean, a map that does nothing only increase the complexity.

About the name what do you think about RedundantMap?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants