Compare commits

...
Author SHA1 Message Date
Andreas Dangel 96fffcaadd [maven-release-plugin] prepare release pmd_releases/5.5.2 2016-11-05 11:02:08 +01:00
Andreas Dangel 93aec5d064 Prepare pmd release 5.5.2 2016-11-05 10:55:17 +01:00
Andreas Dangel 37156724aa Merge branch 'pmd/5.4.x' 2016-11-05 10:43:02 +01:00
Andreas Dangel ed07ff259c Prepare next development version 2016-11-04 21:58:29 +01:00
Andreas Dangel e78f80416a [maven-release-plugin] prepare for next development iteration 2016-11-04 21:01:18 +01:00
Andreas Dangel 5019eb11e4 [maven-release-plugin] prepare release pmd_releases/5.4.3 2016-11-04 21:01:18 +01:00
Andreas Dangel 194167e3c0 Prepare pmd release 5.4.3 2016-11-04 20:53:46 +01:00
Andreas Dangel aa19957cee Merge branch 'pmd/5.3.x' into pmd/5.4.x 2016-11-04 20:31:53 +01:00
Andreas Dangel 253d35a926 Update release script 2016-11-04 20:24:51 +01:00
Andreas Dangel 6007840346 Prepare next development version 2016-11-04 19:58:50 +01:00
Andreas Dangel dcb4ecc674 [maven-release-plugin] prepare for next development iteration 2016-11-04 19:02:30 +01:00
Andreas Dangel 14cdf0b550 [maven-release-plugin] prepare release pmd_releases/5.3.8 2016-11-04 19:02:30 +01:00
Andreas Dangel 40ed778e43 Prepare pmd release 5.3.8 2016-11-04 18:37:25 +01:00
Andreas Dangel 92153696d8 Merge branch 'bug-1520' 2016-11-04 16:28:44 +01:00
Andreas Dangel 33e1850d6b Merge branch 'bug-1520' into pmd/5.4.x 2016-11-04 16:24:55 +01:00
Andreas Dangel 3a46e9bab2 Merge branch 'bug-1520' into pmd/5.3.x 2016-11-04 16:24:48 +01:00
Andreas Dangel d7b8bae1c9 plsql: adjust code samples, since "ONLY" is now a keyword 2016-11-04 16:21:25 +01:00
Andreas Dangel 4ab1d0cbee Fixes #1520 [plsql] Missing PL/SQL language constructs in parser: Is Of Type, Using 2016-11-04 16:10:07 +01:00
Andreas Dangel 52a8758262 Merge branch 'bug-1532' 2016-11-04 12:49:26 +01:00
Andreas Dangel 7bfc1b9545 Merge branch 'bug-1532' into pmd/5.4.x 2016-11-04 12:47:21 +01:00
Andreas Dangel 8444b2fea6 Merge branch 'bug-1532' into pmd/5.3.x 2016-11-04 12:46:05 +01:00
Andreas Dangel a9d0de9450 Fixes #1532 [java] CloneMethodMustImplementCloneable: Implemented Interface extends Cloneable 2016-11-04 12:41:57 +01:00
Andreas Dangel 2c7f2ec0df Merge branch 'feature-1539' 2016-11-04 11:20:11 +01:00
Andreas Dangel cec3e1a2ad plsql: add new rule "MisplacedPragma"
#1539 [plsql] Create new rule for strict syntax checking: MisplacedPragma
2016-11-04 11:19:52 +01:00
Andreas Dangel 176eda21fe Merge branch 'bug-1527' 2016-11-04 10:34:39 +01:00
Andreas Dangel 276cff02f8 Merge branch 'bug-1527' into pmd/5.4.x 2016-11-04 10:30:46 +01:00
Andreas Dangel 08b7959557 Merge branch 'bug-1527' into pmd/5.3.x 2016-11-04 10:23:33 +01:00
Andreas Dangel 495dcb5ea9 Fixes #1527 [plsql] PRAGMA AUTONOMOUS_TRANSACTION gives processing errors 2016-11-04 10:19:24 +01:00
Andreas Dangel 6810b9c54a Merge branch 'bug-1521' 2016-11-04 09:45:27 +01:00
Andreas Dangel 9f9124b8fb Fixes #1521 [apex] ApexUnitTestClassShouldHaveAsserts: Parsing error on APEX class: expected one element but was: <BlockStatement, BlockStatement> 2016-11-04 09:44:23 +01:00
Andreas Dangel 6dcf301e4d Merge branch 'bug-1490' 2016-11-04 08:55:45 +01:00
Andreas Dangel 8c89ce0d9d Merge branch 'bug-1490' into pmd/5.4.x 2016-11-04 08:49:59 +01:00
Andreas Dangel 15ff7ca944 Fixes #1490 [java] PMD Error while processing - NullPointerException 2016-11-04 08:46:00 +01:00
Andreas Dangel ba50b3183e Refactor out AbstractLombokAwareRule 2016-11-02 20:34:50 +01:00
Andreas Dangel e611dc8412 Merge branch 'bug-1494' 2016-11-02 20:27:22 +01:00
Andreas Dangel 4ac34af067 Merge branch 'bug-1494' into pmd/5.4.x 2016-11-02 20:22:53 +01:00
Andreas Dangel 0c75e5123c Fixes #1494 [java] SingularField: lombok.Data false positive 2016-11-02 20:22:15 +01:00
Andreas Dangel cc94ed4c33 Add missing sites for sub modules (java8, test, ui)
Add missing sub module site menu (groovy, java8, perl, swift, test, ui)
2016-11-02 19:51:43 +01:00
Andreas Dangel 9be65ef2eb Add unit test for #1537 Implement strict ruleset parsing 2016-11-01 18:30:39 +01:00
Andreas Dangel 67ddaafe44 Merge branch 'fix1531' of https://github.com/fjalvingh/pmd 2016-10-30 19:23:11 +01:00
Andreas Dangel db26052236 Merge branch 'pr-119' 2016-10-30 19:22:53 +01:00
Andreas Dangel 5827acb93e Merge branch 'pr-119' into pmd/5.4.x 2016-10-30 19:17:26 +01:00
Andreas Dangel 7339227e9c Merge branch 'pr-119' into pmd/5.3.x 2016-10-30 19:16:52 +01:00
Andreas Dangel 2cc91732ec Update changelog 2016-10-30 19:11:54 +01:00
Frits Jalvingh 4310b36344 Fix PMD issue 1531- endless loop followed by OOM while parsing (PL)SQL 2016-10-30 19:09:11 +01:00
Andreas Dangel 575a5b6547 Add unit test for #1531 [plsql] OOM/Endless loop while parsing (PL)SQL 2016-10-30 19:08:00 +01:00
Andreas Dangel 1f046cd7e9 Update credits 2016-10-30 19:01:47 +01:00
Andreas Dangel 5937e89d4f Merge branch 'pr-118' 2016-10-30 18:59:10 +01:00
Andreas Dangel 7791a87c23 Update changelog 2016-10-30 18:52:17 +01:00
Andreas Dangel 2158a792ff Merge branch 'simplify-variable-declarator-id-parsing' of https://github.com/Monits/pmd into pr-118
# Conflicts:
#	pmd-java/etc/grammar/Java.jjt
2016-10-30 18:51:44 +01:00
Andreas Dangel 2f498d1130 Merge branch 'pr-117' 2016-10-30 18:48:53 +01:00
Andreas Dangel 0ba362c4c0 Update changelog 2016-10-30 18:38:52 +01:00
Andreas Dangel 2f5a7058cb Merge branch 'faster-symbol' of https://github.com/Monits/pmd into pr-117 2016-10-30 18:38:08 +01:00
Andreas Dangel b2a66fef01 Merge branch 'pr-116' 2016-10-30 18:32:44 +01:00
Andreas Dangel fa9485b41e Update changelog 2016-10-30 18:26:10 +01:00
Andreas Dangel c6680e2f66 Merge branch 'better-collections' of https://github.com/Monits/pmd into pr-116 2016-10-30 18:25:35 +01:00
Andreas Dangel 5db46d6ad1 Merge branch 'pr-115' 2016-10-30 18:22:00 +01:00
Andreas Dangel 4cf22bed16 Update changelog 2016-10-30 18:14:59 +01:00
Andreas Dangel 15b36498f3 More test cases for lambda parsing 2016-10-30 18:14:23 +01:00
Andreas Dangel 10e4cc7290 Merge branch 'faster-parse' of https://github.com/Monits/pmd into pr-115
# Conflicts:
#	pmd-java/etc/grammar/Java.jjt
2016-10-30 18:12:54 +01:00
Andreas Dangel 949470013a Merge branch 'pr-114' 2016-10-30 17:51:43 +01:00
Andreas Dangel bdde3533dc Update changelog 2016-10-30 17:44:56 +01:00
Andreas Dangel bdb408507b Merge branch 'remove-dead-code' of https://github.com/Monits/pmd into pr-114 2016-10-30 17:39:48 +01:00
Andreas Dangel 6fb962c326 Merge branch 'sdte-java8-compat' of https://github.com/Monits/pmd 2016-10-30 17:32:08 +01:00
Andreas Dangel 2d1337b300 Merge branch 'pr-113' 2016-10-30 17:31:50 +01:00
Andreas Dangel 315ea28d4c Merge branch 'pr-113' into pmd/5.4.x 2016-10-30 17:25:47 +01:00
Andreas Dangel 45dfd29a46 Merge branch 'pr-113' into pmd/5.3.x 2016-10-30 17:25:14 +01:00
Andreas Dangel f8f0afb5b4 Update changelog 2016-10-30 17:21:18 +01:00
Juan Martín Sotuyo Dodero f8d1162886 Fix ClassCastException on SignatureDeclareThrowsException
- Java 8 code allows for things such as
   `class UnmodifiableList<T> implements @Readonly List<@Readonly T> {}`
    where not all token in the ASTImplementsList are ASTClassOrInterfaceType
