private void renderViolationsTable()

in src/main/java/org/apache/maven/plugins/pmd/PmdReportRenderer.java [256:293]


    private void renderViolationsTable(Collection<Violation> violationSegment) {
        List<Violation> violationSegmentCopy = new ArrayList<>(violationSegment);
        Collections.sort(violationSegmentCopy, new Comparator<Violation>() {
            /** {@inheritDoc} */
            public int compare(Violation o1, Violation o2) {
                int filenames = o1.getFileName().compareTo(o2.getFileName());
                if (filenames == 0) {
                    return o1.getBeginline() - o2.getBeginline();
                } else {
                    return filenames;
                }
            }
        });

        boolean fileSectionStarted = false;
        String previousFilename = null;
        for (Violation ruleViolation : violationSegmentCopy) {
            String currentFn = ruleViolation.getFileName();
            PmdFileInfo fileInfo = determineFileInfo(currentFn);

            if (!currentFn.equalsIgnoreCase(previousFilename) && fileSectionStarted) {
                endFileSection();
                fileSectionStarted = false;
            }
            if (!fileSectionStarted) {
                startFileSection(currentFn, fileInfo);
                fileSectionStarted = true;
            }

            renderSingleRuleViolation(ruleViolation, fileInfo);

            previousFilename = currentFn;
        }

        if (fileSectionStarted) {
            endFileSection();
        }
    }