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 FluxFromIterable Refaster rule #1047

Merged
merged 5 commits into from
Feb 22, 2024
Merged

Conversation

dirkvbok
Copy link
Contributor

@dirkvbok dirkvbok commented Feb 19, 2024

Based on an internal discussion, we found this case for a Refaster rule;

we can omit .stream() on a Collection and directly use Flux.fromIterable.

I wasn't sure about the order of rules and tests, so I placed them at the end, LMK if they need to move. :)

@dirkvbok dirkvbok requested a review from rickie February 19, 2024 13:20
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.

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.

Nice addition @dirkvbok 🚀!!! Added a commit with some minor suggestions :).

/**
* Don't unnecessarily convert {@link Collection} to {@link Stream} before creating {@link Flux}.
*/
static final class FluxFromIterable<T> {
Copy link
Member

Choose a reason for hiding this comment

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

I think a bit more up in the file makes sense, now they are below the StepVerifier rules. There is no strict pre-determined order yet, so right now I put it under the the "last" iterable related rule in the file.

@@ -1899,4 +1900,19 @@ Duration after(StepVerifier.LastStep step, Duration duration) {
return step.verifyTimeout(duration);
}
}

/**
* Don't unnecessarily convert {@link Collection} to {@link Stream} before creating {@link Flux}.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Don't unnecessarily convert {@link Collection} to {@link Stream} before creating {@link Flux}.
* Don't unnecessarily convert a {@link Collection} to a {@link Stream} before creating a {@link Flux}.

*/
static final class FluxFromIterable<T> {
@BeforeTemplate
Flux<T> before(Collection<T> c) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Flux<T> before(Collection<T> c) {
Flux<T> before(Collection<T> collection) {

In most cases, we use the full name collection :).

@rickie rickie force-pushed the dvbokkem/flux-from-iterable branch from 32b47d8 to 5dcd73b Compare February 20, 2024 09:51
@rickie rickie requested a review from Stephan202 February 20, 2024 09:51
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.

@Stephan202 Stephan202 force-pushed the dvbokkem/flux-from-iterable branch from 5dcd73b to da6eee2 Compare February 21, 2024 22:10
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.

Tnx @dirkvbok! Rebased and added a commit. Will let @rickie merge.

Comment on lines 1209 to 1212
/**
* Don't unnecessarily convert a {@link Collection} to a {@link Stream} before creating a {@link
* Flux}.
*/
Copy link
Member

Choose a reason for hiding this comment

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

I'll propose a slightly more generic message, that would also fit any additional @BeforeTemplate cases.

@Stephan202 Stephan202 added this to the 0.16.0 milestone Feb 21, 2024
@Stephan202
Copy link
Member

Suggested commit message:

Introduce `FluxFromIterable` Refaster rule (#1047)

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 dvbokkem/flux-from-iterable branch from da6eee2 to d93c1b1 Compare February 22, 2024 07:46
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

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@rickie rickie merged commit ded0a48 into master Feb 22, 2024
15 checks passed
@rickie rickie deleted the dvbokkem/flux-from-iterable branch February 22, 2024 08:17
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