During the development and review process of the disk health indicator we noticed that it was hard to understand. Since we learnt a lot from the first round of development we want to go through the code one more time and restructure it.
server/src/main/java/org/elasticsearch/health/node/DiskHealthIndicatorService.java
Set<String> yellowMasterNodes,
        Set<String> redNonDataNonMasterNodes,
        Set<String> yellowNonDataNonMasterNodes
    ) {
        List<Diagnosis> diagnosisList = new ArrayList<>();
        if (indicesWithBlock.isEmpty() == false
            || nodesWithBlockedIndices.isEmpty() == false
            || indicesOnRedNodes.isEmpty() == false
            || redDataNodes.isEmpty() == false
            || indicesOnYellowNodes.isEmpty() == false
            || yellowDataNodes.isEmpty() == false) {
            Set<String> impactedIndices = Stream.concat(
                Stream.concat(indicesWithBlock.stream(), indicesOnRedNodes.stream()),
                indicesOnYellowNodes.stream()
            ).collect(Collectors.toSet());
            Set<String> unhealthyNodes = Stream.concat(
                Stream.concat(nodesWithBlockedIndices.stream(), redDataNodes.stream()),
                yellowDataNodes.stream()
            ).collect(Collectors.toSet());
            diagnosisList.add(
                new Diagnosis(
                    new Diagnosis.Definition(
                        NAME,
                        "add_disk_capacity_data_nodes",
                        String.format(
                            Locale.ROOT,
                            "%d %s reside%s on nodes that have run out of space and writing has been blocked by the system.",
                            impactedIndices.size(),
                            impactedIndices.size() == 1 ? "index" : "indices",
                            impactedIndices.size() == 1 ? "s" : ""