Skip to content
Permalink
Browse files
JENKINS-31001 - Unable to save modified settings
  • Loading branch information
aquarellian committed Oct 17, 2015
1 parent 829d233 commit 4e2d25c55d26a6734f0ba09c3802fe164c53af69
@@ -68,7 +68,7 @@
private final String projectPath;
private final String sonarURL;
private final String path;
private final Severity severity;
private final String severity;
private final boolean changedLinesOnly;
private final boolean newIssuesOnly;
private final String noIssuesToPostText;
@@ -78,14 +78,14 @@

@DataBoundConstructor
public SonarToGerritBuilder(String projectPath, String sonarURL, String path,
String severity, boolean changedLinesOnly, boolean isNewIssuesOnly,
String severity, boolean changedLinesOnly, boolean newIssuesOnly,
String noIssuesToPostText, String someIssuesToPostText, String issueComment) {
this.projectPath = MoreObjects.firstNonNull(projectPath, EMPTY_STR);
this.sonarURL = MoreObjects.firstNonNull(sonarURL, DEFAULT_SONAR_URL);
this.path = MoreObjects.firstNonNull(path, DEFAULT_PATH);
this.severity = MoreObjects.firstNonNull(Severity.valueOf(severity), Severity.MAJOR);
this.severity = MoreObjects.firstNonNull(severity, Severity.MAJOR.name());
this.changedLinesOnly = changedLinesOnly;
this.newIssuesOnly = isNewIssuesOnly;
this.newIssuesOnly = newIssuesOnly;
this.noIssuesToPostText = noIssuesToPostText;
this.someIssuesToPostText = someIssuesToPostText;
this.issueComment = issueComment;
@@ -95,7 +95,7 @@ public String getPath() {
return path;
}

public Severity getSeverity() {
public String getSeverity() {
return severity;
}

@@ -340,9 +340,10 @@ private String appendDelimiter(String subPath) {
@VisibleForTesting
Iterable<Issue> filterIssuesByPredicates(Report report) {
List<Issue> issues = report.getIssues();
Severity sev = Severity.valueOf(severity);
return Iterables.filter(issues,
Predicates.and(
ByMinSeverityPredicate.apply(getSeverity()),
ByMinSeverityPredicate.apply(sev),
ByNewPredicate.apply(isNewIssuesOnly()))
);
}
@@ -428,6 +429,13 @@ public FormValidation doCheckIssueComment(@QueryParameter String value) {
return FormValidation.ok();
}

public FormValidation doCheckSeverity(@QueryParameter String value) {
if (value == null || Severity.valueOf(value) == null) {
return FormValidation.error(getLocalized("jenkins.plugin.validation.review.severity.unknown"));
}
return FormValidation.ok();
}

@Override
public boolean isApplicable(Class<? extends AbstractProject> aClass) {
// Indicates that this builder can be used with all kinds of project types
@@ -15,4 +15,4 @@ jenkins.plugin.error.gerrit.server.empty=Cannot obtain Gerrit server name. Pleas
jenkins.plugin.error.gerrit.config.empty=Cannot obtain Gerrit configuration. Please check your Gerrit Trigger settings
jenkins.plugin.error.gerrit.user.empty=Gerrit authentication is not configured. Please check Gerrit Trigger settings
jenkins.plugin.error.sonar.report.not.exists=Sonar report '%s' does not exist. Please check plugin settings

jenkins.plugin.validation.review.severity.unknown=Unknown severity
@@ -26,28 +26,24 @@
</f:section>

<f:section title="${%jenkins.plugin.settings.section.filter.name}">
<!--<f:entry title="Choose severity level"-->
<!--field="name">-->
<!--<f:enum>${it.name}</f:enum>-->
<!--</f:entry>-->
<f:entry title="${%jenkins.plugin.settings.filter.severity}" field="severity">
<select name="severity">
<option value="INFO">${%jenkins.plugin.data.severity.info}</option>
<option value="MINOR">${%jenkins.plugin.data.severity.minor}</option>
<option value="MAJOR" selected="true">${%jenkins.plugin.data.severity.major}</option>
<option value="CRITICAL">${%jenkins.plugin.data.severity.critical}</option>
<option value="BLOCKER">${%jenkins.plugin.data.severity.blocker}</option>
<f:entry name="severity" title="${%jenkins.plugin.settings.filter.severity}" field="severity">
<select name="severity" field="severity">
<f:option value="INFO" selected="${instance.severity =='INFO'}">INFO</f:option>
<f:option value="MINOR" selected="${instance.severity =='MINOR'}">MINOR</f:option>
<f:option value="MAJOR" selected="${instance.severity =='MAJOR' || instance.severity == null}">MAJOR</f:option>
<f:option value="CRITICAL" selected="${instance.severity =='CRITICAL'}">CRITICAL</f:option>
<f:option value="BLOCKER" selected="${instance.severity =='BLOCKER'}">BLOCKER</f:option>
</select>
</f:entry>

<f:entry title="${%jenkins.plugin.settings.filter.new}" field="newIssuesOnly"
description="${%jenkins.plugin.settings.filter.new.description}">
<f:checkbox checked="true"/>
<f:checkbox default="true"/>
</f:entry>

<f:entry title="${%jenkins.plugin.settings.filter.lines.changed}" field="changedLinesOnly"
description="${%jenkins.plugin.settings.filter.lines.changed.description}">
<f:checkbox checked="true"/>
<f:checkbox default="true"/>
</f:entry>
</f:section>
<f:section title="${%jenkins.plugin.settings.section.review.format.name}">

0 comments on commit 4e2d25c

Please sign in to comment.