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

Commit

Permalink
[FIXED JENKINS-11761] Inverted initialization of new warnings
Browse files Browse the repository at this point in the history
computation: if not yet set then the new warnings are computed.
  • Loading branch information
uhafner committed Dec 8, 2011
1 parent e028411 commit 96fdcec
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
Expand Up @@ -97,7 +97,7 @@ public abstract class HealthAwarePublisher extends Recorder implements HealthDes
*
* @since 1.34
*/
private final boolean canComputeNew;
private final boolean dontComputeNew;

/**
* Creates a new instance of {@link HealthAwarePublisher}.
Expand Down Expand Up @@ -175,7 +175,7 @@ public HealthAwarePublisher(final String healthy, final String unHealthy, final
this.defaultEncoding = defaultEncoding;

this.useDeltaValues = useDeltaValues;
this.canComputeNew = canComputeNew;
dontComputeNew = !canComputeNew;

thresholds.unstableTotalAll = unstableTotalAll;
thresholds.unstableTotalHigh = unstableTotalHigh;
Expand Down Expand Up @@ -290,7 +290,7 @@ public HealthAwarePublisher(final String threshold, final String newThreshold,
this.defaultEncoding = defaultEncoding;
this.useDeltaValues = useDeltaValues;
this.canRunOnFailed = canRunOnFailed;
canComputeNew = true;
dontComputeNew = false;
shouldDetectModules = false;
this.pluginName = "[" + pluginName + "] ";
}
Expand Down Expand Up @@ -344,7 +344,7 @@ public final boolean perform(final AbstractBuild<?, ?> build, final Launcher lau
}

if (new NullHealthDescriptor(this).isThresholdEnabled()) {
result.evaluateStatus(getThresholds(), useDeltaValues, canComputeNew, logger);
result.evaluateStatus(getThresholds(), useDeltaValues, canComputeNew(), logger);
}

copyFilesWithAnnotationsToBuildFolder(build.getRootDir(), launcher.getChannel(), result.getAnnotations());
Expand Down Expand Up @@ -443,7 +443,18 @@ private void logExceptionToFile(final IOException exception, final File masterFi
* respect to baseline), <code>false</code> otherwise
*/
public boolean getCanComputeNew() {
return canComputeNew;
return canComputeNew();
}

/**
* Returns whether new warnings should be computed (with respect to
* baseline).
*
* @return <code>true</code> if new warnings should be computed (with
* respect to baseline), <code>false</code> otherwise
*/
public boolean canComputeNew() {
return !dontComputeNew;
}

/**
Expand Down Expand Up @@ -618,7 +629,7 @@ public String getThresholdLimit() {

/** {@inheritDoc} */
public BuildStepMonitor getRequiredMonitorService() {
return canComputeNew ? BuildStepMonitor.STEP : BuildStepMonitor.NONE;
return canComputeNew() ? BuildStepMonitor.STEP : BuildStepMonitor.NONE;
}

/** Annotation threshold to be reached if a build should be considered as unstable. */
Expand Down
Expand Up @@ -90,7 +90,7 @@ public abstract class HealthAwareReporter<T extends BuildResult> extends MavenRe
*
* @since 1.34
*/
private final boolean canComputeNew;
private final boolean dontComputeNew;

/**
* Creates a new instance of <code>HealthReportingMavenReporter</code>.
Expand Down Expand Up @@ -161,7 +161,7 @@ public HealthAwareReporter(final String healthy, final String unHealthy, final S
this.unHealthy = unHealthy;
this.thresholdLimit = thresholdLimit;
this.canRunOnFailed = canRunOnFailed;
this.canComputeNew = canComputeNew;
this.dontComputeNew = !canComputeNew;
this.pluginName = "[" + pluginName + "] ";

this.useDeltaValues = useDeltaValues;
Expand Down Expand Up @@ -214,7 +214,18 @@ public HealthAwareReporter(final String healthy, final String unHealthy, final S
* respect to baseline), <code>false</code> otherwise
*/
public boolean getCanComputeNew() {
return canComputeNew;
return canComputeNew();
}

/**
* Returns whether new warnings should be computed (with respect to
* baseline).
*
* @return <code>true</code> if new warnings should be computed (with
* respect to baseline), <code>false</code> otherwise
*/
public boolean canComputeNew() {
return !dontComputeNew;
}

/**
Expand Down Expand Up @@ -326,7 +337,7 @@ private String registerResults(final ParserResult result, final MavenBuild maven
T buildResult = createResult(mavenBuild, result);

StringPluginLogger pluginLogger = new StringPluginLogger(pluginName);
buildResult.evaluateStatus(thresholds, useDeltaValues, canComputeNew, pluginLogger);
buildResult.evaluateStatus(thresholds, useDeltaValues, canComputeNew(), pluginLogger);
mavenBuild.getActions().add(createMavenAggregatedReport(mavenBuild, buildResult));
mavenBuild.registerAsProjectAction(HealthAwareReporter.this);
return pluginLogger.toString();
Expand Down

0 comments on commit 96fdcec

Please sign in to comment.