7768 Commits

Author SHA1 Message Date
Andreas Dangel
59b14bd009 Cleanup and add license headers 2015-03-07 20:09:47 +01:00
Andreas Dangel
c3882ef6f4 Update changelog 2015-03-07 19:19:01 +01:00
Andreas Dangel
c30b0be663 Merge branch 'bugfix/improves-jdk8-support' of https://github.com/bric3/pmd into bric3-bugfix/improves-jdk8-support 2015-03-07 19:13:56 +01:00
Andreas Dangel
74708fa69e RuleProperties: Further refactoring - making the delimiters configurable 2015-03-07 19:01:52 +01:00
Andreas Dangel
99f735cc3b RuleProperties: Whitespaces, reformat 2015-03-02 21:40:14 +01:00
Andreas Dangel
8ca4a57c13 RuleProperties: get rid of AbstractDelimitedProperty
Just using AbstractProperty now, it can do both.
2015-03-02 20:45:53 +01:00
Andreas Dangel
df423b373c RuleProperties: Add more tests and fix some multi property issues.
Add missing BooleanMultiProperty.FACTORY
2015-03-02 20:15:04 +01:00
Brice Dutheil
18f393da3c Introduces java 8 integration test module
* Only for testing pmd-java
* Activated only if the jdk is 1.8
2015-03-01 22:11:51 +01:00
Brice Dutheil
28d1764428 Improves pmd jdk8 readiness
* Upgrade asm so that it understands default method and static methods in interfaces jdk8 class files
* see 9b91690f218408ba1c65e633a824660e18080b00 for ASM4 support
2015-03-01 22:09:33 +01:00
Brice Dutheil
c50d84ff24 Replaces with spaces only (was mixed whitespaces) 2015-03-01 22:04:17 +01:00
Andreas Dangel
fcad3925cd #1316 Multi Rule Properties with delimiter not possible 2015-02-28 14:12:53 +01:00
Andreas Dangel
acb8b49aa8 #1302 False Positive: UnusedPrivateField when accessed by inner class 2015-02-21 11:53:38 +01:00
Andreas Dangel
33212c7da3 #1302 False Positive: UnusedPrivateField when accessed by inner class 2015-02-21 11:29:44 +01:00
Andreas Dangel
bdf9c19a1d #1304 UseCollectionIsEmpty false positive comparing to 1 2015-02-21 11:26:12 +01:00
Shuyang Zhou
cd8325dff3 #1303 OverrideBothEqualsAndHashcodeRule does not work on class implements resolvable interfaces 2015-02-21 11:16:13 +01:00
Andreas Dangel
9b8496ab16 #1305 variable declaration inside switch causes ClassCastException 2015-02-20 20:28:39 +01:00
Andreas Dangel
96b425be46 Disable Scala for jdk9 builds for now (see #1314 Enable Scala for JDK9) 2015-02-20 20:05:38 +01:00
Andreas Dangel
21d7ebb809 Fixes for java9 2015-02-20 19:19:16 +01:00
Andreas Dangel
abb247a13a Update changelog 2015-02-20 18:51:36 +01:00
Robert Whitebit
cd52e39b08 [JUnit] Check assertion message present in assertEquals with delta
A missing assertion message for assertEquals(double, double, double)
is detected in most cases now. If the assertEquals method has two
arguments, an assertion message is missing, if the assertEquals method
has three arguments, the first one has to be a string.

Pmd will only print an error if the first argument type has been
determined (getType() != null) and isn't a String. Therefore
assertEquals(getInt(), getInt(), getInt()) won't be detected as an
error. However, double d = 1.0; assertEquals(d, 1.0, 1.0); will be
detected.

The JUnitAssertionsShouldIncludeMessageRule.check method has been moved
to the inner class AssertionCall and has been expanded by an
isException hook. The assertEquals with three arguments check overrides
the isException method, returns true if the first argument can't be
determined or is a String and if so, no violation will be added. Also
the constructor arguments have been swapped for readability.

https://sourceforge.net/p/pmd/bugs/1313/
2015-02-20 00:36:11 +01:00
Andreas Dangel
1d0d7d995e Update changelog 2015-02-19 20:57:09 +01:00
Andreas Dangel
ed6a876549 Merge branch 'missingAsserts' of https://github.com/robertwhitebit/pmd into robertwhitebit-missingAsserts 2015-02-19 20:56:29 +01:00
Andreas Dangel
5c9eae44c1 Update changelog 2015-02-19 20:52:19 +01:00
Andreas Dangel
6b7846a329 Merge branch 'unused-private-field-inner' of https://github.com/rsalvador/pmd into rsalvador-unused-private-field-inner 2015-02-19 20:51:40 +01:00
Andreas Dangel
299d167e1b Update changelog 2015-02-19 20:47:21 +01:00
Andreas Dangel
563fc4ed5a Merge branch 'no-class-def-found-error' of https://github.com/rsalvador/pmd into rsalvador-no-class-def-found-error 2015-02-19 20:40:15 +01:00
Andreas Dangel
0f0984af3c #1312 Rule reference must not override rule name of referenced rule
The RuleSetWriter used the wrong name, too
2015-02-19 18:29:03 +01:00
Robert Whitebit
41e921531a Add missing assertions in JUnitAssertionsShouldIncludeMessage test
Missing assertions were assertArrayEquals, assertNotSame, assertThat and
fail.
2015-02-18 23:02:43 +01:00
Andreas Dangel
d5d6118f12 #1312 Rule reference must not override rule name of referenced rule
otherwise the rule reference is broken
2015-02-18 20:07:44 +01:00
Roman
070a7c992f Fix some false positives in UnusedPrivateField 2015-02-15 11:43:49 -08:00
Roman
1f6421ec88 Handle NoClassDefFoundError along ClassNotFoundException 2015-02-15 11:34:32 -08:00
Andreas Dangel
c44d94416d verify #1310 PMD cannot parse int.class with real example 2015-02-10 22:32:09 +01:00
Andreas Dangel
5fbbe0ac94 verify #1310 PMD cannot parse int.class 2015-02-09 21:36:49 +01:00
Andreas Dangel
12d6d71242 Update changelog 2015-01-28 21:34:49 +01:00
Andreas Dangel
5572f9896c Merge branch 'master' into tiobe-tiobe/csv_linenumber_per_file 2015-01-28 20:33:51 +01:00
Andreas Dangel
4e23642f74 Rewrote java-design/FieldDeclarationsShouldBeAtStartOfClass as a java rule
Fixes #1308 PMD runs endlessly on some generated files
2015-01-28 20:22:24 +01:00
Andreas Dangel
a51a58476c Another small performance improvement for rule FieldDeclarationsShouldBeAtStartOfClass
It is still the slowest rule from #1308 PMD runs endlessly on some generated files
2015-01-26 20:48:49 +01:00
Andreas Dangel
1159350e91 Merge branch 'tiobe/csv_linenumber_per_file' of https://github.com/tiobe/pmd into tiobe-tiobe/csv_linenumber_per_file 2015-01-24 18:34:21 +01:00
Andreas Dangel
172c20efa6 Small performance improvements for rule FieldDeclarationsShouldBeAtStartOfClass
It is the slowest rule from #1308 PMD runs endlessly on some generated files
2015-01-24 15:57:04 +01:00
Andreas Dangel
4be14adebb #1308 PMD runs endlessly on some generated files 2015-01-24 10:03:46 +01:00
Andreas Dangel
9522ab3cd4 #1306 False positive on duplicate when using static imports 2015-01-22 19:30:20 +01:00
Andreas Dangel
57beb7ed13 #914 False +ve from UnusedImports with wildcard static imports 2015-01-21 21:56:43 +01:00
Jan van Nunen
b1769846e5 Created extra CSV output format 'csv_with_linecount_per_file' which outputs the correct line count per file.
Some of the tokenizers ignore comments and therefore the line count of a
duplication can differ per file. Take for example the following files:

FileA.java:

1: public class FileA {
2:  pulbic String Foo() {
3:    return "Foo";
4:   }
5:  }

FileB.java:

1: public class FileB {
2:   pulbic String Foo() {
3:     // This is a comment
4:     return "Foo";
5:   }
6: }

When comments are ignored and not tokenized, the duplication consist of
the following tokens:

'{', 'public', 'String', 'Foo', '(', ')', '{', 'return', 'Foo', ';',
'}', '}'

For 'FileA.java' the duplication is 5 lines long, it starts at line 1
and ends at line 5. For 'FileB.java' the duplication is 6 lines long, it
starts at line 1 and ends at line 6.

Note that this is just 1 example, because for most tokenizers comments
and white spaces are not significant. For example the following file
contains the same duplication all on 1 line:

FileC.java

1: public class FileC { public String Foo() { return "Foo"; } }

For us the correct line count per file is important, because we
highlight the duplications in an annotated source view and show the
percentage of duplicated code the file contains. The current output
formats only contain 1 line count per duplication and file set. For the
above example CPD would output the following:

Found a 4 line (12 tokens) duplication in the following files:
Starting at line 1 of FileA.java
Starting at line 1 of FileB.java

For FileB.java this is not correct and would lead to incorrect
percentage of duplicated code. (66% (4 of 6 lines) instead of the
correct 83% (5 of 6 lines)).

To fix the problem, I created an extra output format
'csv_with_linecount_per_file' which outputs the correct line count per
file. The format contains the following:

tokens,occurrences
<nr of tokens>,<nr of occurrences>(,<begin line>,<line count>,<file
name>)+

For the above example the output would be

tokens,occurrences
12,2,1,4,FileA.java,1,5,FileB.java
2015-01-21 13:55:49 +01:00
Andreas Dangel
df81f1fbb5 Update changelog 2015-01-19 21:39:00 +01:00
Andreas Dangel
e122ab2450 Fix unit tests after xerces is removed 2015-01-19 21:26:20 +01:00
Andreas Dangel
8d487384a3 Remove LineNumberAwareSaxHandler - as this would have needed xerces 2015-01-19 19:22:03 +01:00
Andreas Dangel
a2a8d6c227 Remove xerces dependencies 2015-01-19 19:22:03 +01:00
Andreas Dangel
6ca24d1f8a Implement DOMLineNumbers to determine the line numbers after the parsing 2015-01-19 19:22:03 +01:00
Andreas Dangel
0da50b9e89 Fix XMLParser test to expect more accurate line numbers/columns 2015-01-19 19:22:03 +01:00
Andreas Dangel
5ae01d2d3e Up version to 5.3.0-SNAPSHOT 2015-01-18 12:19:52 +01:00