Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[FIXED JENKINS-50551] The first build should not produce new issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed May 17, 2018
1 parent e36c3b2 commit 48bfcde
Showing 1 changed file with 16 additions and 6 deletions.
Expand Up @@ -55,6 +55,7 @@ public class AnalysisResult implements Serializable {
private static final Pattern ISSUES_FILE_NAME = Pattern.compile("issues.xml", Pattern.LITERAL);
private static final int NO_BUILD = -1;
private static final String NO_REFERENCE = StringUtils.EMPTY;
private static final Report EMPTY_REPORT = new Report();

private final String id;

Expand Down Expand Up @@ -209,29 +210,38 @@ protected AnalysisResult(final Run<?, ?> owner, final ReferenceProvider referenc
sizePerOrigin = report.getPropertyCount(Issue::getOrigin);
sizePerSeverity = report.getPropertyCount(Issue::getSeverity);

Report outstandingIssues;
Report newIssues;
Report fixedIssues;

Optional<Run<?, ?>> run = referenceProvider.getAnalysisRun();
if (run.isPresent()) {
Run<?, ?> referenceRun = run.get();
referenceJob = referenceRun.getParent().getFullName();
referenceBuild = referenceRun.getId();

IssueDifference difference = new IssueDifference(report, this.owner.getNumber(),
referenceProvider.getIssues());

outstandingIssues = difference.getOutstandingIssues();
newIssues = difference.getNewIssues();
fixedIssues = difference.getFixedIssues();
}
else {
referenceJob = NO_REFERENCE;
referenceBuild = StringUtils.EMPTY;

outstandingIssues = report;
newIssues = EMPTY_REPORT;
fixedIssues = EMPTY_REPORT;
}
Report referenceResult = referenceProvider.getIssues();
IssueDifference difference = new IssueDifference(report, this.owner.getNumber(), referenceResult);

Report outstandingIssues = difference.getOutstandingIssues();
outstandingIssuesReference = new WeakReference<>(outstandingIssues);

Report newIssues = difference.getNewIssues();
newIssuesReference = new WeakReference<>(newIssues);

newSize = newIssues.getSize();
newSizePerSeverity = newIssues.getPropertyCount(Issue::getSeverity);

Report fixedIssues = difference.getFixedIssues();
fixedIssuesReference = new WeakReference<>(fixedIssues);
fixedSize = fixedIssues.size();

Expand Down

0 comments on commit 48bfcde

Please sign in to comment.