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

Extend MonoIdentity Refaster rule #465

Merged
merged 2 commits into from
Jan 17, 2023
Merged

Conversation

werli
Copy link
Member

@werli werli commented Jan 16, 2023

After applying EPS on a repository, I've noticed essentially the following interesting pattern:

Mono.<Void>empty().flux().next()
  • Mono#flux() converts the Mono to a Flux as-is.
  • Flux#next() however simply takes the first element in the Flux or returns empty without any side-effects (contrary to Flux#single()).

So, this is practically a no-op.

Suggested commit message

Extend `MonoIdentity` Refaster rule (#465)

By flagging expressions of the form `mono.flux().next()`.

@werli werli added this to the 0.8.0 milestone Jan 16, 2023
@github-actions
Copy link

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@github-actions
Copy link

Looks good. No mutations were possible for these changes.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

Copy link
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

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

Makes sense! Extended the suggested commit message.

@rickie rickie merged commit 82a07fd into master Jan 17, 2023
@rickie rickie deleted the werli/mono-identity-flux-next branch January 17, 2023 06:33
@rickie
Copy link
Member

rickie commented Jan 17, 2023

Nice @werli 🚀!

@werli
Copy link
Member Author

werli commented Jan 17, 2023

@Stephan202 & @rickie insane review speed, thanks!

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

Successfully merging this pull request may close these issues.

3 participants