summaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-06-20 09:34:45 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2014-06-20 09:42:53 +0200
commitd0569c1ebf7aa7b2aa4a42cef4f0664a2a4bb534 (patch)
tree7f29ab81b2f251359c3bf1e1e18e79ca711848a9 /sonar-batch
parente78cd0cf41cdaaa2c45fcac4efe28d6972efe7e8 (diff)
downloadsonarqube-d0569c1ebf7aa7b2aa4a42cef4f0664a2a4bb534.tar.gz
sonarqube-d0569c1ebf7aa7b2aa4a42cef4f0664a2a4bb534.zip
Fix some quality flaws
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/DefaultDecoratorContext.java26
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/events/package-info.java23
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java3
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/package-info.java23
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/language/package-info.java23
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/languages/package-info.java1
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/package-info.java23
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/phases/package-info.java23
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rule/QProfileDecorator.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/maven/package-info.java23
10 files changed, 154 insertions, 16 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultDecoratorContext.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultDecoratorContext.java
index d31b204e938..41527929431 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/DefaultDecoratorContext.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultDecoratorContext.java
@@ -48,7 +48,7 @@ import java.util.Set;
public class DefaultDecoratorContext implements DecoratorContext {
private static final String SAVE_MEASURE_METHOD = "saveMeasure";
- private SonarIndex index;
+ private SonarIndex sonarIndex;
private Resource resource;
private MeasurementFilters measurementFilters;
private boolean readOnly = false;
@@ -63,7 +63,7 @@ public class DefaultDecoratorContext implements DecoratorContext {
SonarIndex index,
List<DecoratorContext> childrenContexts,
MeasurementFilters measurementFilters, MeasureCache measureCache, MetricFinder metricFinder) {
- this.index = index;
+ this.sonarIndex = index;
this.resource = resource;
this.childrenContexts = childrenContexts;
this.measurementFilters = measurementFilters;
@@ -88,7 +88,7 @@ public class DefaultDecoratorContext implements DecoratorContext {
}
public Project getProject() {
- return index.getProject();
+ return sonarIndex.getProject();
}
public List<DecoratorContext> getChildren() {
@@ -181,50 +181,50 @@ public class DefaultDecoratorContext implements DecoratorContext {
* {@inheritDoc}
*/
public List<Violation> getViolations(ViolationQuery violationQuery) {
- return index.getViolations(violationQuery);
+ return sonarIndex.getViolations(violationQuery);
}
/**
* {@inheritDoc}
*/
public List<Violation> getViolations() {
- return index.getViolations(resource);
+ return sonarIndex.getViolations(resource);
}
public Dependency saveDependency(Dependency dependency) {
checkReadOnly("addDependency");
- return index.addDependency(dependency);
+ return sonarIndex.addDependency(dependency);
}
public Set<Dependency> getDependencies() {
- return index.getDependencies();
+ return sonarIndex.getDependencies();
}
public Collection<Dependency> getIncomingDependencies() {
- return index.getIncomingEdges(resource);
+ return sonarIndex.getIncomingEdges(resource);
}
public Collection<Dependency> getOutgoingDependencies() {
- return index.getOutgoingEdges(resource);
+ return sonarIndex.getOutgoingEdges(resource);
}
public List<Event> getEvents() {
- return index.getEvents(resource);
+ return sonarIndex.getEvents(resource);
}
public Event createEvent(String name, String description, String category, Date date) {
- return index.addEvent(resource, name, description, category, date);
+ return sonarIndex.addEvent(resource, name, description, category, date);
}
public void deleteEvent(Event event) {
- index.deleteEvent(event);
+ sonarIndex.deleteEvent(event);
}
public DefaultDecoratorContext saveViolation(Violation violation, boolean force) {
if (violation.getResource() == null) {
violation.setResource(resource);
}
- index.addViolation(violation, force);
+ sonarIndex.addViolation(violation, force);
return this;
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/events/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/events/package-info.java
new file mode 100644
index 00000000000..a82eac11c0e
--- /dev/null
+++ b/sonar-batch/src/main/java/org/sonar/batch/events/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.batch.events;
+
+import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java b/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java
index 6e61e07d723..4276fddf6c2 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java
@@ -183,11 +183,10 @@ public class ResourceKeyMigration implements BatchComponent {
}
private List<ResourceModel> loadEnabledResources(int moduleId, StringBuilder hql) {
- List<ResourceModel> resources = session.createQuery(hql.toString())
+ return session.createQuery(hql.toString())
.setParameter("rootId", moduleId)
.setParameter("enabled", true)
.getResultList();
- return resources;
}
private Map<String, ResourceModel> loadDisabledResources(int moduleId, StringBuilder hql) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/index/package-info.java
new file mode 100644
index 00000000000..93a923935ee
--- /dev/null
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.batch.index;
+
+import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/language/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/language/package-info.java
new file mode 100644
index 00000000000..78142a00deb
--- /dev/null
+++ b/sonar-batch/src/main/java/org/sonar/batch/language/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.batch.language;
+
+import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/languages/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/languages/package-info.java
index 5ce5bc10019..ef8790b337f 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/languages/package-info.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/languages/package-info.java
@@ -17,4 +17,5 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+@javax.annotation.ParametersAreNonnullByDefault
package org.sonar.batch.languages; \ No newline at end of file
diff --git a/sonar-batch/src/main/java/org/sonar/batch/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/package-info.java
new file mode 100644
index 00000000000..5d2f07b1958
--- /dev/null
+++ b/sonar-batch/src/main/java/org/sonar/batch/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.batch;
+
+import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/phases/package-info.java
new file mode 100644
index 00000000000..a3964085a91
--- /dev/null
+++ b/sonar-batch/src/main/java/org/sonar/batch/phases/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.batch.phases;
+
+import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileDecorator.java
index fce17de2473..9c255f2a13e 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileDecorator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileDecorator.java
@@ -40,7 +40,7 @@ public class QProfileDecorator implements Decorator {
}
public boolean shouldExecuteOnProject(Project project) {
- return project.getModules().size() > 0;
+ return !project.getModules().isEmpty();
}
@Override
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/maven/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/scan/maven/package-info.java
new file mode 100644
index 00000000000..e8443364ac6
--- /dev/null
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/maven/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.batch.scan.maven;
+
+import javax.annotation.ParametersAreNonnullByDefault;