2016-10-30 17:19:16 +01:00
Andreas Dangel 020170bd76 Add test for #1535 [java] SignatureDeclareThrowsException: ClassCastException with Annotation 2016-10-30 17:18:31 +01:00
Andreas Dangel cb304c9ae7 Merge branch 'cmmic-java8-compat' of https://github.com/Monits/pmd 2016-10-29 18:34:43 +02:00
Andreas Dangel 646a4b0650 Merge branch 'pr-112' 2016-10-29 18:34:00 +02:00
Andreas Dangel b0fb0cadc1 Merge branch 'pr-112' into pmd/5.4.x 2016-10-29 18:28:36 +02:00
Andreas Dangel 5c80473108 Merge branch 'pr-112' into pmd/5.3.x 2016-10-29 18:27:56 +02:00
Andreas Dangel 9de0727e43 Update changelog 2016-10-29 18:21:55 +02:00
Andreas Dangel 127a2be871 whitespaces 2016-10-29 18:19:59 +02:00
Juan Martín Sotuyo Dodero 238f6b721b Fix ClassCastException on CloneMethodMustImplementCloneable
- Java 8 code allows for things such as
    `class UnmodifiableList<T> implements @Readonly List<@Readonly T> {}`
    where not all token in the ASTImplementsList are ASTClassOrInterfaceType
2016-10-29 18:19:00 +02:00
Andreas Dangel f4f2402661 Add test for #1534 [java] CloneMethodMustImplementCloneable: ClassCastException with Annotation (java8) 2016-10-29 18:17:59 +02:00
Andreas Dangel 75c9cce071 Merge branch 'birule-java8-compat' of https://github.com/Monits/pmd 2016-10-29 17:25:02 +02:00
Andreas Dangel 04257e657d Merge branch 'pr-111' 2016-10-29 17:24:40 +02:00
Andreas Dangel b2c59bcbdb Merge branch 'pr-111' into pmd/5.4.x 2016-10-29 17:20:32 +02:00
Andreas Dangel c95051e97d Merge branch 'pr-111' into pmd/5.3.x 2016-10-29 17:19:47 +02:00
Andreas Dangel 7d5be34cd2 Update changelog 2016-10-29 17:16:01 +02:00
Juan Martín Sotuyo Dodero 1e5c1c05ca In Java 8, annotations may appear as first child
- For instance `Object o = new @Interned MyObject();` would fail with a ClassCastException
 - The current code deals with it gracefully
