Restore accidently changed lines

This commit is contained in:
Andreas Dangel
2016-04-09 20:46:49 +02:00
parent b0a0cf66b6
commit b0773c8614
12 changed files with 28 additions and 24 deletions

View File

@ -1,5 +1,9 @@
# PMD # PMD
[![Build Status](https://travis-ci.org/pmd/pmd.svg?branch=master)](https://travis-ci.org/pmd/pmd)
## About
PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks,
unnecessary object creation, and so forth. It supports Java, JavaScript, Salesforce.com Apex, XML, XSL. unnecessary object creation, and so forth. It supports Java, JavaScript, Salesforce.com Apex, XML, XSL.
Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code in Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code in

View File

@ -71,7 +71,7 @@ public class DesignRulesTest extends SimpleAggregatorTst {
addRule(RULESET, "UseCollectionIsEmpty"); addRule(RULESET, "UseCollectionIsEmpty");
addRule(RULESET, "UseLocaleWithCaseConversions"); addRule(RULESET, "UseLocaleWithCaseConversions");
addRule(RULESET, "UseNotifyAllInsteadOfNotify"); addRule(RULESET, "UseNotifyAllInsteadOfNotify");
//addRule(RULESET, "UseUtilityClass"); addRule(RULESET, "UseUtilityClass");
addRule(RULESET, "UseVarargs"); addRule(RULESET, "UseVarargs");
} }
} }

View File

@ -8,7 +8,7 @@ short
<expected-problems>0</expected-problems> <expected-problems>0</expected-problems>
<code><![CDATA[ <code><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
int x; int x;
} }
} }

View File

