Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[FIXED JENKINS-11761] Inverted initialization of new warnings
computation: if not yet set then the new warnings are computed.
  • Loading branch information
uhafner committed Dec 8, 2011
1 parent e028411 commit 96fdcec2f65f41336886052b7dd3c5ebfb690d5e
Showing 2 changed files with 32 additions and 10 deletions.
@@ -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}.
@@ -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;
@@ -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 + "] ";
}
@@ -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());
@@ -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;
}

/**
@@ -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. */
@@ -90,7 +90,7 @@
*
* @since 1.34
*/
private final boolean canComputeNew;
private final boolean dontComputeNew;

/**
* Creates a new instance of <code>HealthReportingMavenReporter</code>.
@@ -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;
@@ -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;
}

/**
@@ -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();

0 comments on commit 96fdcec

Please sign in to comment.