gnodet-bot commented on code in PR #13547:
URL: https://github.com/apache/maven/pull/13547#discussion_r4298027009
##########
impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultLifecycleRegistry.java:
##########
@@ -154,9 +157,12 @@ public Stream<Lifecycle> stream() {
lookup.lookupList(LifecycleProvider.class).stream()
.flatMap(p -> p.provides().stream())
.forEach(lf -> result.put(lf.id(), lf));
- return result.values().stream();
+ return result.values().stream().filter(lf -> !SITE_DISABLED ||
!Lifecycle.SITE.equals(lf.id()));
}
- return
providers.stream().map(ExtensibleEnumProvider::provides).flatMap(Collection::stream);
+ return providers.stream()
+ .map(ExtensibleEnumProvider::provides)
+ .flatMap(Collection::stream)
+ .filter(lf -> !SITE_DISABLED ||
!Lifecycle.SITE.equals(lf.id()));
Review Comment:
💡 **Nit:** Same filter predicate as line 160 — consider extracting to a
`Predicate<Lifecycle>` constant to avoid duplication:
```suggestion
.filter(lf -> !SITE_DISABLED ||
!Lifecycle.SITE.equals(lf.id()));
```
Or extract it:
```java
private static final Predicate<Lifecycle> SITE_FILTER =
lf -> !SITE_DISABLED || !Lifecycle.SITE.equals(lf.id());
```
Not a blocker.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]