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

Introduce FluxCollect Refaster rule #713

Closed
wants to merge 1 commit into from

Conversation

rickie
Copy link
Member

@rickie rickie commented Jul 5, 2023

As suggested by @Stephan202 in this PR.

@rickie rickie added this to the 0.13.0 milestone Jul 5, 2023
@rickie rickie requested a review from Stephan202 July 5, 2023 11:36
@github-actions
Copy link

github-actions bot commented Jul 5, 2023

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.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 5, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@rickie rickie removed the new feature label Jul 5, 2023
@rickie
Copy link
Member Author

rickie commented Jul 5, 2023

Ofcourse, how could I forget about this one....

Warning: /home/runner/work/error-prone-support/error-prone-support/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/ReactorRules.java:[1187,44] [NonEmptyMono] Avoid vacuous operations on known non-empty Monos
(see https://error-prone.picnic.tech/bugpatterns/NonEmptyMono)
Did you mean 'return flux.collect(collector);'?

It's funny that I got a few questions during some of the presentations about how to make sure that you do not have overlapping rules. I'm glad that I can explain the epic self-check to those people 😄.

Will close this.

@rickie rickie closed this Jul 5, 2023
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. Suggested commit message:

Introduce `FluxCollect` Refaster rule (#713)

@@ -1180,6 +1180,19 @@ Flux<T> after(Flux<T> flux, Predicate<? super T> predicate, Comparator<? super T
}
}

/* Don't unnecessarily invoke {@link Mono#single()} as {@link Flux#collect(Collector)} always yields one item. */
Copy link
Member

Choose a reason for hiding this comment

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

Javadoc :)

/* Don't unnecessarily invoke {@link Mono#single()} as {@link Flux#collect(Collector)} always yields one item. */
static final class FluxCollect<T, R> {
@BeforeTemplate
Mono<R> before(Flux<T> flux, Collector<T, ?, R> collector) {
Copy link
Member

Choose a reason for hiding this comment

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

The collector accepts a super T.

@Stephan202
Copy link
Member

Doh, I had an old tab open 😛

@rickie
Copy link
Member Author

rickie commented Jul 6, 2023

Thanks for the review though @Stephan202 😉.

@Stephan202 Stephan202 removed this from the 0.13.0 milestone Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants