Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[JENKINS-9090] Added project configuration option to activate
scanning of workspace for build.xml and pom.xml files to detect
the module names of warnings.
  • Loading branch information
uhafner committed Apr 7, 2011
1 parent b9f37be commit 84bda2973ea009bcdc8036bfeea1089053d2167f
Showing 1 changed file with 15 additions and 5 deletions.
@@ -92,6 +92,8 @@ public class DryPublisher extends HealthAwarePublisher {
* annotation threshold
* @param canRunOnFailed
* determines whether the plug-in can run for failed builds, too
* @param shouldDetectModules
* determines whether module names should be derived from Maven POM or Ant build files
* @param pattern
* Ant file-set pattern to scan for DRY files
* @param highThreshold
@@ -108,14 +110,14 @@ public DryPublisher(final String healthy, final String unHealthy, final String t
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 boolean canRunOnFailed,
final boolean canRunOnFailed, final boolean shouldDetectModules,
final String pattern, final int highThreshold, final int normalThreshold) {
super(healthy, unHealthy, thresholdLimit, defaultEncoding, useDeltaValues,
unstableTotalAll, unstableTotalHigh, unstableTotalNormal, unstableTotalLow,
unstableNewAll, unstableNewHigh, unstableNewNormal, unstableNewLow,
failedTotalAll, failedTotalHigh, failedTotalNormal, failedTotalLow,
failedNewAll, failedNewHigh, failedNewNormal, failedNewLow,
canRunOnFailed, "DRY");
canRunOnFailed, shouldDetectModules, "DRY");
this.pattern = pattern;
this.highThreshold = highThreshold;
this.normalThreshold = normalThreshold;
@@ -159,9 +161,17 @@ public Action getProjectAction(final AbstractProject<?, ?> project) {
@Override
public BuildResult perform(final AbstractBuild<?, ?> build, final PluginLogger logger) throws InterruptedException, IOException {
logger.log("Collecting duplicate code analysis files...");
FilesParser dryCollector = new FilesParser(logger, StringUtils.defaultIfEmpty(getPattern(), DEFAULT_DRY_PATTERN),
new DuplicationParserRegistry(getNormalThreshold(), getHighThreshold(), build.getWorkspace().getRemote()),
isMavenBuild(build), isAntBuild(build));

FilesParser dryCollector;
if (shouldDetectModules()) {
dryCollector = new FilesParser(logger, StringUtils.defaultIfEmpty(getPattern(), DEFAULT_DRY_PATTERN),
new DuplicationParserRegistry(getNormalThreshold(), getHighThreshold(), build.getWorkspace().getRemote()),
isMavenBuild(build), isAntBuild(build));
}
else {
dryCollector = new FilesParser(logger, StringUtils.defaultIfEmpty(getPattern(), DEFAULT_DRY_PATTERN),
new DuplicationParserRegistry(getNormalThreshold(), getHighThreshold(), build.getWorkspace().getRemote()));
}

ParserResult project = build.getWorkspace().act(dryCollector);
DryResult result = new DryResult(build, getDefaultEncoding(), project);

0 comments on commit 84bda29

Please sign in to comment.