@ -8,7 +8,7 @@ short
<expected-problems>0</expected-problems> <expected-problems>0</expected-problems>
<code><![CDATA[ <code><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
bar(); bar();
} }
} }
@ -16,7 +16,7 @@ public class Foo {
</test-code> </test-code>
<code-fragment id="long"><![CDATA[ <code-fragment id="long"><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
bar(); bar();
bar(); bar();
bar(); bar();
@ -55,7 +55,7 @@ not quite long
<expected-problems>0</expected-problems> <expected-problems>0</expected-problems>
<code><![CDATA[ <code><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
bar(); bar();
bar(); bar();
bar(); bar();
@ -76,7 +76,7 @@ long
<expected-problems>1</expected-problems> <expected-problems>1</expected-problems>
<code><![CDATA[ <code><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
bar(); bar();
bar(); bar();
bar(); bar();

View File

@ -8,7 +8,7 @@ short
<expected-problems>0</expected-problems> <expected-problems>0</expected-problems>
<code><![CDATA[ <code><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
bar(); bar();
} }
} }
@ -22,7 +22,7 @@ lots of comments
<expected-problems>0</expected-problems> <expected-problems>0</expected-problems>
<code><![CDATA[ <code><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
//nothing to see here //nothing to see here
//nothing to see here //nothing to see here
//nothing to see here //nothing to see here
@ -39,7 +39,7 @@ public class Foo {
</test-code> </test-code>
<code-fragment id="long method"><![CDATA[ <code-fragment id="long method"><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
//nothing to see here //nothing to see here
//nothing to see here //nothing to see here
//nothing to see here //nothing to see here

View File

@ -8,7 +8,7 @@ short
<expected-problems>0</expected-problems> <expected-problems>0</expected-problems>
<code><![CDATA[ <code><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
bar(); bar();
} }
} }
@ -22,7 +22,7 @@ lots of comments
<expected-problems>0</expected-problems> <expected-problems>0</expected-problems>
<code><![CDATA[ <code><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
//nothing to see here //nothing to see here
//nothing to see here //nothing to see here
//nothing to see here //nothing to see here
@ -39,7 +39,7 @@ public class Foo {
</test-code> </test-code>
<code-fragment id="long method"><![CDATA[ <code-fragment id="long method"><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
//nothing to see here //nothing to see here
//nothing to see here //nothing to see here
//nothing to see here //nothing to see here

View File

@ -169,7 +169,7 @@ public class Foo {
import java.util.ArrayList; import java.util.ArrayList;
public class TestIsEmpty { public class TestIsEmpty {
public void foo() { public static void main(String args[]) {
ArrayList<String> testObject = new ArrayList<String>(); ArrayList<String> testObject = new ArrayList<String>();
// These ones are flagged // These ones are flagged
@ -228,7 +228,7 @@ public class TestIsEmpty {
import java.util.ArrayList; import java.util.ArrayList;
public class IsEmptyTest { public class IsEmptyTest {
public void foo() { public static void main(String args[]) {
ArrayList<String> testObject = new ArrayList<String>(); ArrayList<String> testObject = new ArrayList<String>();
// these should be flagged (as they are equivalent to == 0) and are // these should be flagged (as they are equivalent to == 0) and are

View File

@ -9,7 +9,7 @@ should be utility class since all static, public constructor
public class Foo { public class Foo {
public Foo() { } public Foo() { }
public static void doSomething() {} public static void doSomething() {}
public void foo() { public static void main(String args[]) {
doSomething(); doSomething();
} }
} }
@ -24,7 +24,7 @@ ok, uses non-static
public class Foo { public class Foo {
public Foo() { } public Foo() { }
public void doSomething() { } public void doSomething() { }
public void foo() { } public static void main(String args[]) { }
} }
]]></code> ]]></code>
</test-code> </test-code>
@ -175,7 +175,7 @@ NPE in incorrect implementation...
public class Foo { public class Foo {
public Foo() { } public Foo() { }
public void doSomething() { } public void doSomething() { }
public void foo() { } public static void main(String args[]) { }
; ;
} }
]]></code> ]]></code>
@ -190,7 +190,7 @@ public class Foo {
public Foo() { } public Foo() { }
@Override @Override
public void doSomething() { } public void doSomething() { }
public void foo() { } public static void main(String args[]) { }
} }
]]></code> ]]></code>
</test-code> </test-code>

View File

@ -62,7 +62,7 @@ public class Foo {
</expected-messages> </expected-messages>
<code><![CDATA[ <code><![CDATA[
public class TestPrintLn { public class TestPrintLn {
public void foo() { public static void main(String args[]) {
System.out.print("Print out"); System.out.print("Print out");
System.out.println("Print out line"); System.out.println("Print out line");
System.err.print("Print err"); System.err.print("Print err");

View File

@ -19,7 +19,7 @@ none
<expected-problems>0</expected-problems> <expected-problems>0</expected-problems>
<code><![CDATA[ <code><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
int bugleDeWump = -1; int bugleDeWump = -1;
} }
} }
@ -33,7 +33,7 @@ local
<code><![CDATA[ <code><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
int ab = -1; int ab = -1;
// Should trigger ShortVariable rule. // Should trigger ShortVariable rule.
} }
@ -47,7 +47,7 @@ for
<expected-problems>0</expected-problems> <expected-problems>0</expected-problems>
<code><![CDATA[ <code><![CDATA[
public class Foo { public class Foo {
public void foo() { public static void main(String args[]) {
for (int i = 0; i < 10; i++) { } // Should NOT!! trigger. for (int i = 0; i < 10; i++) { } // Should NOT!! trigger.
} }
} }

View File

@ -117,7 +117,7 @@ import java.util.ArrayList;
import java.io.File; import java.io.File;
public class TestInstantiationInLoop { public class TestInstantiationInLoop {
public void foo() { public static void main(String args[]) {
for (String test : new ArrayList<String>()) { // facetious but simple example for (String test : new ArrayList<String>()) { // facetious but simple example
System.out.println(test); System.out.println(test);
} }

View File

@ -602,7 +602,7 @@ import java.util.Locale;
public class Test { public class Test {
public void foo() { public static void main(String args[]) {
Test t = new Test(); Test t = new Test();
t.baz(); t.baz();
} }