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 MonoThen Refaster rule #1556

Merged
merged 3 commits into from
Feb 24, 2025
Merged

Conversation

mohamedsamehsalah
Copy link
Contributor

@mohamedsamehsalah mohamedsamehsalah commented Feb 20, 2025

  • Mono#when aggregates multiple publishers into one Mono<Void>, passing only one publisher to the argument is redundant and can be re-fastered into a Mono#then.

Suggested commit message

Extend `MonoThen` Refaster rule (#1556)

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

@rickie rickie left a comment

Choose a reason for hiding this comment

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

Suggested commit message:

Extend `MonoThen` Refaster rule (#1556)

@rickie rickie added this to the 0.21.0 milestone Feb 21, 2025
@Stephan202 Stephan202 changed the title Refaster redundant Mono#when statements Extend MonoThen Refaster rule (#1556) Feb 22, 2025
@Stephan202 Stephan202 changed the title Extend MonoThen Refaster rule (#1556) Extend MonoThen Refaster rule Feb 22, 2025
@Stephan202 Stephan202 force-pushed the mohamedsamehsalah/mono-when-then branch from 418fc05 to a985e47 Compare February 22, 2025 12:28
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.

Rebased and added a commit. Nice one; tnx @mohamedsamehsalah!

@rickie feel free to merge if you agree with the latest change.

@@ -939,7 +939,7 @@ Flux<T> after(Mono<T> mono) {
static final class MonoThen<T> {
@BeforeTemplate
Mono<@Nullable Void> before(Mono<T> mono) {
return Refaster.anyOf(mono.ignoreElement().then(), mono.flux().then());
return Refaster.anyOf(mono.ignoreElement().then(), mono.flux().then(), Mono.when(mono));
Copy link
Member

Choose a reason for hiding this comment

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

We can also add Mono.whenDelayError(mono).

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.

1 similar comment
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.

@rickie rickie force-pushed the mohamedsamehsalah/mono-when-then branch from 59b1169 to ec33dd8 Compare February 24, 2025 07:35
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.

@rickie rickie merged commit db53631 into master Feb 24, 2025
17 checks passed
@rickie rickie deleted the mohamedsamehsalah/mono-when-then branch February 24, 2025 08:09
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