2016-10-29 17:13:33 +02:00
Andreas Dangel 5d11e77208 Add test for #1533 [java] BooleanInstantiation: ClassCastException with Annotation 2016-10-29 17:12:20 +02:00
Frits Jalvingh 42d5a402c7 Fix PMD issue 1531- endless loop followed by OOM while parsing (PL)SQL 2016-10-18 17:41:08 +02:00
Andreas Dangel e7a68f4492 Merge branch 'pr-110' 2016-10-16 14:15:04 +02:00
Andreas Dangel f88e86cdb1 Merge branch 'bug-1530' 2016-10-16 14:14:30 +02:00
Andreas Dangel 578d854632 Merge branch 'bug-1530' into pmd/5.4.x 2016-10-16 14:08:13 +02:00
Andreas Dangel 1bc409119c Update changelog, fixes #1530 [java] Parser exception on Java code 2016-10-16 14:07:56 +02:00
Juan Martín Sotuyo Dodero 283dc00a43 Replace syntactic lookahead with semantic one
- They are the same, but JavaCC seems to handle this one better.
2016-10-16 14:01:26 +02:00
Juan Martín Sotuyo Dodero e9f14e4496 Add failing test scenario 2016-10-16 13:59:17 +02:00
Juan Martín Sotuyo Dodero 9b7372eec0 Minor improvements
- Typos, extra whitespace, a missing static, clearer loops..
2016-10-15 02:55:02 -03:00
Juan Martín Sotuyo Dodero 8c82dae34c Fully implemente couldResolve 2016-10-14 19:35:32 -03:00
Juan Martín Sotuyo Dodero 565a9aa0d8 Add a cache to ImplicitImportResolver
- Classes in java.lang.* aren't that many, yet they hit a lot (String,
    all boxed primitives, Math, etc.), so it makes sense to cache them
2016-10-14 18:59:52 -03:00
Juan Martín Sotuyo Dodero d350bcb49e Make explicit imports orders of times faster
- We can tell if a name can be resolved or not, and we can do so in
    constant time.
2016-10-14 16:06:28 -03:00
Juan Martín Sotuyo Dodero 567be45b8c Simplify VariableDeclaratorId parsing
- Don't look for arrays where there can be none
2016-10-14 10:06:29 -03:00
Juan Martín Sotuyo Dodero 478ed3463c Simplify lambda pursing even further
- Remove a redundant case
 - Restrict grammar according to spec with a simpler scenario
2016-10-14 09:24:06 -03:00
Juan Martín Sotuyo Dodero 09ac963709 Improve SymbolTable times further
- Expand hashCode calculation for `MethodNameDeclaration` to avoid collisions
    when overloading.
 - Also make sure `builtInMethodDeclaration` provides a complete syntax tree to avoid NPE
    when calling `hashCode` or `equals`
2016-10-13 20:40:46 -03:00
Juan Martín Sotuyo Dodero d8344b0672 Simplify varargs detection
- Make use of our Java knowledge when analyzing Java code
2016-10-13 18:03:51 -03:00
Juan Martín Sotuyo Dodero 382699b766 Improve type resolution
- Notice the `couldResolve` doesn't guarantee a positive resolution, but still
     manages to kill early some resolver checks
 - `PrimiiveTypeResolver.resolve()` and `VoidTypeResolver.resolve()`
     were the 2nd and 5th most time consuming methods on several profiles
     I ran. This change fixes it.
2016-10-13 18:03:31 -03:00
Juan Martín Sotuyo Dodero be83d154d0 Don't assume the List supports random access 2016-10-13 17:17:43 -03:00
Juan Martín Sotuyo Dodero 42277d7b8d Simplify collection expressions 2016-10-13 17:17:17 -03:00
Juan Martín Sotuyo Dodero a046b8f93d Simplify lambda parsing
- Handle less scenarios
 - Have scenarios be defined more broadly (ie: allow more than 3 params)
 - This improves parsing performance by roughly ~10%
2016-10-13 14:53:51 -03:00
Juan Martín Sotuyo Dodero df9893099f No PMD version supports running on JRE5 anymore
- Remove dead code to guard against JRE5 issues
2016-10-13 01:59:19 -03:00
Juan Martín Sotuyo Dodero 61b55bd7e5 Minor improvements
- Use `Deque` and `ArrayDeque` instead of `Stack`
 - Use presized `ArrayList` instead of a dynamic `LinkedList` when possible
 - Don't create empty `HashSet` when `Collections.emptySet()` suffices
 - User `Collections.singletonList()` were apropriate
2016-10-13 01:53:47 -03:00
Juan Martín Sotuyo Dodero 8f62f6cae9 In Java 8, annotations may appear as first child
- For instance `Object o = new @Interned MyObject();` would fail with a ClassCastException
 - The current code deals with it gracefully
2016-10-12 21:20:48 -03:00
Juan Martín Sotuyo Dodero ca2ccb4a80 Fix ClassCastException on SignatureDeclareThrowsException
- Java 8 code allows for things such as
   `class UnmodifiableList<T> implements @Readonly List<@Readonly T> {}`
    where not all token in the ASTImplementsList are ASTClassOrInterfaceType
2016-10-12 18:06:52 -03:00
Juan Martín Sotuyo Dodero 3774a22878 Fix ClassCastException on CloneMethodMustImplementCloneable
- Java 8 code allows for things such as
    `class UnmodifiableList<T> implements @Readonly List<@Readonly T> {}`
    where not all token in the ASTImplementsList are ASTClassOrInterfaceType
2016-10-12 18:01:03 -03:00
Juan Martín Sotuyo Dodero a10f98e0c4 Replace syntactic lookahead with semantic one
- They are the same, but JavaCC seems to handle this one better.
2016-10-12 16:58:33 -03:00
Juan Martín Sotuyo Dodero a50c781d0a Add failing test scenario 2016-10-12 14:18:29 -03:00
Juan Martín Sotuyo Dodero fccd26b2d0 Dont use synchronized structures onnon-shared data
- AFAIK ScopeAndDeclarationFinder is only used as a local,
    used as alocal by SymbolFacade, used as a local by SourceCodeProcessor.
    Synchronizing is needless.
