aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-06-17 11:51:56 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-06-17 11:51:56 +0200
commite09f42884478ab1a1da0d79bde3c466200101e3b (patch)
tree8dd31441089c7556cf475b656d5b91db277422b9 /sonar-batch
parent45a98fc0691fd1965461e7d385ef3d00e083798f (diff)
downloadsonarqube-e09f42884478ab1a1da0d79bde3c466200101e3b.tar.gz
sonarqube-e09f42884478ab1a1da0d79bde3c466200101e3b.zip
Fix some quality flaws
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/IssueFilters.java10
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java1
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rule/UsedQProfiles.java14
3 files changed, 13 insertions, 12 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/IssueFilters.java b/sonar-batch/src/main/java/org/sonar/batch/issue/IssueFilters.java
index 79b576d3398..b43f98f6d27 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/IssueFilters.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/IssueFilters.java
@@ -34,22 +34,22 @@ public class IssueFilters implements BatchExtension {
private final org.sonar.api.issue.IssueFilter[] exclusionFilters;
private final IssueFilter[] filters;
- public IssueFilters(ViolationFilters deprecatedFilters, DeprecatedViolations deprecatedViolations, org.sonar.api.issue.IssueFilter[] exclusionFilters, IssueFilter[] filters) {
+ public IssueFilters(@Nullable ViolationFilters deprecatedFilters, @Nullable DeprecatedViolations deprecatedViolations, org.sonar.api.issue.IssueFilter[] exclusionFilters, IssueFilter[] filters) {
this.deprecatedFilters = deprecatedFilters;
this.deprecatedViolations = deprecatedViolations;
this.exclusionFilters = exclusionFilters;
this.filters = filters;
}
- public IssueFilters(ViolationFilters deprecatedFilters, DeprecatedViolations deprecatedViolations, IssueFilter[] filters) {
+ public IssueFilters(@Nullable ViolationFilters deprecatedFilters, @Nullable DeprecatedViolations deprecatedViolations, IssueFilter[] filters) {
this(deprecatedFilters, deprecatedViolations, new org.sonar.api.issue.IssueFilter[0], filters);
}
- public IssueFilters(ViolationFilters deprecatedFilters, DeprecatedViolations deprecatedViolations, org.sonar.api.issue.IssueFilter[] exclusionFilters) {
+ public IssueFilters(@Nullable ViolationFilters deprecatedFilters, @Nullable DeprecatedViolations deprecatedViolations, org.sonar.api.issue.IssueFilter[] exclusionFilters) {
this(deprecatedFilters, deprecatedViolations, exclusionFilters, new IssueFilter[0]);
}
- public IssueFilters(ViolationFilters deprecatedFilters, DeprecatedViolations deprecatedViolations) {
+ public IssueFilters(@Nullable ViolationFilters deprecatedFilters, @Nullable DeprecatedViolations deprecatedViolations) {
this(deprecatedFilters, deprecatedViolations, new org.sonar.api.issue.IssueFilter[0]);
}
@@ -80,7 +80,7 @@ public class IssueFilters implements BatchExtension {
return false;
}
}
- if (deprecatedFilters != null && !deprecatedFilters.isEmpty()) {
+ if (deprecatedFilters != null && !deprecatedFilters.isEmpty() && deprecatedViolations != null) {
Violation v = violation != null ? violation : deprecatedViolations.toViolation(issue);
return !deprecatedFilters.isIgnored(v);
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java b/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java
index d9bf9917a4d..744c5caa5ba 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java
@@ -33,7 +33,6 @@ import org.sonar.api.batch.rule.Rules;
import org.sonar.api.batch.rule.internal.NewRule;
import org.sonar.api.batch.rule.internal.RulesBuilder;
import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.RuleStatus;
import org.sonar.api.utils.Durations;
import org.sonar.api.utils.TimeProfiler;
import org.sonar.core.rule.RuleDao;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/UsedQProfiles.java b/sonar-batch/src/main/java/org/sonar/batch/rule/UsedQProfiles.java
index 5973a74c593..9ae587d71ba 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rule/UsedQProfiles.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rule/UsedQProfiles.java
@@ -37,12 +37,13 @@ import java.util.Map;
@Immutable
public class UsedQProfiles {
- private Map<Integer, QProfileWithId> profilesById = Maps.newLinkedHashMap();
+ private final Map<Integer, QProfileWithId> profilesById = Maps.newLinkedHashMap();
private UsedQProfiles() {
+ // only static
}
- public static final UsedQProfiles fromProfiles(Iterable<QProfileWithId> profiles) {
+ public static UsedQProfiles fromProfiles(Iterable<QProfileWithId> profiles) {
UsedQProfiles result = new UsedQProfiles();
for (QProfileWithId qProfile : profiles) {
result.add(qProfile);
@@ -50,15 +51,15 @@ public class UsedQProfiles {
return result;
}
- public static final UsedQProfiles empty() {
+ public static UsedQProfiles empty() {
return new UsedQProfiles();
}
- public static final UsedQProfiles fromProfiles(QProfileWithId... profiles) {
+ public static UsedQProfiles fromProfiles(QProfileWithId... profiles) {
return fromProfiles(Arrays.asList(profiles));
}
- public static final UsedQProfiles fromJSON(String json) {
+ public static UsedQProfiles fromJSON(String json) {
UsedQProfiles result = new UsedQProfiles();
JsonArray root = new JsonParser().parse(json).getAsJsonArray();
for (JsonElement elt : root) {
@@ -73,7 +74,8 @@ public class UsedQProfiles {
JsonWriter writer = JsonWriter.of(json);
writer.beginArray();
for (QProfileWithId qProfile : profilesById.values()) {
- writer.beginObject()
+ writer
+ .beginObject()
.prop("id", qProfile.id())
.prop("name", qProfile.name())
.prop("version", qProfile.version())