Skip to content
Permalink
Browse files

[JENKINS-8470] Added option to disable plug-ins from collection.

  • Loading branch information
uhafner committed Jun 15, 2011
1 parent fd844f0 commit aaefc37c1a7be4efdf02d2928ed0380113581d48
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
@@ -42,6 +42,19 @@
/** Unique ID of this class. */
private static final long serialVersionUID = 5512072640635006098L;

/** @since 1.15. */
private final boolean isCheckStyleDeactivated;
/** @since 1.15. */
private final boolean isDryDeactivated;
/** @since 1.15. */
private final boolean isFindBugsDeactivated;
/** @since 1.15. */
private final boolean isPmdDeactivated;
/** @since 1.15. */
private final boolean isOpenTasksDeactivated;
/** @since 1.15. */
private final boolean isWarningsDeactivated;

/**
* Creates a new instance of {@link AnalysisPublisher}.
*
@@ -92,6 +105,18 @@
* annotation threshold
* @param failedNewLow
* annotation threshold
* @param isCheckStyleActivated
* determines whether to collect the warnings from Checkstyle
* @param isDryActivated
* determines whether to collect the warnings from DRY
* @param isFindBugsActivated
* determines whether to collect the warnings from FindBugs
* @param isPmdActivated
* determines whether to collect the warnings from PMD
* @param isOpenTasksActivated
* determines whether to collect open tasks
* @param isWarningsActivated
* determines whether to collect compiler warnings
*/
// CHECKSTYLE:OFF
@SuppressWarnings("PMD.ExcessiveParameterList")
@@ -101,16 +126,79 @@ public AnalysisPublisher(final String healthy, final String unHealthy, final Str
final String unstableTotalAll, final String unstableTotalHigh, final String unstableTotalNormal, final String unstableTotalLow,
final String unstableNewAll, final String unstableNewHigh, final String unstableNewNormal, final String unstableNewLow,
final String failedTotalAll, final String failedTotalHigh, final String failedTotalNormal, final String failedTotalLow,
final String failedNewAll, final String failedNewHigh, final String failedNewNormal, final String failedNewLow) {
final String failedNewAll, final String failedNewHigh, final String failedNewNormal, final String failedNewLow,
final boolean isCheckStyleActivated, final boolean isDryActivated,
final boolean isFindBugsActivated, final boolean isPmdActivated,
final boolean isOpenTasksActivated, final boolean isWarningsActivated) {
super(healthy, unHealthy, thresholdLimit, defaultEncoding, useDeltaValues,
unstableTotalAll, unstableTotalHigh, unstableTotalNormal, unstableTotalLow,
unstableNewAll, unstableNewHigh, unstableNewNormal, unstableNewLow,
failedTotalAll, failedTotalHigh, failedTotalNormal, failedTotalLow,
failedNewAll, failedNewHigh, failedNewNormal, failedNewLow,
true, false, "ANALYSIS-COLLECTOR");
isDryDeactivated = !isDryActivated;
isFindBugsDeactivated = !isFindBugsActivated;
isPmdDeactivated = !isPmdActivated;
isOpenTasksDeactivated = !isOpenTasksActivated;
isWarningsDeactivated = !isWarningsActivated;
isCheckStyleDeactivated = !isCheckStyleActivated;
}
// CHECKSTYLE:ON

/**
* Returns whether CheckStyle results should be collected.
*
* @return <code>true</code> if CheckStyle results should be collected, <code>false</code> otherwise
*/
public boolean isCheckStyleActivated() {
return !isCheckStyleDeactivated;
}

/**
* Returns whether DRY results should be collected.
*
* @return <code>true</code> if DRY results should be collected, <code>false</code> otherwise
*/
public boolean isDryActivated() {
return !isDryDeactivated;
}

/**
* Returns whether FindBugs results should be collected.
*
* @return <code>true</code> if FindBugs results should be collected, <code>false</code> otherwise
*/
public boolean isFindBugsActivated() {
return !isFindBugsDeactivated;
}