2016-10-11 17:48:39 -03:00
Andreas Dangel b773da1441 Merge branch 'bug-1529' 2016-10-01 17:58:53 +02:00
Andreas Dangel 1b52e0192a Merge branch 'bug-1529' into pmd/5.4.x 2016-10-01 17:54:11 +02:00
Andreas Dangel 461365f543 Merge branch 'bug-1529' into pmd/5.3.x 2016-10-01 17:49:33 +02:00
Andreas Dangel 8667aea076 Fixes #1529 [java] UnusedImports: The created rule violation has no class name 2016-10-01 17:45:47 +02:00
Andreas Dangel aec40ec20c groovy: fix GroovyLanguage not in src/main 2016-09-26 20:10:11 +02:00
Andreas Dangel 82cc8b1d50 groovy: Add groovy to pmd-dist 2016-09-26 20:10:08 +02:00
Andreas Dangel f9deb34809 Merge branch 'bug-1522' 2016-09-25 18:42:51 +02:00
Andreas Dangel 354b9a9cbc Merge branch 'bug-1522' into pmd/5.4.x 2016-09-25 18:37:38 +02:00
Andreas Dangel b07c2f4409 Merge branch 'bug-1522' into pmd/5.3.x 2016-09-25 18:36:47 +02:00
Andreas Dangel db44bc4745 Fixes #1522 [java] CommentRequired: false positive 2016-09-25 18:32:26 +02:00
Andreas Dangel b67ac6ff2b Merge branch 'pr-107' 2016-09-25 17:01:46 +02:00
Andreas Dangel ccc09c5d4f Update changelog 2016-09-25 16:58:55 +02:00
Andreas Dangel 108e302bb1 Merge branch 'cpd-groovy' of https://github.com/Monits/pmd into pr-107 2016-09-25 16:51:10 +02:00
Juan Martín Sotuyo Dodero f01cc473d2 Initial support for CPD Groovy 2016-09-11 14:12:17 -03:00
Andreas Dangel 2fc01fedb5 Add readme 2016-09-06 21:10:56 +02:00
Andreas Dangel 522d0ea311 Verify #1519 [java] UselessParenthesis: False Positive: "Prohibits the use of useless parentheses" when more than one line 2016-09-02 18:22:43 +02:00
Andreas Dangel 093a813c0f Merge branch 'pr-106' 2016-09-02 18:11:49 +02:00
Andreas Dangel a99c506342 Update changelog 2016-09-02 18:06:00 +02:00
Andreas Dangel 1693692f80 Merge branch 'cpd-no-ignore-constructor' of https://github.com/Monits/pmd into pr-106 2016-09-02 18:04:39 +02:00
Andreas Dangel 2245a644f4 example toolchains.xml - add examples for macosx and windows 2016-09-02 17:32:11 +02:00
Juan Martín Sotuyo Dodero 579853385d Keep constructor names under ignoreIdentifiers
- Unrelated classes that just happen to have matching constructor types
    (maybe sibling classes extening the same base class, and simply
    calling super on all constructors) should not be reported as copy-paste
 - If you copied a whole class, CPD should still match it due to other
    member methods / fields, only case it would no longer catch is that of
    a class exclusively containing constructors, but that should probably be
    a PMD rule, and not catched by CPD itself
2016-09-01 16:57:24 -03:00
Andreas Dangel c8a9f43ee0 Refactor InvalidSlf4jMessageFormatRule 2016-08-07 11:59:36 +02:00
Andreas Dangel cd9a8186db reformat, whitespaces 2016-08-07 11:52:50 +02:00
Andreas Dangel 3bb9d90de8 Merge branch 'bug-1506' 2016-08-07 11:16:05 +02:00
Andreas Dangel d294a91ad8 Merge branch 'bug-1506' into pmd/5.4.x 2016-08-07 11:08:22 +02:00
Andreas Dangel 7421f28414 Merge branch 'bug-1506' into pmd/5.3.x 2016-08-07 10:53:32 +02:00
Andreas Dangel cf4938a65b Fixes #1506 [core] When runing any RuleTst, start/end methods not called 2016-08-07 10:44:44 +02:00
Andreas Dangel 6aee2dd232 Merge branch 'bug-1500' 2016-08-05 11:16:32 +02:00
Andreas Dangel a74105faa4 Fixes #1500 [java] InvalidSlf4jMessageFormat: doesn't ignore exception param 2016-08-05 11:08:36 +02:00
Andreas Dangel 869ee8569e verify #1505 [java] ConstantsInInterface false negative 2016-08-03 20:06:02 +02:00
Andreas Dangel 8a6ac1f156 Merge branch 'bug-1509' 2016-08-03 19:56:59 +02:00
Andreas Dangel a6acf7ca81 Fixes #1509 [java] InvalidSlf4jMessageFormat NPE 2016-08-03 19:43:10 +02:00
Andreas Dangel 4bb02531c7 Use new pmd for m-pmd-plugin 2016-07-28 20:12:38 +02:00
Andreas Dangel 0a2ebc2186 Formatting, license header 2016-07-28 19:44:16 +02:00
Andreas Dangel 3e43fd8eb1 Update (old) changelog for new rules with PMD 5.5.1 2016-07-28 19:44:04 +02:00
Andreas Dangel 5207d48bb2 Prepare next development version 2016-07-27 22:03:51 +02:00
Andreas Dangel 6746b7522c [maven-release-plugin] prepare for next development iteration 2016-07-27 20:40:56 +02:00
Andreas Dangel 5b6580448e #1508 - Only close the classloader if its ours 2016-07-27 19:43:31 +02:00
Andreas Dangel 7578875cbd #1508 - Only close the classloader if its ours 2016-07-26 21:49:33 +02:00
Andreas Dangel 42a5c6a537 Merge branch 'bug-1508' into pmd/5.4.x 2016-07-26 21:42:55 +02:00
Andreas Dangel 229fc57073 Merge branch 'bug-1508' into pmd/5.3.x 2016-07-26 21:39:17 +02:00
Andreas Dangel 9240f98cce Merge branch 'pr-103' into pmd/5.4.x 2016-07-07 22:35:26 +02:00
Andreas Dangel 4adbeb04f1 Merge branch 'pr-103' into pmd/5.3.x 2016-07-07 22:34:30 +02:00
Andreas Dangel e25bd5e9c1 Merge branch 'bug-1499' into pmd/5.4.x 2016-07-02 16:54:50 +02:00
Andreas Dangel c041f756c2 Merge branch 'bug-1499' into pmd/5.3.x 2016-07-02 16:49:19 +02:00
Andreas Dangel c92820eaae Merge branch 'pr-35' into pmd/5.4.x 2016-06-12 18:51:09 +02:00
Andreas Dangel 6efabd6909 Merge branch 'pr-35' into pmd/5.3.x 2016-06-12 18:50:07 +02:00
129 changed files with 2456 additions and 479 deletions

No files matched your search

