<commit_before>package io.jenkins.plugins.analysis.core.model;

import java.util.stream.Collectors;

import io.jenkins.plugins.analysis.core.views.ResultAction;

import static j2html.TagCreator.*;
import j2html.tags.ContainerTag;

import edu.hm.hafner.util.VisibleForTesting;

/**
 * Summary message of a static analysis run. This message is shown as part of the 'summary.jelly' information of the
 * associated {@link ResultAction}.
 * <pre>
 *     Tool Name: %d issues from %d analyses
 *        - Results from analyses {%s, ... %s}
 *        - %d new issues (since build %d)
 *        - %d outstanding issues
 *        - %d fixed issues
 *        - No issues since build %d
 *        - Quality gates: passed (Reference build %d)
 * </pre>
 *
 * @author <NAME>
 */
// FIXME: is the number of parsed reports available yet?
public class Summary {
    private final StaticAnalysisLabelProvider labelProvider;
    private final AnalysisResult analysisRun;
    private final LabelProviderFactoryFacade facade;

    public Summary(final StaticAnalysisLabelProvider labelProvider, final AnalysisResult analysisRun) {
        this(labelProvider, analysisRun, new LabelProviderFactoryFacade());
    }

    @VisibleForTesting
    Summary(final StaticAnalysisLabelProvider labelProvider, final AnalysisResult analysisRun,
            final LabelProviderFactoryFacade facade) {
        this.labelProvider = labelProvider;
        this.analysisRun = analysisRun;
        this.facade = facade;
    }

    /**
     * Creates the summary as HTML string.
     *
     * @return the summary
     */
    public String create() {
        return div(labelProvider.getTitle(analysisRun, analysisRun.getErrorMessages().isEmpty()), createDescription())
                .withId(labelProvider.getId() + "-summary")
                .renderFormatted();
    }

    private ContainerTag createDescription() {
        int currentBuild = analysisRun.getBuild().getNumber();
        return ul()
                .condWith(analysisRun.getSizePerOrigin().size() > 1,
                        li(getToolNames()))
                .condWith(analysisRun.getTotalSize() == 0
                                && currentBuild > analysisRun.getNoIssuesSinceBuild(),
                        li(labelProvider.getNoIssuesSinceLabel(currentBuild, analysisRun.getNoIssuesSinceBuild())))
                .condWith(analysisRun.getNewSize() > 0,
                        li(labelProvider.getNewIssuesLabel(analysisRun.getNewSize())))
                .condWith(analysisRun.getFixedSize() > 0,
                        li(labelProvider.getFixedIssuesLabel(analysisRun.getFixedSize())))
                .condWith(analysisRun.getQualityGate().isEnabled(),
                        li(labelProvider.getQualityGateResult(analysisRun.getOverallResult(),
                                analysisRun.getReferenceBuild())));
    }
<commit_msg>Inverted icon.<commit_after>package io.jenkins.plugins.analysis.core.model;

import java.util.stream.Collectors;

import io.jenkins.plugins.analysis.core.views.ResultAction;

import static j2html.TagCreator.*;
import j2html.tags.ContainerTag;

import edu.hm.hafner.util.VisibleForTesting;

/**
 * Summary message of a static analysis run. This message is shown as part of the 'summary.jelly' information of the
 * associated {@link ResultAction}.
 * <pre>
 *     Tool Name: %d issues from %d analyses
 *        - Results from analyses {%s, ... %s}
 *        - %d new issues (since build %d)
 *        - %d outstanding issues
 *        - %d fixed issues
 *        - No issues since build %d
 *        - Quality gates: passed (Reference build %d)
 * </pre>
 *
 * @author <NAME>
 */
// FIXME: is the number of parsed reports available yet?
public class Summary {
    private final StaticAnalysisLabelProvider labelProvider;
    private final AnalysisResult analysisRun;
    private final LabelProviderFactoryFacade facade;

    public Summary(final StaticAnalysisLabelProvider labelProvider, final AnalysisResult analysisRun) {
        this(labelProvider, analysisRun, new LabelProviderFactoryFacade());
    }

    @VisibleForTesting
    Summary(final StaticAnalysisLabelProvider labelProvider, final AnalysisResult analysisRun,
            final LabelProviderFactoryFacade facade) {
        this.labelProvider = labelProvider;
        this.analysisRun = analysisRun;
        this.facade = facade;
    }

    /**
     * Creates the summary as HTML string.
     *
     * @return the summary
     */
    public String create() {
        return div(labelProvider.getTitle(analysisRun, !analysisRun.getErrorMessages().isEmpty()), createDescription())
                .withId(labelProvider.getId() + "-summary")
                .renderFormatted();
    }

    private ContainerTag createDescription() {
        int currentBuild = analysisRun.getBuild().getNumber();
        return ul()
                .condWith(analysisRun.getSizePerOrigin().size() > 1,
                        li(getToolNames()))
                .condWith(analysisRun.getTotalSize() == 0
                                && currentBuild > analysisRun.getNoIssuesSinceBuild(),
                        li(labelProvider.getNoIssuesSinceLabel(currentBuild, analysisRun.getNoIssuesSinceBuild())))
                .condWith(analysisRun.getNewSize() > 0,
                        li(labelProvider.getNewIssuesLabel(analysisRun.getNewSize())))
                .condWith(analysisRun.getFixedSize() > 0,
                        li(labelProvider.getFixedIssuesLabel(analysisRun.getFixedSize())))
                .condWith(analysisRun.getQualityGate().isEnabled(),
                        li(labelProvider.getQualityGateResult(analysisRun.getOverallResult(),
                                analysisRun.getReferenceBuild())));
    }

{'fraction_non_alphanumeric': 0.09798471160528145, 'fraction_numerical': 0.0020847810979847115, 'mean_word_length': 2.5958775765146784, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2369850', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1441, 'n_words': 341}