aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-checkstyle-plugin
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-03-06 06:50:24 +0300
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-03-08 04:40:56 +0300
commit5434327a2cbdd535cd28e5abbd70ac89d5f7b5b5 (patch)
tree5b2cb19d930c780de5b71fb345047b6e210bca07 /plugins/sonar-checkstyle-plugin
parent5bdc1b1caf2b566d9613806fec394548691f33b0 (diff)
downloadsonarqube-5434327a2cbdd535cd28e5abbd70ac89d5f7b5b5.tar.gz
sonarqube-5434327a2cbdd535cd28e5abbd70ac89d5f7b5b5.zip
Fix violations reported by Sonar Eclipse
Diffstat (limited to 'plugins/sonar-checkstyle-plugin')
-rw-r--r--plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleConfiguration.java16
-rw-r--r--plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleConstants.java3
-rw-r--r--plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleExecutor.java10
-rw-r--r--plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporter.java21
4 files changed, 28 insertions, 22 deletions
diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleConfiguration.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleConfiguration.java
index 970d50019f0..57ef5053ddc 100644
--- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleConfiguration.java
+++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleConfiguration.java
@@ -19,6 +19,15 @@
*/
package org.sonar.plugins.checkstyle;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.Charset;
+import java.util.List;
+import java.util.Properties;
+
import com.puppycrawl.tools.checkstyle.ConfigurationLoader;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.PropertiesExpander;
@@ -34,14 +43,9 @@ import org.sonar.api.resources.Java;
import org.sonar.api.resources.Project;
import org.sonar.api.utils.SonarException;
-import java.io.*;
-import java.nio.charset.Charset;
-import java.util.List;
-import java.util.Properties;
-
public class CheckstyleConfiguration implements BatchExtension {
- private static Logger LOG = LoggerFactory.getLogger(CheckstyleConfiguration.class);
+ private static final Logger LOG = LoggerFactory.getLogger(CheckstyleConfiguration.class);
private CheckstyleProfileExporter confExporter;
private RulesProfile profile;
diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleConstants.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleConstants.java
index 78ec934681f..e110efcba84 100644
--- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleConstants.java
+++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleConstants.java
@@ -32,4 +32,7 @@ public final class CheckstyleConstants {
public static final String FILTERS_DEFAULT_VALUE = "<module name=\"SuppressionCommentFilter\"/>";
public static final String GENERATE_XML_KEY = "sonar.checkstyle.generateXml";
public static final boolean GENERATE_XML_DEFAULT_VALUE = false;
+
+ private CheckstyleConstants() {
+ }
}
diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleExecutor.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleExecutor.java
index 2ec7fcf737d..2b1f165540d 100644
--- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleExecutor.java
+++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleExecutor.java
@@ -19,6 +19,9 @@
*/
package org.sonar.plugins.checkstyle;
+import java.io.File;
+import java.io.OutputStream;
+
import com.puppycrawl.tools.checkstyle.Checker;
import com.puppycrawl.tools.checkstyle.PackageNamesLoader;
import com.puppycrawl.tools.checkstyle.XMLLogger;
@@ -31,11 +34,8 @@ import org.sonar.api.batch.ProjectClasspath;
import org.sonar.api.utils.SonarException;
import org.sonar.api.utils.TimeProfiler;
-import java.io.File;
-import java.io.OutputStream;
-
public class CheckstyleExecutor implements BatchExtension {
- private static Logger LOG = LoggerFactory.getLogger(CheckstyleExecutor.class);
+ private static final Logger LOG = LoggerFactory.getLogger(CheckstyleExecutor.class);
private CheckstyleConfiguration configuration;
private ClassLoader projectClassloader;
@@ -47,7 +47,6 @@ public class CheckstyleExecutor implements BatchExtension {
this.projectClassloader = classpath.getClassloader();
}
-
CheckstyleExecutor(CheckstyleConfiguration configuration, CheckstyleAuditListener listener, ClassLoader projectClassloader) {
this.configuration = configuration;
this.listener = listener;
@@ -96,5 +95,4 @@ public class CheckstyleExecutor implements BatchExtension {
}
}
-
} \ No newline at end of file
diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporter.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporter.java
index 2ea3f1b6232..02e251b4dc4 100644
--- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporter.java
+++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporter.java
@@ -19,6 +19,12 @@
*/
package org.sonar.plugins.checkstyle;
+import java.io.Reader;
+import java.util.Map;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import org.codehaus.stax2.XMLInputFactory2;
@@ -34,12 +40,6 @@ import org.sonar.api.rules.RuleFinder;
import org.sonar.api.rules.RuleQuery;
import org.sonar.api.utils.ValidationMessages;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-
-import java.io.Reader;
-import java.util.Map;
-
public class CheckstyleProfileImporter extends ProfileImporter {
private static final String CHECKER_MODULE = "Checker";
@@ -84,11 +84,11 @@ public class CheckstyleProfileImporter extends ProfileImporter {
xmlFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE);
xmlFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
xmlFactory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
- SMInputFactory inputFactory = new SMInputFactory(xmlFactory);
- return inputFactory;
+ return new SMInputFactory(xmlFactory);
}
- private void processModule(RulesProfile profile, String path, SMInputCursor moduleCursor, ValidationMessages messages) throws XMLStreamException {
+ private void processModule(RulesProfile profile, String path, SMInputCursor moduleCursor, ValidationMessages messages)
+ throws XMLStreamException {
String moduleName = moduleCursor.getAttrValue("name");
if (isFilter(moduleName)) {
messages.addWarningText("Checkstyle filters are not imported: " + moduleName);
@@ -109,7 +109,8 @@ public class CheckstyleProfileImporter extends ProfileImporter {
StringUtils.equals(configKey, "SuppressWithNearbyCommentFilter");
}
- private void processRule(RulesProfile profile, String path, String moduleName, SMInputCursor moduleCursor, ValidationMessages messages) throws XMLStreamException {
+ private void processRule(RulesProfile profile, String path, String moduleName, SMInputCursor moduleCursor, ValidationMessages messages)
+ throws XMLStreamException {
Map<String, String> properties = processProps(moduleCursor);
Rule rule;