Skip to content
Permalink
Browse files
[JENKINS-30103] @jglick's comments have been reviewed
  • Loading branch information
Manuel Recena authored and recena committed Aug 25, 2015
1 parent 667bf23 commit 0f8c4d35c5b2a87e6b3a0fbb7aedbef51c2211f5
@@ -40,15 +40,13 @@
private String pattern;

/** Minimum number of duplicate lines for high priority warnings. @since 2.5 */
private int highThreshold;
private int highThreshold = 50;
/** Minimum number of duplicate lines for normal priority warnings. @since 2.5 */
private int normalThreshold;
private int normalThreshold = 25;

@DataBoundConstructor
public DryPublisher(final int highThreshold, final int normalThreshold) {
public DryPublisher() {
super(PLUGIN_NAME);
this.highThreshold = highThreshold;
this.normalThreshold = normalThreshold;
}

/**
@@ -86,6 +84,16 @@ public void setPattern(final String pattern) {
this.pattern = pattern;
}

@DataBoundSetter
public void setHighThreshold(final int highThreshold) {
this.highThreshold = highThreshold;
}

@DataBoundSetter
public void setNormalThreshold(final int normalThreshold) {
this.normalThreshold = normalThreshold;
}

@Override
public Action getProjectAction(final AbstractProject<?, ?> project) {
return new DryProjectAction(project);
@@ -96,17 +104,16 @@ public BuildResult perform(final Run<?, ?> build, final FilePath workspace, fina
InterruptedException, IOException {
logger.log("Collecting duplicate code analysis files...");

FilesParser dryCollector = new FilesParser(PLUGIN_NAME, StringUtils.defaultIfEmpty(getPattern(),
DEFAULT_DRY_PATTERN),
new DuplicationParserRegistry(getNormalThreshold(), getHighThreshold(), workspace.getRemote(),
getDefaultEncoding()),
shouldDetectModules(), isMavenBuild(build));
FilesParser dryCollector = new FilesParser(PLUGIN_NAME, StringUtils.defaultIfEmpty(getPattern(), DEFAULT_DRY_PATTERN),
new DuplicationParserRegistry(getNormalThreshold(), getHighThreshold(), workspace.getRemote(),
getDefaultEncoding()),
shouldDetectModules(), isMavenBuild(build));

ParserResult project = workspace.act(dryCollector);
logger.logLines(project.getLogMessages());

DryResult result = new DryResult(build, getDefaultEncoding(), project, usePreviousBuildAsReference(),
useOnlyStableBuildsAsReference());
DryResult result = new DryResult(build, getDefaultEncoding(), project,
usePreviousBuildAsReference(), useOnlyStableBuildsAsReference());
build.addAction(new DryResultAction(build, this, result));

return result;
@@ -1,6 +1,5 @@
package hudson.plugins.dry;

import hudson.model.AbstractBuild;
import hudson.model.Run;
import hudson.plugins.analysis.core.ParserResult;
import hudson.plugins.analysis.core.ResultAction;
@@ -38,7 +38,7 @@ public void dryPublisherWorkflowStep() throws Exception {
+ "node {\n"
+ " def mvnHome = tool '" + mavenInstallation.getName() + "'\n"
+ " sh \"${mvnHome}/bin/mvn clean install\"\n"
+ " step([$class: 'DryPublisher', highThreshold: 50, normalThreshold: 25])\n"
+ " step([$class: 'DryPublisher'])\n"
+ "}\n", true)
);
jenkinsRule.assertBuildStatusSuccess(job.scheduleBuild2(0));

0 comments on commit 0f8c4d3

Please sign in to comment.