/**
* Returns whether PMD results should be collected.
*
* @return <code>true</code> if PMD results should be collected, <code>false</code> otherwise
*/
public boolean isPmdActivated() {
return !isPmdDeactivated;
}

/**
* Returns whether open tasks should be collected.
*
* @return <code>true</code> if open tasks should be collected, <code>false</code> otherwise
*/
public boolean isOpenTasksActivated() {
return !isOpenTasksDeactivated;
}

/**
* Returns whether compiler warnings results should be collected.
*
* @return <code>true</code> if compiler warnings results should be collected, <code>false</code> otherwise
*/
public boolean isWarningsActivated() {
return !isWarningsDeactivated;
}

/**
* Initializes the plug-ins that should participate in the results of this
* analysis collector.
@@ -121,27 +209,27 @@ public AnalysisPublisher(final String healthy, final String unHealthy, final Str
ArrayList<Class<? extends ResultAction<? extends BuildResult>>> pluginResults;
pluginResults = new ArrayList<Class<? extends ResultAction<? extends BuildResult>>>();

if (AnalysisDescriptor.isCheckStyleInstalled()) {
if (AnalysisDescriptor.isCheckStyleInstalled() && isCheckStyleActivated()) {
pluginResults.add(CheckStyleResultAction.class);
pluginResults.add(CheckStyleMavenResultAction.class);
}
if (AnalysisDescriptor.isDryInstalled()) {
if (AnalysisDescriptor.isDryInstalled() && isDryActivated()) {
pluginResults.add(DryResultAction.class);
pluginResults.add(DryMavenResultAction.class);
}
if (AnalysisDescriptor.isFindBugsInstalled()) {
if (AnalysisDescriptor.isFindBugsInstalled() && isFindBugsActivated()) {
pluginResults.add(FindBugsResultAction.class);
pluginResults.add(FindBugsMavenResultAction.class);
}
if (AnalysisDescriptor.isPmdInstalled()) {
if (AnalysisDescriptor.isPmdInstalled() && isPmdActivated()) {
pluginResults.add(PmdResultAction.class);
pluginResults.add(PmdMavenResultAction.class);
}
if (AnalysisDescriptor.isOpenTasksInstalled()) {
if (AnalysisDescriptor.isOpenTasksInstalled() && isOpenTasksActivated()) {
pluginResults.add(TasksResultAction.class);
pluginResults.add(TasksMavenResultAction.class);
}
if (AnalysisDescriptor.isWarningsInstalled()) {
if (AnalysisDescriptor.isWarningsInstalled() && isWarningsActivated()) {
pluginResults.add(WarningsResultAction.class);
}

@@ -1,5 +1,35 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:u="/util">
<j:if test="${descriptor.isCheckStyleInstalled()}">
<f:entry title="%{Checkstyle warnings}">
<f:checkbox name="isCheckStyleActivated" checked="${h.defaultToTrue(instance.isCheckStyleActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isDryInstalled()}">
<f:entry title="%{Duplicate code warnings}">
<f:checkbox name="isDryActivated" checked="${h.defaultToTrue(instance.isDryActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isFindBugsInstalled()}">
<f:entry title="%{FindBugs warnings}">
<f:checkbox name="isFindBugsActivated" checked="${h.defaultToTrue(instance.isFindBugsActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isPmdInstalled()}">
<f:entry title="%{PMD warnings}">
<f:checkbox name="isPmdActivated" checked="${h.defaultToTrue(instance.isPmdActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isOpenTasksInstalled()}">
<f:entry title="%{Open tasks}">
<f:checkbox name="isOpenTasksActivated" checked="${h.defaultToTrue(instance.isOpenTasksActivated())}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.isWarningsInstalled()}">
<f:entry title="%{Compiler warnings}">
<f:checkbox name="isWarningsActivated" checked="${h.defaultToTrue(instance.isWarningsActivated())}"/>
</f:entry>
</j:if>
<f:advanced>
<u:health id="analysis"/>
<u:thresholds id="analysis"/>

0 comments on commit aaefc37

Please sign in to comment.
You can’t perform that action at this time.