Sonarlint not considering reduce operation

SonarLint: Refactor the code so this stream pipeline is used.
Inspection info:
Intermediate Stream methods should not be left unused
java:S3958

list
                 .getFields()
                 .values()
                 .stream()
                 .map(f -> api
                     .get(f.getId())
                     .thenApply(attr -> attr.map(a -> a.name))
                 )
                 .reduce(
                     CompletableFuture.completedFuture(new ArrayList<>()),
                     (a, b) -> null,
                     (a, b) -> null
                 );

Hi @pritam620

Sorry for the late reply, but I don’t see any problem here. The stream operation result should be used, else this is possibly dead code. Like:

List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
int result = numbers
  .stream()
  .reduce(0, (subtotal, element) -> subtotal + element);
assertThat(result).isEqualTo(21);

If you still encounter the issue, please provide a full reproducer.