import org.sonar.api.config.Settings;
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.resources.Project;
+import org.sonar.api.utils.SonarException;
import java.io.File;
import java.io.IOException;
return project.getFileSystem().writeToWorkingDirectory(pmdConfiguration.toString(), "pmd.xml");
} catch (IOException e) {
- throw new RuntimeException("Fail to save the PMD configuration", e);
+ throw new SonarException("Fail to save the PMD configuration", e);
}
}
}
InputStream stream = getClass().getResourceAsStream(rulesetPath);
if (stream == null) {
- throw new RuntimeException("The PMD ruleset can not be found: " + rulesetPath);
+ throw new SonarException("The PMD ruleset can not be found: " + rulesetPath);
}
return stream;
import org.sonar.api.batch.Sensor;
import org.sonar.api.batch.SensorContext;
import org.sonar.api.profiles.RulesProfile;
+import org.sonar.api.resources.Java;
import org.sonar.api.resources.JavaFile;
import org.sonar.api.resources.Project;
import org.sonar.api.resources.Resource;
}
public boolean shouldExecuteOnProject(Project project) {
- return project.getFileSystem().hasJavaSourceFiles() &&
- !profile.getActiveRulesByRepository(PmdConstants.REPOSITORY_KEY).isEmpty();
+ return !project.getFileSystem().mainFiles(Java.KEY).isEmpty() &&
+ !profile.getActiveRulesByRepository(PmdConstants.REPOSITORY_KEY).isEmpty();
}
@Override
+++ /dev/null
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2012 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar 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.
- *
- * Sonar 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 Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.pmd;
-
-import org.apache.commons.lang.StringUtils;
-import org.codehaus.staxmate.in.SMHierarchicCursor;
-import org.codehaus.staxmate.in.SMInputCursor;
-import org.sonar.api.CoreProperties;
-import org.sonar.api.batch.SensorContext;
-import org.sonar.api.resources.JavaFile;
-import org.sonar.api.resources.Project;
-import org.sonar.api.resources.Resource;
-import org.sonar.api.rules.Rule;
-import org.sonar.api.rules.RuleFinder;
-import org.sonar.api.rules.Violation;
-import org.sonar.api.utils.StaxParser;
-
-import javax.xml.stream.XMLStreamException;
-
-import java.io.File;
-
-@Deprecated
-class PmdViolationsXmlParser {
-
- private Project project;
- private RuleFinder ruleFinder;
- private SensorContext context;
-
- public PmdViolationsXmlParser(Project project, RuleFinder ruleFinder, SensorContext context) {
- this.project = project;
- this.ruleFinder = ruleFinder;
- this.context = context;
- }
-
- public void parse(File file) throws XMLStreamException {
- StaxParser parser = new StaxParser(new StreamHandler(), true);
- parser.parse(file);
- }
-
- private class StreamHandler implements StaxParser.XmlStreamHandler {
- public void stream(SMHierarchicCursor rootCursor) throws XMLStreamException {
- rootCursor.advance();
-
- SMInputCursor fileCursor = rootCursor.descendantElementCursor("file");
- while (fileCursor.getNext() != null) {
- String name = fileCursor.getAttrValue("name");
- Resource resource = JavaFile.fromAbsolutePath(name, project.getFileSystem().getSourceDirs(), false);
-
- // Save violations only for existing resources
- if (context.getResource(resource) != null) {
- streamViolations(fileCursor, resource);
- } else {
- fileCursor.advance();
- }
- }
- }
-
- private void streamViolations(SMInputCursor fileCursor, Resource resource) throws XMLStreamException {
- SMInputCursor violationCursor = fileCursor.descendantElementCursor("violation");
- while (violationCursor.getNext() != null) {
- int lineId = Integer.parseInt(violationCursor.getAttrValue("beginline"));
- String ruleKey = violationCursor.getAttrValue("rule");
- String message = StringUtils.trim(violationCursor.collectDescendantText());
-
- Rule rule = ruleFinder.findByKey(CoreProperties.PMD_PLUGIN, ruleKey);
- // Save violations only for enabled rules
- if (rule != null) {
- Violation violation = Violation.create(rule, resource).setLineId(lineId).setMessage(message);
- context.saveViolation(violation);
- }
- }
- }
- }
-
-}
import org.apache.commons.io.FileUtils;
import org.junit.Test;
+import org.sonar.api.config.Settings;
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.resources.Project;
+import org.sonar.api.resources.ProjectFileSystem;
import org.sonar.api.test.MavenTestUtils;
import java.io.File;
import java.io.IOException;
import java.util.List;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class PmdConfigurationTest {
assertThat(FileUtils.readFileToString(xmlFile), is("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<ruleset />\r\n\r\n"));
}
+ @Test
+ public void shouldReturnTargetXMLReport() {
+ Project project = new Project("key");
+ ProjectFileSystem fs = mock(ProjectFileSystem.class);
+ when(fs.getSonarWorkingDirectory()).thenReturn(new File("/tmp"));
+ project.setFileSystem(fs);
+ Settings settings = new Settings();
+ PmdConfiguration configuration = new PmdConfiguration(null, null, project, settings);
+
+ assertThat(configuration.getTargetXMLReport(), nullValue());
+
+ settings.setProperty(PmdConfiguration.PROPERTY_GENERATE_XML, true);
+ assertThat(configuration.getTargetXMLReport(), equalTo(new File("/tmp/pmd-result.xml")));
+ }
+
}
+++ /dev/null
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2012 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar 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.
- *
- * Sonar 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 Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.pmd;
-
-import org.hamcrest.BaseMatcher;
-import org.hamcrest.Description;
-import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.sonar.api.batch.SensorContext;
-import org.sonar.api.resources.JavaFile;
-import org.sonar.api.resources.Project;
-import org.sonar.api.resources.ProjectFileSystem;
-import org.sonar.api.rules.Rule;
-import org.sonar.api.rules.RuleFinder;
-import org.sonar.api.rules.Violation;
-import org.sonar.api.test.IsViolation;
-
-import java.io.File;
-import java.util.Arrays;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Mockito.*;
-
-public class PmdViolationsXmlParserTest {
-
- private void parse(SensorContext context, String xmlPath, boolean useIndexedResources) throws Exception {
- ProjectFileSystem fileSystem = mock(ProjectFileSystem.class);
- when(fileSystem.getSourceDirs()).thenReturn(Arrays.asList(new File("/test/src/main/java")));
-
- Project project = mock(Project.class);
- when(project.getFileSystem()).thenReturn(fileSystem);
-
- RuleFinder ruleFinder = mock(RuleFinder.class);
- when(ruleFinder.findByKey(anyString(), anyString())).thenAnswer(new Answer<Rule>() {
- public Rule answer(InvocationOnMock invocation) throws Throwable {
- Object[] args = invocation.getArguments();
- return Rule.create((String) args[0], (String) args[1], "");
- }
- });
-
- if (useIndexedResources) {
- when(context.getResource((JavaFile) any())).thenReturn(new JavaFile(""));
- } else {
- when(context.getResource((JavaFile) any())).thenReturn(null);
- }
-
- PmdViolationsXmlParser parser = new PmdViolationsXmlParser(project, ruleFinder, context);
-
- File xmlFile = new File(getClass().getResource(xmlPath).toURI());
- parser.parse(xmlFile);
- }
-
- @Test
- public void shouldSaveViolationsOnFiles() throws Exception {
- SensorContext context = mock(SensorContext.class);
- parse(context, "/org/sonar/plugins/pmd/pmd-result.xml", true);
-
- verify(context, times(30)).saveViolation(argThat(new IsViolationOnJavaFile()));
- verify(context, times(4)).saveViolation(argThat(new IsViolationOnJavaFile(new JavaFile("ch.hortis.sonar.mvn.ClassWithComments"))));
-
- Violation wanted = Violation.create((Rule) null, new JavaFile("ch.hortis.sonar.mvn.ClassWithComments"))
- .setMessage("Avoid unused local variables such as 'toto'.")
- .setLineId(22);
- verify(context, times(1)).saveViolation(argThat(new IsViolation(wanted)));
- }
-
- @Test
- public void shouldIgnoreNonIndexedResources() throws Exception {
- SensorContext context = mock(SensorContext.class);
- parse(context, "/org/sonar/plugins/pmd/pmd-result.xml", false);
-
- verify(context, never()).saveViolation(argThat(new IsViolationOnJavaFile()));
- }
-
- @Test
- public void defaultPackageShouldBeSetOnClassWithoutPackage() throws Exception {
- SensorContext context = mock(SensorContext.class);
- parse(context, "/org/sonar/plugins/pmd/pmd-class-without-package.xml", true);
- verify(context, times(3)).saveViolation(argThat(new IsViolationOnJavaFile(new JavaFile("ClassOnDefaultPackage"))));
- }
-
- @Test
- public void unknownXMLEntity() throws Exception {
- SensorContext context = mock(SensorContext.class);
- parse(context, "/org/sonar/plugins/pmd/pmd-result-with-unknown-entity.xml", true);
- verify(context, times(2)).saveViolation(argThat(new IsViolationOnJavaFile(new JavaFile("test.Test"))));
- }
-
- @Test
- public void ISOControlCharsXMLFile() throws Exception {
- SensorContext context = mock(SensorContext.class);
- parse(context, "/org/sonar/plugins/pmd/pmd-result-with-control-char.xml", true);
- verify(context, times(1)).saveViolation(argThat(new IsViolationOnJavaFile(new JavaFile("test.Test"))));
- }
-
- private class IsViolationOnJavaFile extends BaseMatcher<Violation> {
- private JavaFile javaFile;
-
- private IsViolationOnJavaFile(JavaFile javaFile) {
- this.javaFile = javaFile;
- }
-
- private IsViolationOnJavaFile() {
- }
-
- public boolean matches(Object o) {
- Violation v = (Violation) o;
- boolean ok = (v.getResource() != null) && (v.getResource() instanceof JavaFile);
- if (ok && javaFile != null) {
- ok = javaFile.equals(v.getResource());
- }
- return ok;
- }
-
- public void describeTo(Description description) {
-
- }
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<pmd version="4.1" timestamp="2008-06-30T10:23:14.369">
- <file name="/test/src/main/java/ClassOnDefaultPackage.java">
- <violation beginline="3" endline="5" begincolumn="16" endcolumn="9" rule="UnusedFormalParameter"
- ruleset="Unused Code Rules" class="ClassOnDefaultPackage"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedFormalParameter" priority="1">
- Avoid unused constructor parameters such as 'j'.
- </violation>
- <violation beginline="4" endline="4" begincolumn="21" endcolumn="21" rule="UnusedLocalVariable"
- ruleset="Unused Code Rules" class="ClassOnDefaultPackage" variable="j"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedLocalVariable" priority="1">
- Avoid unused local variables such as 'j'.
- </violation>
- <violation beginline="7" endline="7" begincolumn="24" endcolumn="33" rule="UnusedPrivateMethod"
- ruleset="Unused Code Rules" class="ClassOnDefaultPackage" method="myMethod"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedPrivateMethod" priority="1">
- Avoid unused private methods such as 'myMethod()'.
- </violation>
- </file>
-</pmd>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<pmd version="4.2.2" timestamp="2009-05-27T10:52:50.233">
-<file name="/test/src/main/java/test/Test.java">
-<violation beginline="10" endline="10" begincolumn="9" endcolumn="68" rule="AvoidDuplicateLiterals" ruleset="String and StringBuffer Rules" package="test" class="Test" externalInfoUrl="http://pmd.sourceforge.net/rules/strings.html#AvoidDuplicateLiterals" priority="3">
-The String literal "\1\14\13&uffff;\12\14\7&uffff;\32\14\4&uffff;\1\14\1&uffff;\32" appears 10 times in this file; the first occurrence is on line 10
-</violation>
-<violation beginline="12" endline="12" begincolumn="9" endcolumn="13" rule="AvoidDuplicateLiterals" ruleset="String and StringBuffer Rules" package="test" class="Test" externalInfoUrl="http://pmd.sourceforge.net/rules/strings.html#AvoidDuplicateLiterals" priority="3">
-The String literal "\14" appears 9 times in this file; the first occurrence is on line 12
-</violation>
-</file>
-</pmd>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<pmd version="4.1" timestamp="2008-06-30T10:23:14.369">
- <file name="/test/src/main/java/ch/hortis/sonar/mvn/ClassOnDefaultPackage.java">
- <violation beginline="3" endline="5" begincolumn="16" endcolumn="9" rule="UnusedFormalParameter"
- ruleset="Unused Code Rules" class="ClassOnDefaultPackage"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedFormalParameter" priority="1">
- Avoid unused constructor parameters such as 'j'.
- </violation>
- <violation beginline="4" endline="4" begincolumn="21" endcolumn="21" rule="UnusedLocalVariable"
- ruleset="Unused Code Rules" class="ClassOnDefaultPackage" variable="j"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedLocalVariable" priority="1">
- Avoid unused local variables such as 'j'.
- </violation>
- <violation beginline="7" endline="7" begincolumn="24" endcolumn="33" rule="UnusedPrivateMethod"
- ruleset="Unused Code Rules" class="ClassOnDefaultPackage" method="myMethod"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedPrivateMethod" priority="1">
- Avoid unused private methods such as 'myMethod()'.
- </violation>
- </file>
- <file name="/test/src/main/java/ch/hortis/sonar/mvn/org/sonar/samples/ClassUnderTest.java">
- <violation beginline="4" endline="4" begincolumn="29" endcolumn="37" rule="SignatureDeclareThrowsException"
- ruleset="Strict Exception Rules" package="org.sonar.samples" class="ClassUnderTest" method="toto"
- externalInfoUrl="http://pmd.sourceforge.net/rules/strictexception.html#SignatureDeclareThrowsException"
- priority="3">
- A method/constructor shouldn't explicitly throw java.lang.Exception
- </violation>
- <violation beginline="5" endline="5" begincolumn="9" endcolumn="9" rule="UnusedLocalVariable"
- ruleset="Unused Code Rules" package="org.sonar.samples" class="ClassUnderTest" method="toto" variable="i"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedLocalVariable" priority="1">
- Avoid unused local variables such as 'i'.
- </violation>
- </file>
- <file name="/test/src/main/java/ch/hortis/sonar/mvn/ClassWithComments.java">
- <violation beginline="10" endline="13" begincolumn="12" endcolumn="9" rule="UnusedFormalParameter"
- ruleset="Unused Code Rules" package="org.sonar.samples" class="ClassWithComments"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedFormalParameter" priority="1">
- Avoid unused constructor parameters such as 'j'.
- </violation>
- <violation beginline="12" endline="12" begincolumn="21" endcolumn="21" rule="UnusedLocalVariable"
- ruleset="Unused Code Rules" package="org.sonar.samples" class="ClassWithComments" variable="j"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedLocalVariable" priority="1">
- Avoid unused local variables such as 'j'.
- </violation>
- <violation beginline="15" endline="15" begincolumn="24" endcolumn="33" rule="UnusedPrivateMethod"
- ruleset="Unused Code Rules" package="org.sonar.samples" class="ClassWithComments" method="myMethod"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedPrivateMethod" priority="1">
- Avoid unused private methods such as 'myMethod()'.
- </violation>
- <violation beginline="22" endline="22" begincolumn="21" endcolumn="24" rule="UnusedLocalVariable"
- ruleset="Unused Code Rules" package="org.sonar.samples" class="ClassWithComments" method="myMethod"
- variable="toto" externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedLocalVariable"
- priority="3">
- Avoid unused local variables such as 'toto'.
- </violation>
- </file>
- <file name="/test/src/main/java/ch/hortis/sonar/mvn/org/sonar/samples/HibernateModel.java">
- <violation beginline="13" endline="13" begincolumn="19" endcolumn="20" rule="UnusedPrivateField"
- ruleset="Unused Code Rules" package="org.sonar.samples" class="HibernateModel" variable="id"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedPrivateField" priority="1">
- Avoid unused private fields such as 'id'.
- </violation>
- <violation beginline="16" endline="16" begincolumn="18" endcolumn="24" rule="UnusedPrivateField"
- ruleset="Unused Code Rules" package="org.sonar.samples" class="HibernateModel" variable="column1"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedPrivateField" priority="1">
- Avoid unused private fields such as 'column1'.
- </violation>
- <violation beginline="16" endline="16" begincolumn="11" endcolumn="25" rule="SingularField" ruleset="Design Rules"
- package="org.sonar.samples" class="HibernateModel" variable="column1"
- externalInfoUrl="http://pmd.sourceforge.net/rules/controversial.html#SingularField" priority="3">
- Perhaps 'column1' could be replaced by a local variable.
- </violation>
- </file>
- <file name="/test/src/main/java/ch/hortis/sonar/mvn/org/sonar/samples/InnerClass.java">
- <violation beginline="22" endline="56" begincolumn="25" endcolumn="1" rule="MaximumMethodsCountCheck"
- ruleset="PMD extensions" package="org.sonar.samples" class="InnerClass" priority="1">
- Avoid too many methods
- </violation>
- <violation beginline="25" endline="25" begincolumn="9" endcolumn="9" rule="UnusedLocalVariable"
- ruleset="Unused Code Rules" package="org.sonar.samples" class="InnerClass" method="methodOne"
- variable="i" externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedLocalVariable"
- priority="1">
- Avoid unused local variables such as 'i'.
- </violation>
- <violation beginline="30" endline="30" begincolumn="9" endcolumn="9" rule="UnusedLocalVariable"
- ruleset="Unused Code Rules" package="org.sonar.samples" class="InnerClass" method="methodTwo"
- variable="i" externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedLocalVariable"
- priority="1">
- Avoid unused local variables such as 'i'.
- </violation>
- <violation beginline="38" endline="55" begincolumn="26" endcolumn="3" rule="MaximumMethodsCountCheck"
- ruleset="PMD extensions" package="org.sonar.samples" class="InnerClassInside" priority="1">
- Avoid too many methods
- </violation>
- <violation beginline="44" endline="44" begincolumn="7" endcolumn="24" rule="SystemPrintln"
- ruleset="Java Logging Rules" package="org.sonar.samples" class="InnerClassInside" method="innerMethodOne"
- externalInfoUrl="http://pmd.sourceforge.net/rules/logging-java.html#SystemPrintln" priority="3">
- System.out.print is used
- </violation>
- <violation beginline="48" endline="48" begincolumn="7" endcolumn="24" rule="SystemPrintln"
- ruleset="Java Logging Rules" package="org.sonar.samples" class="InnerClassInside" method="innerMethodTwo"
- externalInfoUrl="http://pmd.sourceforge.net/rules/logging-java.html#SystemPrintln" priority="3">
- System.out.print is used
- </violation>
- <violation beginline="58" endline="87" begincolumn="20" endcolumn="1" rule="MaximumMethodsCountCheck"
- ruleset="PMD extensions" package="org.sonar.samples" class="PrivateClass" priority="1">
- Avoid too many methods
- </violation>
- <violation beginline="64" endline="64" begincolumn="5" endcolumn="22" rule="SystemPrintln"
- ruleset="Java Logging Rules" package="org.sonar.samples" class="PrivateClass" method="innerMethodThree"
- externalInfoUrl="http://pmd.sourceforge.net/rules/logging-java.html#SystemPrintln" priority="3">
- System.out.print is used
- </violation>
- <violation beginline="68" endline="68" begincolumn="5" endcolumn="22" rule="SystemPrintln"
- ruleset="Java Logging Rules" package="org.sonar.samples" class="PrivateClass" method="innerMethodFour"
- externalInfoUrl="http://pmd.sourceforge.net/rules/logging-java.html#SystemPrintln" priority="3">
- System.out.print is used
- </violation>
- <violation beginline="72" endline="72" begincolumn="9" endcolumn="12" rule="UnconditionalIfStatement"
- ruleset="Basic Rules" package="org.sonar.samples" class="PrivateClass" method="innerMethodFive"
- externalInfoUrl="http://pmd.sourceforge.net/rules/basic.html#UnconditionalIfStatement" priority="1">
- Do not use if statements that are always true or always false
- </violation>
- <violation beginline="73" endline="73" begincolumn="7" endcolumn="24" rule="SystemPrintln"
- ruleset="Java Logging Rules" package="org.sonar.samples" class="PrivateClass" method="innerMethodFive"
- externalInfoUrl="http://pmd.sourceforge.net/rules/logging-java.html#SystemPrintln" priority="3">
- System.out.print is used
- </violation>
- <violation beginline="78" endline="78" begincolumn="9" endcolumn="12" rule="UnconditionalIfStatement"
- ruleset="Basic Rules" package="org.sonar.samples" class="PrivateClass" method="innerMethodSix"
- externalInfoUrl="http://pmd.sourceforge.net/rules/basic.html#UnconditionalIfStatement" priority="1">
- Do not use if statements that are always true or always false
- </violation>
- <violation beginline="79" endline="79" begincolumn="7" endcolumn="24" rule="SystemPrintln"
- ruleset="Java Logging Rules" package="org.sonar.samples" class="PrivateClass" method="innerMethodSix"
- externalInfoUrl="http://pmd.sourceforge.net/rules/logging-java.html#SystemPrintln" priority="3">
- System.out.print is used
- </violation>
- </file>
- <file name="/test/src/main/java/ch/hortis/sonar/mvn/org/sonar/samples/Utf8Characters.java">
- <violation beginline="8" endline="12" begincolumn="10" endcolumn="3" rule="UnusedFormalParameter"
- ruleset="Unused Code Rules" package="org.sonar.samples" class="Utf8Characters"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedFormalParameter" priority="1">
- Avoid unused constructor parameters such as 't'.
- </violation>
- <violation beginline="9" endline="9" begincolumn="12" endcolumn="12" rule="UnusedLocalVariable"
- ruleset="Unused Code Rules" package="org.sonar.samples" class="Utf8Characters" variable="t"
- externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#UnusedLocalVariable" priority="1">
- Avoid unused local variables such as 't'.
- </violation>
- <violation beginline="10" endline="11" begincolumn="5" endcolumn="19" rule="AvoidIfWithoutBrace"
- ruleset="PMD extensions" package="org.sonar.samples" class="Utf8Characters" priority="1">
- Avoid if without using brace
- </violation>
- <violation beginline="10" endline="11" begincolumn="5" endcolumn="19" rule="IfStmtsMustUseBraces"
- ruleset="Braces Rules" package="org.sonar.samples" class="Utf8Characters"
- externalInfoUrl="http://pmd.sourceforge.net/rules/braces.html#IfStmtsMustUseBraces" priority="1">
- Avoid using if statements without curly braces
- </violation>
- <violation beginline="10" endline="10" begincolumn="9" endcolumn="12" rule="UnconditionalIfStatement"
- ruleset="Basic Rules" package="org.sonar.samples" class="Utf8Characters"
- externalInfoUrl="http://pmd.sourceforge.net/rules/basic.html#UnconditionalIfStatement" priority="1">
- Do not use if statements that are always true or always false
- </violation>
- </file>
-</pmd>
\ No newline at end of file