+3 -3
View File
@@ -115,8 +115,8 @@ fi
(
cd pmd-dist/target
unzip pmd-bin-*.zip
cd pmd-bin-*
unzip pmd-bin-${RELEASE_VERSION}-SNAPSHOT.zip
cd pmd-bin-${RELEASE_VERSION}-SNAPSHOT
./bin/run.sh pmd -d ../../../pmd-java/src/main/java -language java -f xml -R rulesets/java/unusedcode.xml
)
@@ -252,7 +252,7 @@ cat <<EOF
**New Supported Languages:**
**Feature Request and Improvements:**
**Feature Requests and Improvements:**
**New/Modified/Deprecated Rules:**
+10 -3
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
<!-- place this file in ${user.home}/.m2/toolchains.xml -->
<!-- adjust the paths to jdkhome -->
<toolchain>
<type>jdk</type>
@@ -8,7 +9,9 @@
<version>1.6</version>
</provides>
<configuration>
<jdkHome>/path/to/jdk/1.6</jdkHome>
<jdkHome>/path/to/jdk/1.6</jdkHome> <!-- Linux -->
<jdkHome>/Library/Java/JavaVirtualMachines/jdk1.6.0_45.jdk/Contents/Home</jdkHome> <!-- MacOSX -->
<jdkHome>C:\\java\\edition\\jdk1.6.0_45</jdkHome> <!-- Windows -->
</configuration>
</toolchain>
<toolchain>
@@ -17,7 +20,9 @@
<version>1.7</version>
</provides>
<configuration>
<jdkHome>/path/to/jdk/1.7</jdkHome>
<jdkHome>/path/to/jdk/1.7</jdkHome> <!-- Linux -->
<jdkHome>/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home</jdkHome> <!-- MacOSX -->
<jdkHome>C:\\java\\edition\\jdk1.7.0_80</jdkHome> <!-- Windows -->
</configuration>
</toolchain>
<toolchain>
@@ -26,7 +31,9 @@
<version>1.8</version>
</provides>
<configuration>
<jdkHome>/path/to/jdk/1.8</jdkHome>
<jdkHome>/path/to/jdk/1.8</jdkHome> <!-- Linux -->
<jdkHome>/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home</jdkHome> <!-- MacOSX -->
<jdkHome>C:\\java\\edition\\jdk1.8.0_92</jdkHome> <!-- Windows -->
</configuration>
</toolchain>
</toolchains>
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>5.5.1</version>
<version>5.5.2</version>
</parent>
<properties>
@@ -14,4 +14,17 @@ public class ASTMethodCallExpression extends AbstractApexNode<MethodCallExpressi
public Object jjtAccept(ApexParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
public String getMethodName() {
return getNode().getMethodName();
}
public String getFullMethodName() {
final String methodName = getMethodName();
String typeName = "";
if (!getNode().getReferenceExpression().getJadtIdentifiers().isEmpty()) {
typeName = getNode().getReferenceExpression().getJadtIdentifiers().get(0).value + ".";
}
return typeName + methodName;
}
}
@@ -1,9 +1,13 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.apex.rule.apexunit;
import net.sourceforge.pmd.lang.apex.ast.*;
import net.sourceforge.pmd.lang.apex.rule.AbstractApexRule;
import apex.jorje.services.Version;
import net.sourceforge.pmd.lang.apex.ast.ASTModifierNode;
import net.sourceforge.pmd.lang.apex.ast.ASTUserClass;
import net.sourceforge.pmd.lang.apex.ast.ApexNode;
import net.sourceforge.pmd.lang.apex.rule.AbstractApexRule;
/**
* Do special checks for apex unit test classes and methods
@@ -1,10 +1,18 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.apex.rule.apexunit;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.google.common.collect.Iterables;
import net.sourceforge.pmd.lang.apex.ast.*;
import net.sourceforge.pmd.lang.apex.ast.ASTBlockStatement;
import net.sourceforge.pmd.lang.apex.ast.ASTMethod;
import net.sourceforge.pmd.lang.apex.ast.ASTMethodCallExpression;
import net.sourceforge.pmd.lang.apex.ast.ASTStatement;
import net.sourceforge.pmd.lang.apex.ast.ApexNode;
/**
* Apex unit tests should have System.assert methods in them
@@ -13,11 +21,13 @@ import net.sourceforge.pmd.lang.apex.ast.*;
*/
public class ApexUnitTestClassShouldHaveAsserts extends AbstractApexUnitTestRule {
private static final String SYSTEM = "System";
private static final String ASSERT = "assert";
private static final String ASSERT_EQUALS = "assertEquals";
private static final String ASSERT_NOT_EQUALS = "assertNotEquals";
private static final Set<String> ASSERT_METHODS = new HashSet<>();
static {
ASSERT_METHODS.add("System.assert");
ASSERT_METHODS.add("System.assertEquals");
ASSERT_METHODS.add("System.assertNotEquals");
}
@Override
public Object visit(ASTMethod node, Object data) {
if (!isTestMethodOrClass(node)) {
@@ -29,21 +39,18 @@ public class ApexUnitTestClassShouldHaveAsserts extends AbstractApexUnitTestRule
private Object checkForAssertStatements(ApexNode<?> node, Object data) {
final List<ASTBlockStatement> blockStatements = node.findDescendantsOfType(ASTBlockStatement.class);
final List<ASTStatement> statements = Iterables.getOnlyElement(blockStatements).findDescendantsOfType(ASTStatement.class);
final List<ASTStatement> statements = new ArrayList<>();
final List<ASTMethodCallExpression> methodCalls = new ArrayList<>();
for (ASTBlockStatement blockStatement : blockStatements) {
statements.addAll(blockStatement.findDescendantsOfType(ASTStatement.class));
methodCalls.addAll(blockStatement.findDescendantsOfType(ASTMethodCallExpression.class));
}
boolean isAssertFound = false;
for (final ASTStatement statement : statements) {
final List<ASTMethodCallExpression> methodCalls = statement.findDescendantsOfType(ASTMethodCallExpression.class);
for (final ASTMethodCallExpression methodCallExpression : methodCalls) {
final String methodName = methodCallExpression.getNode().getMethod().getName();
if (methodCallExpression.getNode().getDefiningType().getApexName().equalsIgnoreCase(SYSTEM)
&& (methodName.equalsIgnoreCase(ASSERT)
|| methodName.equalsIgnoreCase(ASSERT_EQUALS)
|| methodName.equalsIgnoreCase(ASSERT_NOT_EQUALS))) {
isAssertFound = true;
}
for (final ASTMethodCallExpression methodCallExpression : methodCalls) {
if (ASSERT_METHODS.contains(methodCallExpression.getFullMethodName())) {
isAssertFound = true;
break;
}
}
@@ -1,11 +1,18 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.apex.rule.apexunit;
import net.sourceforge.pmd.lang.apex.ast.*;
import apex.jorje.semantic.ast.modifier.*;
import apex.jorje.semantic.ast.modifier.Annotation;
import apex.jorje.semantic.ast.modifier.AnnotationParameter;
import apex.jorje.semantic.ast.modifier.ModifierOrAnnotation;
import apex.jorje.semantic.symbol.type.AnnotationTypeInfos;
import apex.jorje.semantic.symbol.type.TypeInfoEquivalence;
import apex.jorje.services.Version;
import net.sourceforge.pmd.lang.apex.ast.ASTMethod;
import net.sourceforge.pmd.lang.apex.ast.ASTModifierNode;
import net.sourceforge.pmd.lang.apex.ast.ASTUserClass;
import net.sourceforge.pmd.lang.apex.ast.ApexNode;
/**
* <p>It's a very bad practice to use @isTest(seeAllData=true) in Apex unit tests,
@@ -9,7 +9,7 @@
</description>
<rule name="ApexUnitTestClassShouldHaveAsserts"
since="2.0"
since="5.5.1"
message="Apex unit tests should System.assert() or assertEquals() or assertNotEquals()"
class="net.sourceforge.pmd.lang.apex.rule.apexunit.ApexUnitTestClassShouldHaveAsserts"
externalInfoUrl="${pmd.website.baseurl}/rules/apex/apexunit.html#ApexUnitTestClassShouldHaveAsserts">
@@ -33,7 +33,7 @@ public class Foo {
</example>
</rule>
<rule name="ApexUnitTestShouldNotUseSeeAllDataTrue"
since="2.0"
since="5.5.1"
message="Apex unit tests should not use @isTest(seeAllData = true)"
class="net.sourceforge.pmd.lang.apex.rule.apexunit.ApexUnitTestShouldNotUseSeeAllDataTrue"
externalInfoUrl="${pmd.website.baseurl}/rules/apex/apexunit.html#ApexUnitTestShouldNotUseSeeAllDataTrue">
@@ -1,3 +1,6 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.apex.rule.apexunit;
import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
@@ -16,4 +16,44 @@ public class Foo {
}
]]></code>
</test-code>
<test-code>
<description>#1521 [apex] ApexUnitTestClassShouldHaveAsserts: Parsing error on APEX class: expected one element but was: &lt;BlockStatement, BlockStatement&gt;</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
@isTest
private class C2_Assignment_Report_Job_Test {
public static testMethod void testCreateAssignmentsForDifferentRoles() {
User u = C2_Test_Utils.getWFUser('testWfc', true);
System.runAs(u) {
C2_Assignment_Report_Data_Aggregate_Job job = new C2_Assignment_Report_Data_Aggregate_Job();
String query = job.start(null).getQuery();
C2_Receiver_Unit__c ru = new C2_Receiver_Unit__c(Name='RU1');
insert ru;
List<C2_Case__c> cases = new List<C2_Case__c>();
cases.add(new C2_Case__c(Name='TT0000000', Queue__c = 'PA-CSA', Status__c=C2_Case_Util.STATUS_NEW, PA_CSA__c=u.Id, DSA__c=u.Id, QR_CSA__c=u.Id, Receiver_Unit__c=ru.Id));
cases.add(new C2_Case__c(Name='TT0000001', Queue__c = 'PA-CSA', Status__c=C2_Case_Util.STATUS_NEW, PA_CSA__c=u.Id, DSA__c=u.Id, QR_CSA__c=u.Id, Receiver_Unit__c=ru.Id));
cases.add(new C2_Case__c(Name='TT0000002', Queue__c = 'PA-CSA', Status__c=C2_Case_Util.STATUS_NEW, PA_CSA__c=u.Id, DSA__c=u.Id, QR_CSA__c=u.Id, Receiver_Unit__c=ru.Id));
cases.add(new C2_Case__c(Name='TT0000011', Queue__c = 'DSA', Status__c=C2_Case_Util.STATUS_PACSA_COMPLETE, PA_CSA__c=u.Id, DSA__c=u.Id, QR_CSA__c=u.Id, Receiver_Unit__c=ru.Id));
cases.add(new C2_Case__c(Name='TT0000012', Queue__c = 'DSA', Status__c=C2_Case_Util.STATUS_PACSA_COMPLETE, PA_CSA__c=u.Id, DSA__c=u.Id, QR_CSA__c=u.Id, Receiver_Unit__c=ru.Id));
cases.add(new C2_Case__c(Name='TT0000021', Queue__c = 'QR-CSA', Status__c=C2_Case_Util.STATUS_DSA_COMPLETE, PA_CSA__c=u.Id, DSA__c=u.Id, QR_CSA__c=u.Id, Receiver_Unit__c=ru.Id));
insert cases;
List<C2_Case__c> scope = Database.query(query);
Test.startTest();
job.execute(null, scope);
Test.stopTest();
List<C2_Case_Assign_Report_Data__c> caseEventEntries =
[select Num_Cases_Assign__c, Num_Cases_Not_Completed__c, Num_Cases_Reassigned__c, Num_Cases_Completed__c, User__c, Role__c
from C2_Case_Assign_Report_Data__c];
System.assertEquals(3, caseEventEntries.size());
Map<String, Integer> userIdWithRole2ReportData = getCaseEventEntriesMap(caseEventEntries);
System.assertEquals(3, userIdWithRole2ReportData.get(createUserRoleKey(u.Id, 'PA-CSA')));
System.assertEquals(2, userIdWithRole2ReportData.get(createUserRoleKey(u.Id, 'DSA')));
System.assertEquals(1, userIdWithRole2ReportData.get(createUserRoleKey(u.Id, 'QR-CSA')));
}
}
}
]]></code>
</test-code>
</test-data>
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>5.5.1</version>
<version>5.5.2</version>
</parent>
<properties>
@@ -32,9 +32,7 @@ public abstract class AbstractPropertySource implements PropertySource {
* @return a copy of the property descriptors.
*/
protected List<PropertyDescriptor<?>> copyPropertyDescriptors() {
List<PropertyDescriptor<?>> copy = new ArrayList<>(propertyDescriptors.size());
copy.addAll(propertyDescriptors);
return copy;
return new ArrayList<>(propertyDescriptors);
}
/**
@@ -43,10 +41,7 @@ public abstract class AbstractPropertySource implements PropertySource {
* @return a copy of the values
*/
protected Map<PropertyDescriptor<?>, Object> copyPropertyValues() {
Map<PropertyDescriptor<?>, Object> copy = new HashMap<>(
propertyValuesByDescriptor.size());
copy.putAll(propertyValuesByDescriptor);
return copy;
return new HashMap<>(propertyValuesByDescriptor);
}
/**
@@ -13,7 +13,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.Set;
@@ -22,7 +21,9 @@ import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import net.sourceforge.pmd.benchmark.Benchmark;
import net.sourceforge.pmd.benchmark.Benchmarker;
@@ -43,7 +44,6 @@ import net.sourceforge.pmd.stat.Metric;
import net.sourceforge.pmd.util.ClasspathClassLoader;
import net.sourceforge.pmd.util.FileUtil;
import net.sourceforge.pmd.util.IOUtil;
import net.sourceforge.pmd.util.SystemUtils;
import net.sourceforge.pmd.util.database.DBMSMetadata;
import net.sourceforge.pmd.util.database.DBURI;
import net.sourceforge.pmd.util.database.SourceObject;
@@ -52,9 +52,6 @@ import net.sourceforge.pmd.util.datasource.ReaderDataSource;
import net.sourceforge.pmd.util.log.ConsoleLogHandler;
import net.sourceforge.pmd.util.log.ScopedLogHandlersManager;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
/**
* This is the main class for interacting with PMD. The primary flow of all Rule
* process is controlled via interactions with this class. A command line
@@ -245,8 +242,7 @@ public class PMD {
long reportStart = System.nanoTime();
try {
Renderer renderer = configuration.createRenderer();
List<Renderer> renderers = new LinkedList<>();
renderers.add(renderer);
List<Renderer> renderers = Collections.singletonList(renderer);
renderer.setWriter(IOUtil.createWriter(configuration.getReportFile()));
renderer.start();
@@ -365,7 +361,7 @@ public class PMD {
* be disabled if threadCount is not positive, e.g. using the
* "-threads 0" command line option.
*/
if (SystemUtils.MT_SUPPORTED && configuration.getThreads() > 0) {
if (configuration.getThreads() > 0) {
new MultiThreadProcessor(configuration).processFiles(ruleSetFactory, files, ctx, renderers);
} else {
new MonoThreadProcessor(configuration).processFiles(ruleSetFactory, files, ctx, renderers);
@@ -7,18 +7,22 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.commons.io.IOUtils;
import net.sourceforge.pmd.benchmark.Benchmark;
import net.sourceforge.pmd.benchmark.Benchmarker;
import net.sourceforge.pmd.lang.*;
import net.sourceforge.pmd.lang.Language;
import net.sourceforge.pmd.lang.LanguageVersion;
import net.sourceforge.pmd.lang.LanguageVersionHandler;
import net.sourceforge.pmd.lang.Parser;
import net.sourceforge.pmd.lang.VisitorStarter;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.ParseException;
import net.sourceforge.pmd.lang.xpath.Initializer;
import org.apache.commons.io.IOUtils;
public class SourceCodeProcessor {
private final PMDConfiguration configuration;
@@ -141,13 +145,10 @@ public class SourceCodeProcessor {
usesDFA(languageVersion, rootNode, ruleSets, language);
usesTypeResolution(languageVersion, rootNode, ruleSets,language);
List<Node> acus = new ArrayList<>();
acus.add(rootNode);
List<Node> acus = Collections.singletonList(rootNode);
ruleSets.apply(acus, ctx, language);
}
private void determineLanguage(RuleContext ctx) {
// If LanguageVersion of the source file is not known, make a determination
if (ctx.getLanguageVersion() == null) {
@@ -179,7 +179,7 @@ public class PMDTaskImpl {
return null;
} // not relevant
};
List<Renderer> renderers = new LinkedList<>();
List<Renderer> renderers = new ArrayList<>(formatters.size() + 1);
renderers.add(logRenderer);
for (Formatter formatter : formatters) {
renderers.add(formatter.getRenderer());
@@ -0,0 +1,4 @@
# AST
Abstract Syntax Tree
@@ -68,15 +68,11 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
}
private List<String> copyExamples() {
List<String> copy = new ArrayList<>(examples.size());
copy.addAll(examples);
return copy;
return new ArrayList<>(examples);
}
private List<String> copyRuleChainVisits() {
List<String> copy = new ArrayList<>(ruleChainVisits.size());
copy.addAll(ruleChainVisits);
return copy;
return new ArrayList<>(ruleChainVisits);
}
/**
@@ -3,20 +3,17 @@
*/
package net.sourceforge.pmd.lang.rule.xpath;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Stack;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sourceforge.pmd.PropertyDescriptor;
import net.sourceforge.pmd.RuleContext;
import net.sourceforge.pmd.lang.ast.Node;
import org.jaxen.BaseXPath;
import org.jaxen.JaxenException;
import org.jaxen.Navigator;
@@ -33,6 +30,10 @@ import org.jaxen.expr.UnionExpr;
import org.jaxen.expr.XPathFactory;
import org.jaxen.saxpath.Axis;
import net.sourceforge.pmd.PropertyDescriptor;
import net.sourceforge.pmd.RuleContext;
import net.sourceforge.pmd.lang.ast.Node;
/**
* This is a Jaxen based XPathRule query.
*/
@@ -121,7 +122,7 @@ public class JaxenXPathRuleQuery extends AbstractXPathRuleQuery {
indexXPath(originalXPath, AST_ROOT);
boolean useRuleChain = true;
Stack<Expr> pending = new Stack<>();
Deque<Expr> pending = new ArrayDeque<>();
pending.push(originalXPath.getRootExpr());
while (!pending.isEmpty()) {
Expr node = pending.pop();
@@ -3,6 +3,7 @@
*/
package net.sourceforge.pmd.processor;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutionException;
@@ -41,7 +42,7 @@ public class MultiThreadProcessor extends AbstractPMDProcessor {
PmdThreadFactory factory = new PmdThreadFactory(ruleSetFactory, ctx);
ExecutorService executor = Executors.newFixedThreadPool(
configuration.getThreads(), factory);
List<Future<Report>> tasks = new LinkedList<>();
List<Future<Report>> tasks = new ArrayList<>(files.size());
for (DataSource dataSource : files) {
String niceFileName = filenameFrom(dataSource);
@@ -1,42 +0,0 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.util;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public final class SystemUtils {
/**
* Do we have proper permissions to use multithreading?
*/
public static final boolean MT_SUPPORTED;
private SystemUtils() {
// this is a utility class and cannot be instantiated
}
static {
boolean error = false;
try {
/*
* ant task ran from Eclipse with jdk 1.5.0 raises an AccessControlException
* when shutdown is called. Standalone pmd or ant from command line are fine.
*
* With jdk 1.6.0, ant task from Eclipse also works.
*
* Bugs related to this hack:
* http://sourceforge.net/p/pmd/bugs/1025/
* http://sourceforge.net/p/pmd/bugs/670/
*/
ExecutorService executor = Executors.newFixedThreadPool(1);
executor.shutdown();
} catch (RuntimeException e) {
error = true;
System.err.println("Disabling multithreading - consider to upgrade to java 1.6");
System.err.println("See also: http://sourceforge.net/p/pmd/bugs/670/");
}
MT_SUPPORTED = !error;
}
}
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<ruleset name="551"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
This ruleset contains links to rules that are new in PMD v5.5.1
</description>
<rule ref="rulesets/apex/apexunit.xml/ApexUnitTestClassShouldHaveAsserts" />
<rule ref="rulesets/apex/apexunit.xml/ApexUnitTestShouldNotUseSeeAllDataTrue" />
</ruleset>
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<ruleset name="552"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
This ruleset contains links to rules that are new in PMD v5.5.2
</description>
<rule ref="rulesets/plsql/strictsyntax.xml/MisplacedPragma"/>
</ruleset>
@@ -627,6 +627,63 @@ public class RuleSetFactoryTest {
ruleSetFactory.createRuleSet(ref);
}
/**
* This unit test manifests the current behavior - which might change in the future. See #1537.
*
* Currently, if a ruleset is imported twice, the excludes of the first import are ignored.
* Duplicated rules are silently ignored.
*
* @throws Exception any error
* @see <a href="https://sourceforge.net/p/pmd/bugs/1537/">#1537 Implement strict ruleset parsing</a>
* @see <a href="http://stackoverflow.com/questions/40299075/custom-pmd-ruleset-not-working">stackoverflow - custom ruleset not working</a>
*/
@Test
public void testExcludeAndImportTwice() throws Exception {
RuleSetReferenceId ref1 = createRuleSetReferenceId("<?xml version=\"1.0\"?>\n" +
"<ruleset name=\"Custom ruleset for tests\"\n" +
" xmlns=\"http://pmd.sourceforge.net/ruleset/2.0.0\"\n" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
" xsi:schemaLocation=\"http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd\">\n" +
" <description>Custom ruleset for tests</description>\n" +
" <rule ref=\"rulesets/dummy/basic.xml\">\n" +
" <exclude name=\"DummyBasicMockRule\"/>\n" +
" </rule>\n" +
"</ruleset>\n");
RuleSetFactory ruleSetFactory = new RuleSetFactory();
RuleSet ruleset = ruleSetFactory.createRuleSet(ref1);
Assert.assertNull(ruleset.getRuleByName("DummyBasicMockRule"));
RuleSetReferenceId ref2 = createRuleSetReferenceId("<?xml version=\"1.0\"?>\n" +
"<ruleset name=\"Custom ruleset for tests\"\n" +
" xmlns=\"http://pmd.sourceforge.net/ruleset/2.0.0\"\n" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
" xsi:schemaLocation=\"http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd\">\n" +
" <description>Custom ruleset for tests</description>\n" +
" <rule ref=\"rulesets/dummy/basic.xml\">\n" +
" <exclude name=\"DummyBasicMockRule\"/>\n" +
" </rule>\n" +
" <rule ref=\"rulesets/dummy/basic.xml\"/>\n" +
"</ruleset>\n");
RuleSetFactory ruleSetFactory2 = new RuleSetFactory();
RuleSet ruleset2 = ruleSetFactory2.createRuleSet(ref2);
Assert.assertNotNull(ruleset2.getRuleByName("DummyBasicMockRule"));
RuleSetReferenceId ref3 = createRuleSetReferenceId("<?xml version=\"1.0\"?>\n" +
"<ruleset name=\"Custom ruleset for tests\"\n" +
" xmlns=\"http://pmd.sourceforge.net/ruleset/2.0.0\"\n" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
" xsi:schemaLocation=\"http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd\">\n" +
" <description>Custom ruleset for tests</description>\n" +
" <rule ref=\"rulesets/dummy/basic.xml\"/>\n" +
" <rule ref=\"rulesets/dummy/basic.xml\">\n" +
" <exclude name=\"DummyBasicMockRule\"/>\n" +
" </rule>\n" +
"</ruleset>\n");
RuleSetFactory ruleSetFactory3 = new RuleSetFactory();
RuleSet ruleset3 = ruleSetFactory3.createRuleSet(ref3);
Assert.assertNotNull(ruleset3.getRuleByName("DummyBasicMockRule"));
}
private static final String REF_OVERRIDE_ORIGINAL_NAME = "<?xml version=\"1.0\"?>"
+ PMD.EOL
+ "<ruleset name=\"test\">"
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>5.5.1</version>
<version>5.5.2</version>
</parent>
<properties>
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>5.5.1</version>
<version>5.5.2</version>
</parent>
<properties>
+6 -1
View File
@@ -8,7 +8,7 @@
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>5.5.1</version>
<version>5.5.2</version>
</parent>
<properties>
@@ -83,6 +83,11 @@
<artifactId>pmd-go</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-groovy</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>5.5.1</version>
<version>5.5.2</version>
</parent>
<properties>
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>5.5.1</version>
<version>5.5.2</version>
</parent>
<properties>
+53
View File
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>pmd-groovy</artifactId>
<name>PMD Grooovy</name>
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>5.5.2</version>
</parent>
<properties>
<config.basedir>${basedir}/../pmd-core</config.basedir>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<useDefaultDelimiters>false</useDefaultDelimiters>
<delimiters>
<delimiter>${*}</delimiter>
</delimiters>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,17 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
/**
* Language implementation for Groovy
*/
public class GroovyLanguage extends AbstractLanguage {
/**
* Creates a new Groovy Language instance.
*/
public GroovyLanguage() {
super("Groovy", "groovy", new GroovyTokenizer(), ".groovy");
}
}
Loaded 30 of 129 files, more files were not shown because too many files have changed in this diff. Show more