Compare commits

...
Author SHA1 Message Date
Andreas Dangel e1cc5d44b5 Prepare release pmd-eclipse-plugin 4.0.2.v20131031-1124 2013-10-31 12:35:23 +01:00
Andreas Dangel 490adf7276 pmd-eclipse: update release procedure 2013-10-31 12:30:13 +01:00
Andreas Dangel 283da27ffe pmd-eclipse: fix #1148 After changing exclude filters violations are not cleared 2013-10-31 12:08:27 +01:00
Andreas Dangel dadf519728 pmd-eclipse: add i18n for the new checkbox 2013-10-30 21:02:51 +01:00
Andreas Dangel 5e6d85ed5c pmd-eclipse: store the global rule management setting 2013-10-30 21:01:26 +01:00
Andreas Dangel e95c1f8460 pmd-eclipse: add checkbox to enable/disable global rule management 2013-10-29 22:27:33 +01:00
Andreas Dangel 71d7b5b7c8 cpd: fix #1144 CPD encoding argument has no effect
Thanks to Peter Bruin
2013-10-29 20:12:01 +01:00
Andreas Dangel 181e130b63 pmd-eclipse: fix rule selection in preferences dialog 2013-10-27 19:04:06 +01:00
Andreas Dangel 963e334cd7 website: use sections 2013-10-26 20:31:27 +02:00
Andreas Dangel d6fc01aad3 website: use foundation for pmd's main website 2013-10-26 19:05:34 +02:00
Andreas Dangel a0dbc1e6df pmd: fix #1123 failure in help examples 2013-10-19 21:13:49 +02:00
Andreas Dangel b9336cb674 pmd: update changelog with new rule PositionLiteralsFirstInCaseInsensitiveComparisons 2013-10-18 19:31:51 +02:00
Andreas Dangel 60de79ab6f Merge branch 'master' of https://github.com/larrydiamond/pmd 2013-10-18 19:27:16 +02:00
Larry Diamond 6627815c27 second shot at adding all this stuff 2013-10-17 15:38:25 -04:00
Larry Diamond a9bfdc1f15 second shot at adding all this stuff 2013-10-17 15:38:13 -04:00
Larry Diamond 7c84050b56 first shot at adding all this stuff 2013-10-17 15:27:19 -04:00
Larry Diamond c6d0a4238a first shot at adding all this stuff 2013-10-17 15:27:14 -04:00
Larry Diamond 0416a8a934 first shot at adding all this stuff 2013-10-17 15:27:03 -04:00
Larry Diamond 3c7d5fe0ce first shot at adding all this stuff 2013-10-17 15:26:52 -04:00
Andreas Dangel 9ae5c754bc pmd: ecmascript ASTTryStatement - deprecated isFinally() and isCatch()
Updated AttributeAxisIterator to ignore deprecated properties.
2013-10-17 20:39:20 +02:00
Andreas Dangel 858308aa8f pmd: fix #1140 public EcmascriptNode getBody(int index) 2013-10-17 20:37:13 +02:00
Larry Diamond 6d5160a857 add PositionLiteralsFirstInCaseInsensitiveComparisons rule
most of this rule is the same as PositionLiteralsFirstInComparisons
2013-10-17 13:38:06 -04:00
Andreas Dangel 32bf09ffd7 pmd: fix #1135 CheckResultSet ignores results set declared outside of try/catch 2013-10-16 20:43:26 +02:00
Andreas Dangel 64ca9b6f01 pmd: fix #1141 ECMAScript: getFinallyBlock() is buggy.
fix #1142 ECMAScript: getCatchClause() is buggy.
2013-10-15 23:20:32 +02:00
Andreas Dangel c1907339b3 pmd-eclipse: fix #1132 plugin does not execute custom xpath rules
Actually changing the behaviour of the global rule preferences,
so that all built-in rules of PMD are active by default and
all "unknown" (aka. custom) rules are active by default, too.
The filtering is therefore adjusted to filter out any inactive
rules rather then retaining the active ones.
2013-10-14 22:01:23 +02:00
Andreas Dangel 2da0cb94f9 pmd: fix #1131 CloseResource should complain if code betwen declaration of resource and try 2013-10-13 19:16:02 +02:00
Andreas Dangel 475e49f68a pmd: verify #1127 False positive: Constructor Calls Overridable Method 2013-10-12 18:42:45 +02:00
Andreas Dangel 74e8e41d15 pmd: fix #1121 NullPointerException when invoking XPathCLI 2013-10-11 19:31:03 +02:00
Andreas Dangel 64e35caa50 pmd: fix #1136 ECAMScript: NullPointerException in getLeft() and getRight() 2013-10-10 11:44:41 +02:00
Andreas Dangel b329e32fcc pmd: fix #1106 PMD 5.0.4 fails with NPE on parsing java enum with inner class instance creation 2013-10-09 23:33:39 +02:00
Andreas Dangel 7fe7695da1 pmd: update changelog for #1130 and correct test case 2013-10-09 22:32:27 +02:00
Andreas Dangel 499520ae9c Merge branch 'master' of https://github.com/albfernandez/pmd 2013-10-09 22:09:08 +02:00
Andreas Dangel a1a736c325 pmd: update changelog for #1134 2013-10-09 22:01:35 +02:00
Andreas Dangel 62e3bcdbad Merge branch 'UseStringBufferLengthEqualsEmptyStringFix' of https://github.com/acanda/pmd 2013-10-09 22:00:33 +02:00
Andreas Dangel 49ee265855 pmd: add test case for #881 2013-10-09 21:49:03 +02:00
Andreas Dangel b90e87b548 Merge branch 'master' of https://github.com/awhitford/pmd into awhitford-master 2013-10-09 21:40:34 +02:00
Andreas Dangel ed60fde269 pmd-cpd: applied patch #272, thanks to Delmas. This adds the "--exclude"
option similar to "--files".
2013-09-29 16:03:10 +02:00
Andreas Dangel 4ad6ecd8d2 pmd-emacs: simplify execution of pmd using wildcard class path
* update default rule names
* update default location of pmd to be ~/pmd
* use compilation-start instead of deprecated compile-internal
2013-09-29 15:12:21 +02:00
Ernst Reissner 0b29963d8c pmd-emacs: update pmd.el to work with PMD 5.0.2 and 5.0.5 2013-09-29 15:12:21 +02:00
alberto a24cbf034b Recognize custom close method #1130 2013-09-21 17:53:06 +02:00
Philip Graf 46620058e2 pmd: fix #1134 UseStringBufferLength false positives 2013-09-19 23:33:17 +02:00
Torsten Kleiber 61aa42f2d1 pmd-jdeveloper: eliminate files from bundle classpath 2013-09-03 21:50:20 +02:00
Torsten Kleiber 28bac21b4f pmd-jdeveloper: update JDeveloper documentation for the website 2013-09-03 20:32:21 +02:00
Torsten Kleiber 9b7d234cae pmd-jdeveloper: eleminate warnings in the extension 2013-09-03 20:31:22 +02:00
Torsten Kleiber 91c0502178 pmd-jdeveloper: Add missing files 2013-09-03 20:18:01 +02:00
Anthony Whitford 16bf1c5c99 Bug 881 - Skipping the setter check for final fields for the BeanMembersShouldSerialize rule. 2013-09-02 11:15:26 -07:00
Torsten Kleiber 2cce739814 Updated PMD version to 5.0.5 for JDeveloper 11.1.1 to 11.1.2 2013-08-29 15:50:53 +02:00
Andreas Dangel e0f664e9f4 pmd: update release procedure to fix #1119 PMD jar missing in pmd-bin-5.0.5.zip 2013-08-12 20:31:09 +02:00
Andreas Dangel 6e55c514ee pmd-eclipse: update release notes and mention release notes in release procedure 2013-08-11 13:27:37 +02:00
Andreas Dangel 617813a6ae pmd-eclipse: fix release notes 2013-08-11 13:21:39 +02:00
Andreas Dangel ba401c1761 pmd-eclipse: Prepare next pmd-eclipse-plugin development version 4.0.2-SNAPSHOT 2013-08-11 13:01:58 +02:00
Andreas Dangel 61dffa5f01 pmd-eclipse: update release procedure 2013-08-11 12:58:46 +02:00
Andreas Dangel 0babfc13ff pmd-eclipse: update to use pmd 5.0.5 2013-08-11 12:55:00 +02:00
Andreas Dangel d0ad6ae6ce pmd: update the release process 2013-08-11 12:49:16 +02:00
Andreas Dangel a7f842c92e pmd: Prepare pmd release 5.0.5 2013-08-11 12:29:13 +02:00
Andreas Dangel 4ccb814cf1 pmd-eclipse: fix #988 Build path exclusions not honored 2013-08-11 00:17:31 +02:00
Andreas Dangel 90590dce93 pmd-eclipse: fix #1070 Properties page: "Rule-Selection" should be disabled if project-local config is selected 2013-08-10 22:59:50 +02:00
Andreas Dangel 99a0c59b98 pmd: fix #1095 AvoidFinalLocalVariable false positive 2013-08-10 21:19:29 +02:00
Andreas Dangel acc799e79d pmd-eclipse: fix #1079 Exclude pattern does not work 2013-08-10 18:36:15 +02:00
Andreas Dangel 97ace24df0 pmd-eclipse: update documentation for reporting bugs. 2013-08-10 18:22:41 +02:00
Andreas Dangel ead58c6f49 pmd-eclipse: fix #1061 PMD Eclipse: How to ... documentation missing
Basically extracted doc.zip and made it available in the eclipse help system.
2013-08-10 18:08:49 +02:00
Andreas Dangel 3677ce0235 pmd-eclipse: add back the PMD icon in eclipse about dialog.
Update feature's about text.
2013-08-10 17:26:47 +02:00
Andreas Dangel 4194855e8c pmd-eclipse: another update site link 2013-08-10 15:24:30 +02:00
Andreas Dangel 4f627b9d43 pmd-eclipse: upgrade tycho to 0.18.1 2013-08-10 15:15:56 +02:00
Andreas Dangel b33075a280 pmd-eclipse: fix #1112 Eclipse log file will not be filled 2013-08-10 15:02:01 +02:00
Andreas Dangel e0cf43a60d pmd-eclipse: active default rules and renderer for a fresh workspace
The rules, that are active by default are the ones from
java-basic, java-imports and java-unusedcode.
The active renderer by default is text.
2013-08-10 15:00:26 +02:00
Andreas Dangel ebe526ca10 pmd-eclipse: fix #1052 right click to add reviewed comment missing 2013-08-10 13:54:52 +02:00
Andreas Dangel 2a3c0a648a pmd-eclipse: discover the language of the file to process to avoid parse exception, if it happens to be not a java file. 2013-08-10 12:24:20 +02:00
Andreas Dangel 2107bef4ee pmd-eclipse: better fix for #1071 Violations are reported multiple times
The markers for a file are now cleared always before new markers are created/added to the file.
2013-08-10 11:13:24 +02:00
Andreas Dangel e1e03f8645 pmd-eclipse: fix #1096 SWTError: No more handles on Violation Outline View
Actually caching the shape images created by ShapePainter instead
of creating always new ones.
2013-08-09 20:16:27 +02:00
Andreas Dangel dd0d435511 pmd (site): execute move-index-and-delete-generated-xdocs ealier, at pre-site.
This is to make jenkin's site archive working.
2013-08-07 21:38:25 +02:00
Andreas Dangel 46f3110bcc pmd-eclipse: update site location 2013-08-07 19:20:14 +02:00
Andreas Dangel e25162b8d5 pmd: fix #1069 Eclipse plugin does not accept project-local config
This is about the RuleSetReferenceId and how we resolve such a
id to a real ruleset.
It is mostly backwards compatible.
2013-08-07 19:20:06 +02:00
Andreas Dangel 9215e37ff4 pmd: fix #1114 CPD - Tokenizer not initialized with requested properties
There was a similar problem with CPD GUI.
Also resetting the properties, so that unchecking the checkboxes has actually an effect.
2013-08-05 08:42:44 +02:00
Andreas Dangel 6bba7d3546 pmd: fix #1091 file extension for fortran seems to be wrong in cpdgui tools 2013-08-03 22:12:19 +02:00
Andreas Dangel e8887e828a pmd: fix #1102 False positive: shift operator parenthesis 2013-08-03 22:05:23 +02:00
Andreas Dangel 78c32afade pmd: fix #1099 UseArraysAsList false positives 2013-08-03 22:00:23 +02:00
Andreas Dangel 8a32b8e8c4 pmd: fixed #1107 PMD 5.0.4 couldn't parse call of parent outer java class method from inner class 2013-08-03 21:38:16 +02:00
Andreas Dangel 2ad3e5152b pmd: fix for comment required rule - class cast exception 2013-08-03 21:30:38 +02:00
Andreas Dangel 1dc6b18fae pmd-eclipse: fix #1071 Violations are reported multiple times 2013-08-03 19:43:55 +02:00
Andreas Dangel 1110318832 pmd: fix #1092 Wrong Attribute "excludemarker" in Ant Task Documentation 2013-08-03 18:57:09 +02:00
Andreas Dangel dc100d00bc pmd: fix #1084 NPE at UselessStringValueOfRule.java:36 2013-08-03 18:50:33 +02:00
Andreas Dangel e47d7cd1c8 Merge pull request #21
Merge branch 'master' of https://github.com/michalborek/pmd into michalborek-master
2013-08-03 18:42:57 +02:00
Andreas Dangel 69348714e4 pmd: fix #1104 IdempotentOperation false positive 2013-08-03 17:53:14 +02:00
Andreas Dangel 390c3778cf pmd: verify #1108 False +: Regression on bug 884 (DCL) 2013-08-03 17:40:34 +02:00
Andreas Dangel 2e5d6c214f pmd: applied #1109 Patch to build with Javacc 5.0 2013-08-03 17:19:53 +02:00
Andreas Dangel bcf567e3b3 pmd: fix #1111 False positive: Useless parentheses 2013-08-03 17:13:38 +02:00
Andreas Dangel ed8497a82d pmd-eclipse: fix #1117 An internal error occurred during: "RenderReport" 2013-08-03 16:45:42 +02:00
Andreas Dangel 98e27294f0 pmd: fix #1115 commentRequiredRule in pmd 5.1 is not working properly 2013-08-03 15:47:38 +02:00
Andreas Dangel 9255e26c70 pmd: fix #1118 ClassCastException in pmd.lang.ecmascript.ast.ASTElementGet 2013-08-03 14:17:11 +02:00
Andreas Dangel 66e8cfc622 pmd: #991 is for 5.0.5 2013-08-03 13:05:57 +02:00
Andreas Dangel a1edabfca3 pmd: fix #1114 CPD - Tokenizer not initialized with requested properties 2013-08-03 12:15:10 +02:00
Andreas Dangel 69c41f451a maven-plugin-pmd-build: fix maven warning about parent path 2013-08-01 21:56:19 +02:00
Andreas Dangel 4f02afb30e pmd: more clover 2013-08-01 21:21:33 +02:00
Andreas Dangel 890dfac22f pmd: correct checkstyle report 2013-08-01 20:31:25 +02:00
Andreas Dangel 9a1829cf1d pmd: remove maven warning about parent pom path 2013-08-01 20:28:45 +02:00
Andreas Dangel fe7ace9507 pmd: take clover into account 2013-08-01 20:28:27 +02:00
U-Michal-Komputer\Michal ffc5b6f2a8 Fixed problem #1110 Selecting non-duplicates during import doesn't work. 2013-07-30 22:40:54 +02:00
Andreas Dangel cdf3d2a9cb pmd: update changelog etc. with new rule ConsecutiveAppendsShouldReuse 2013-07-30 21:00:52 +02:00
Andreas Dangel ff21265893 Merge branch 'master' of https://github.com/jbaris/pmd into jbaris-master
Merges pull request #2.
2013-07-30 20:52:13 +02:00
Andreas Dangel 83bb14e28e pmd-eclipse: update documentation about the "official" update site 2013-07-23 21:37:04 +02:00
Andreas Dangel 1df96cb2e7 pmd-eclipse: fix #1116 PMD Eclipse plugin doesn't analyze project if it has non-existing source folders 2013-07-23 21:36:58 +02:00
Juan Ignacio Barisich 3cb34969eb ConsecutiveAppendsShouldReuse rule 2013-07-19 12:05:24 -03:00
Juan Ignacio Barisich bef2183dc7 ConsecutiveAppendsShouldReuse rule 2013-07-19 12:02:37 -03:00
Andreas Dangel 989672f8fb pmd: update changelog for new rule AvoidProtectedMethodInFinalClassNotExtending 2013-06-22 17:25:14 +02:00
Andreas Dangel 090f2af516 Merge pull request #19
Merge branch 'master' of https://github.com/frizbog/pmd into frizbog-master
2013-06-22 17:12:32 +02:00
Andreas Dangel 559d72a9fe cpd: update changelog and site for new command line option 2013-06-22 17:11:41 +02:00
Pelisse Romain 97762a57ba Merge pull request #20 from farmaazon/master
Possibility of non-scanning subdirectories in CPD command line interface
2013-05-22 15:27:46 -07:00
Adam Obuchowicz d176e8b51c pmd/cpd: Added non-recursive option 2013-05-21 14:01:28 +02:00
Matt Harrah (frizbog) 44e7bb6354 New rule: AvoidProtectedMethodsInFinalClassNotExtending 2013-05-17 10:21:37 -04:00
Andreas Dangel 95e0c7bca2 pmd-eclipse: update release howto, remove jgit timestamp provider
* the jgit timestamp provider wasn't of much help: For releases
we set the version manually anyway. While developing it's confusing
if you forget to commit locally first and build right away.
2013-05-10 10:59:06 +02:00
Andreas Dangel 914a1a771e pmd-eclipse: Prepare next pmd-eclipse-plugin development version 4.0.1-SNAPSHOT 2013-05-10 10:02:03 +02:00
Andreas Dangel 73aa908c69 pmd-eclipse: add release notes 2013-05-10 09:56:41 +02:00
Andreas Dangel a3550d17ec pmd-eclipse: update copyright years 2013-05-09 20:13:17 +02:00
Andreas Dangel 7f08a8f7c4 pmd-eclipse: add about section in preferences to display the plugin's version and the used PMD version. 2013-05-09 20:03:06 +02:00
Andreas Dangel dcd2ac2166 pmd-eclipse: upgrade to pmd 5.0.4 2013-05-09 18:17:39 +02:00
Hooperbloob 45d6a710bc Merge pull request #18 from adangel/eclipse-tycho
Use Maven Tycho to build pmd-eclipse-plugin
2013-05-04 17:47:34 -07:00
Andreas Dangel 3cc3c6993b Update readme 2013-05-01 14:56:22 +02:00
Andreas Dangel 3b49640920 pmd: added missing 5.0.3 release links to the website 2013-05-01 14:11:40 +02:00
Andreas Dangel ae5ae2646e pmd: Prepare pmd release 5.0.4 2013-05-01 11:58:01 +02:00
Andreas Dangel 850d7bfd00 pmd: fix #1089 When changing priority in a custom ruleset, violations reported twice 2013-05-01 11:32:39 +02:00
Andreas Dangel 25777937c2 pmd: fix #794 False positive on PreserveStackTrace with anonymous inner 2013-04-28 10:13:21 +02:00
Andreas Dangel 2a161c533c pmd: fix #1063 False+: ArrayIsStoredDirectly 2013-04-28 10:13:16 +02:00
Andreas Dangel 2aad65138a pmd: let failing rules fail the unit tests again
so that we can early detect any introduced exceptions (like NPE).
2013-04-27 10:03:10 +02:00
Andreas Dangel 66fed8d9cc pmd: fix #1085 NullPointerException by at net.sourceforge.pmd.lang.java.rule.design.GodClassRule.visit(GodClassRule.java:313) 2013-04-25 19:11:01 +02:00
Andreas Dangel e1b8334e5e pmd: fix #1087 PreserveStackTrace (still) ignores initCause()
one more test, extended documentation example
2013-04-25 18:35:06 +02:00
Andreas Dangel 8cf1cc4113 pmd: fix #1087 PreserveStackTrace (still) ignores initCause() 2013-04-24 21:29:18 +02:00
Andreas Dangel 29b294e2b1 pmd: fix #1086 Unsupported Element and Attribute in Ant Task Example 2013-04-22 20:23:13 +02:00
Andreas Dangel c66c01e0ce pmd-eclipse: add missing export for net.sourceforge.pmd.lang.rule, needed by m2e-code-quality 2013-04-21 19:45:10 +02:00
Andreas Dangel 8d3ed164fb pmd-eclipse: Use last stable PMD version 5.0.3. 2013-04-21 16:31:09 +02:00
Andreas Dangel 7e8f558263 pmd-eclipse: Document build and release process for the pmd-eclipse-plugin 2013-04-21 16:31:08 +02:00
Andreas Dangel 4c9e714380 pmd-eclipse: Prepare release and publish of the eclipse update site. 2013-04-21 16:31:08 +02:00
Andreas Dangel 75503ffa40 pmd-eclipse: Renaming the source folders to use default locations for src and target. 2013-04-21 16:31:08 +02:00
Andreas Dangel 02a723391d pmd-eclipse: Renaming the folders and submodules according to their artifact id. 2013-04-21 16:31:07 +02:00
Andreas Dangel 25c47c651c pmd-eclipse: Delete obsolete build files. 2013-04-21 16:31:06 +02:00
Andreas Dangel 36b0d87186 pmd-eclipse: Update tests and disable the tests that need an OSGI context.
tycho-surefire is completely disabled now and only the simple junit tests
are enabled.
2013-04-21 16:31:06 +02:00
Andreas Dangel 396509e75a pmd-eclipse: Added dependency plugin to fetch required dependencies for pmd.
Removed the jar files from the repo.
2013-04-21 16:31:06 +02:00
Andreas Dangel 3443fe549b pmd-eclipse: Added tycho configuration and delete eclipse project files 2013-04-21 16:30:59 +02:00
Andreas Dangel 144a4e152d pmd: fix #254 False+ : UnusedImport with Javadoc @throws 2013-04-15 21:33:49 +02:00
Andreas Dangel 60aa0b1778 pmd: correct documentation for pmd's ant task to select the language
and adding more unit tests.
2013-04-15 21:00:14 +02:00
Andreas Dangel 37a4144bc6 Updated website with new project description. Added "Fork me on github" ribbon. 2013-04-14 18:31:41 +02:00
Andreas Dangel 030eb40e01 pmd: fix #1080 net.sourceforge.pmd.cpd.CPDTest test failing
The symlinks are simply removed now from the source code and
created by the test, when needed.
The test runs only under unix systems, not under windows.
2013-04-14 17:26:50 +02:00
Andreas Dangel 4be223bde4 pmd: adding more entries to gitignore and to exclude while creating the source zip file. 2013-04-14 17:01:56 +02:00
Andreas Dangel bd5ec60a9f pmd: fix #1082 CPD performance issue on larger projects 2013-04-14 13:33:00 +02:00
Andreas Dangel cfa21c106c pmd: fix #1081 Regression: CPD skipping all files when using relative paths 2013-04-12 23:02:40 +02:00
Andreas Dangel 0d9d09b9dd pmd: improve release documentation 2013-04-05 20:45:41 +02:00
Andreas Dangel 159d9523db pmd: correct the command line examples 2013-04-05 19:19:30 +02:00
Andreas Dangel 503b41e40f pmd: prepare pmd release 5.0.3 2013-04-05 18:48:02 +02:00
Andreas Dangel 0dc8d20800 pmd: use the released pmd-build plugin 0.8 2013-04-05 18:26:17 +02:00
Andreas Dangel f9484aa2d2 [maven-release-plugin] prepare for next development iteration 2013-04-05 18:17:20 +02:00
Andreas Dangel 0631ef98fd [maven-release-plugin] prepare release pmd-build/0.8 2013-04-05 18:17:20 +02:00
Andreas Dangel 524fd6fe43 pmd: fix NPE in LooseCouplingRule 2013-04-05 17:36:12 +02:00
Andreas Dangel 075f0181d6 pmd: fix #1078 Package statement introduces false positive UnnecessaryFullyQualifiedName violation 2013-04-05 17:11:30 +02:00
Andreas Dangel 51aca91330 pmd-eclipse: Fix compile errors after updating to latest PMD 5.1.0-SNAPSHOT. 2013-04-01 10:51:56 +02:00
Andreas Dangel 02dbbe2673 pmd-eclipse: new PMD snapshot jar 2013-03-31 18:51:18 +02:00
Andreas Dangel c91981ec65 pmd-eclipse - eclipse project configuration 2013-03-31 15:08:47 +02:00
Andreas Dangel 039d65fcc2 Merge branch 'master' of https://github.com/twh270/pmd 2013-03-31 14:24:58 +02:00
Andreas Dangel 2ab7b9e698 pmd-eclipse: update version numbers 2013-03-31 14:21:28 +02:00
Andreas Dangel 6fb192e584 Merge branch 'master' of https://github.com/hooperbloob/pmd into hooperbloob-master 2013-03-31 09:48:34 +02:00
Andreas Dangel 56339a6c58 Merge pull request #16 from acanda/ASTFormalParameterVariableName 2013-03-30 19:09:13 +01:00
Andreas Dangel 5f70b65afa Merge pull request #17 from acanda/IterableReportTree 2013-03-30 18:46:18 +01:00
Andreas Dangel e1c327d76f pmd: fix version numbers for new logging rules. 2013-03-30 18:33:31 +01:00
Andreas Dangel 57e331f90e pmd: add tests for CommentRequiredRule. 2013-03-30 18:33:12 +01:00
Andreas Dangel 29c178037a Merge pull request #14 from snajberk/master 2013-03-30 17:16:10 +01:00
Andreas Dangel 1907c6d9e8 pmd: fix #1077 Missing JavaDocs for Xref-Test Files 2013-03-30 15:44:44 +01:00
Andreas Dangel 7c440fd42e pmd: verify #937 OptimizableToArrayCall does not catch multilevel method chains 2013-03-30 15:25:03 +01:00
Andreas Dangel f0d8759b79 pmd: fix #938 False positive on LooseCoupling for overriding methods 2013-03-30 15:04:47 +01:00
Andreas Dangel 5d1d82919c pmd: verify #939 Jsp parser fails on $ 2013-03-30 14:27:32 +01:00
Andreas Dangel ca10969400 pmd: fix #940 False positive on UnsynchronizedStaticDateFormatter 2013-03-30 14:10:11 +01:00
Andreas Dangel 9b7562cd23 pmd: fix #942 CheckResultSet False Positive
* replacing the xpath rule with a java based rule implementation
2013-03-30 13:58:12 +01:00
Andreas Dangel be4c1adce6 pmd: fix #943 PreserveStackTrace false positive if a StringBuffer exists 2013-03-30 11:50:57 +01:00
Andreas Dangel 89e005fe49 pmd: fix #945 PMD generates RuleSets it cannot read. 2013-03-30 11:50:45 +01:00
Andreas Dangel b034dfb2d8 pmd: fix #958 Intermittent NullPointerException while loading XPath node attributes
* synchronizing the method cache
 * adding additional null check
2013-03-30 09:25:04 +01:00
Andreas Dangel 0e44680981 formatting, white spaces 2013-03-30 09:06:18 +01:00
Andreas Dangel c345f82968 pmd: verify #959 StringToString False Positive 2013-03-30 08:59:12 +01:00
Philip Graf 41705f17da Make Report implement Iterable<RuleViolation>
With this change we can easily iterate over a Report using the
for-each loop of Java 5 instead of using Report.iterator().
Also the @Override annotation has been added to Report.iterator() and
ReportTree.iterator() as PMD switched to Java 6.
2013-03-30 01:28:31 +01:00
Andreas Dangel 90d901c4bf pmd: verify #998 False positive ClassCastExceptionWithToArray with generics 2013-03-29 16:02:05 +01:00
Thomas Wheeler 61decdc6cb Merge remote-tracking branch 'pmd-branch/master' into merge-pmd-branch 2013-03-27 10:11:58 -05:00
Andreas Dangel abf8f3297b pmd: update changelog, verify #1076 2013-03-24 20:33:54 +01:00
Andreas Dangel 470c6b9c38 Merge branch 'ViolationNodeEqualsNode' of https://github.com/acanda/pmd into acanda-ViolationNodeEqualsNode 2013-03-24 20:09:46 +01:00
Andreas Dangel d9aefc7949 pmd: update changelog 2013-03-24 20:05:56 +01:00
Philip Graf f5a5b6cd48 pmd: fix #1076 Report.treeIterator() does not return all violations
The cause of the bug was the implementation of
ViolationNode.equalsNode(otherNode) which returned true when two
different violations start on the same line.

Note: this change also adds a maven dependency on Mockito 1.9.5 (scope:
test). Mockito helps creating mock objects and makes the test more
readable.
2013-03-24 17:53:40 +01:00
Philip Graf 46a57aa3ab Make ReportTree implement Iterable<RuleViolation>
With this change we can easily iterate over a ReportTree using the
for-each loop of Java 5 instead of using ReportTree.iterator().
2013-03-24 11:48:39 +01:00
Philip Graf 8dc8607102 Set variableName for a java violation with an ASTFormalParameter node
Extends JavaRuleViolation to also set the member "variableName" when the
provided node is of type ASTFormalParameter.
2013-03-24 11:48:27 +01:00
Pelisse Romain 36c8a31cd2 Merge pull request #14 from codecop/NPEx-JSP-Master
Nice catch ! Thanks for the fix !!!
2013-03-23 07:52:04 -07:00
Peter Kofler 59e7c2dd0c fix Nullpointer Exception when using -l jsp 2013-03-23 15:42:02 +01:00
Andreas Dangel d24a2651cb pmd: fix #1027 PMD Ant: java.lang.ClassCastException 2013-03-17 11:59:00 +01:00
Andreas Dangel 2f53a3e795 pmd: fix #999 Law of Demeter: False positives and negatives 2013-03-17 11:03:02 +01:00
Andreas Dangel c8bf5d46a8 pmd: fix #975 false positive in ClassCastExceptionWithToArray 2013-03-17 10:11:02 +01:00
Andreas Dangel d7bdb79cdd pmd: fix #968 Issues with JUnit4 @Test annotation with expected exception
Thanks to Yiannis Paschalidis
2013-03-17 09:56:02 +01:00
Andreas Dangel 7947282704 pmd: verify #962 MethodReturnsInternalArray: False positive using a ternary operator 2013-03-16 22:09:36 +01:00
Andreas Dangel 4388806404 pmd: fix #976 UselessStringValueOf wrong when appending character arrays 2013-03-16 19:51:06 +01:00
Andreas Dangel 8ea9d29f31 pmd: fix #977 MisplacedNullCheck makes false positives 2013-03-16 19:17:48 +01:00
Andreas Dangel 72d07a8e7e pmd: fix #985 Suppressed methods shouldn't affect avg CyclomaticComplexity 2013-03-16 18:09:25 +01:00
Andreas Dangel c3e148174c pmd: fix #984 Cyclomatic complexity should treat constructors like methods 2013-03-16 17:15:40 +01:00
Andreas Dangel 22a2db080f pmd (site): add links to the rules from the rule index page 2013-03-16 15:22:31 +01:00
Andreas Dangel 0125e7a03b pmd (site): add missing default values of properties for documentation 2013-03-16 13:58:32 +01:00
Andreas Dangel 370ed23e01 pmd: fix #991 AvoidSynchronizedAtMethodLevel for static methods 2013-03-16 12:22:10 +01:00
Andreas Dangel dcaf06303c pmd: fix #997 Rule NonThreadSafeSingleton gives analysis problem 2013-03-16 12:05:05 +01:00
Andreas Dangel 54cab5de42 pmd: fix #992 Class java.beans.Statement triggered in CloseResource rule 2013-03-16 11:40:15 +01:00
Andreas Dangel bb083a7685 pmd: fix NPE in ConstructorCallsOverridableMethodRule 2013-03-15 21:54:02 +01:00
Andreas Dangel ea06bd063f pmd: switch to java 1.6
we already depend on it, e.g. jcommander requires a java 1.6 JRE
2013-03-15 21:49:28 +01:00
Andreas Dangel 7ae1e9c6dc pmd: fix #1032 ImmutableField Rule: Private field in inner class gives false positive
Improved symbol table resolution to check inner classes, too.
2013-03-15 21:37:02 +01:00
Andreas Dangel 2c5b6e1fdb pmd: verify #254 False+ : UnusedImport with Javadoc @link 2013-03-14 21:47:06 +01:00
Andreas Dangel 0739c2f601 pmd: fix #1005 False + for ConstructorCallsOverridableMethod - overloaded methods
It won't be perfect, but for constructor calls and method calls a
simple check of the argument types is done. Primitive types are
distinguished, reference types not.
In order to support all cases, full symbol resolution is needed.
2013-03-14 20:48:05 +01:00
Andreas Dangel 3ce242c179 pmd: cleanup design test cases 2013-03-13 20:31:33 +01:00
Andreas Dangel 3bf8eb9d1f pmd: #1002 False +: FinalFieldCouldBeStatic on inner class 2013-03-13 20:02:22 +01:00
Andreas Dangel 511fd6fb58 pmd: fix #1073 Hard coded violation messages CommentSize 2013-03-10 09:48:11 +01:00
Andreas Dangel 4f1cfd6125 pmd: fix #1074 rule priority doesn't work on group definitions
and verify #1067 Custom Ruleset doesn't import the complete ruleset anymore by reference
2013-03-09 17:51:06 +01:00
Andreas Dangel 6426deca6b pmd: add versions maven plugin 2013-03-05 22:32:53 +01:00
Andreas Dangel 5b3405d93b pmd: fix changelog version info 2013-03-05 22:32:44 +01:00
Andreas Dangel 9623d61310 pmd: fixed #1064 Exception running PrematureDeclaration 2013-03-05 22:30:03 +01:00
Romain PELISSE d675790e58 Redesign GuardLogStatement:
Turns out that the implementation based on the one published by Heiko Rupp
could simply not catch all the case in our test suite. I therefore opted to
backport the previous implementation - a simple Xpath rule, from GuardDebugLogStmt
into a java class.
Performance are not as good as the one based on Heiko's proposal, but it still
twice faster as the simple GuardDebogLogStmt (instead of five times faster). However,
correctness is in this case more important.
2013-03-03 19:19:51 -05:00
Romain PELISSE bac738c01a GuardLogStatement: small docs fixes 2013-03-01 18:29:48 -07:00
Romain PELISSE 6576056eaf Merge changelog 2013-03-01 18:20:44 -07:00
Romain PELISSE 42d51ad423 Enhance GuardDebugLogging:
- replace xpath implementation by newly created GuardLogStatementRule
- increase performance by 5 (from 0.5s to 0.1s)
2013-03-01 18:19:31 -07:00
Romain PELISSE f2f31990aa Enhance GuardLogStatement:
- add property support to specify which statement needs to be checked
- move out of the java logging to be placed in logging-jakarta
2013-03-01 18:19:31 -07:00
Romain PELISSE 4bce034c33 Add GuardLogStatement
Based on Heiko Rupp implemetation: http://pilhuhn.blogspot.com/2008/09/pmd-rule-to-check-for-unguarded.html
2013-03-01 13:34:00 -07:00
Andreas Dangel 45d10aaa7c pmd: fixed #1068 CPD fails on broken symbolic links 2013-03-01 19:52:41 +01:00
Andreas Dangel d9f8e62d3c pmd: verify #1047 False Positive in 'for' loops for LocalVariableCouldBeFinal 2013-03-01 19:06:01 +01:00
Romain PELISSE a90e9fed0b Add new ecmascript rules to changelog 2013-02-28 16:34:48 -07:00
Romain PELISSE c36b3c47c9 ecmascript: UseBaseWithParseInt
Add a new rule called UseBaseWithParseInt in the basic
new ruleset, for EcmaScript.

Done while during the Java Posse Round up 2013 workshop:
'Make Javascript a better world with PMD'
2013-02-28 16:34:27 -07:00
Romain PELISSE 148a1016fb ecmascript: AvoidWithStatement
Add a new rule called AvoidWithStatement along with a
new ruleset, Controversial, for EcmaScript.

Done while during the Java Posse Round up 2013 workshop:
'Make Javascript a better world with PMD'
2013-02-28 16:18:41 -07:00
Jaroslav Snajberk 2a01a33f79 Missed bug #1048
I missed bug #1048 fix and used older version.
2013-02-15 11:43:05 +01:00
Jaroslav Snajberk b49ea5a923 CommentRequiredRule implementation
This is implementation of missing CommentRequiredRule. First it uses
AbstractCommentRule to pair comments with declarations, later it checks
presence of comments in these declarations.
2013-02-15 09:29:32 +01:00
Andreas Dangel 7712690d55 pmd: update release docu 2013-02-03 19:20:18 +01:00
Andreas Dangel 3438796471 pmd: update website for 5.0.2 2013-02-03 19:19:58 +01:00
Andreas Dangel 5e522fccd1 pmd: set release date for 5.0.2 2013-02-03 18:26:21 +01:00
Andreas Dangel c3f3adbd4c pmd: update changelog for 5.0.2/5.1.0 2013-02-03 15:30:20 +01:00
Andreas Dangel b0e6810b58 pmd: verify empty if statement example 2013-02-03 15:18:52 +01:00
Torsten Kleiber 0524752248 Fix for bug #1056 "Error while processing" while running on xml file with DOCTYPE reference
Change the initial value of XINCLUDE_AWARE_DESCRIPTOR to false
This does validate an invalid doctype reference as in some ide generated xml files exist.
Any xml rule, which needs this property should overwrite this value with true.
2013-01-31 21:52:13 +01:00
Romain PELISSE db05bcb8a7 pmd: AntTask support for language
- fix  #1004 targetjdk isn't attribute of PMD task
- introduce a new element, called <language>, that replaces the already existing <version/> element
2013-01-29 12:22:08 +01:00
Romain PELISSE 9954f1d8e1 pmd: fix typo in ReadMe.txt 2013-01-28 00:54:18 +01:00
Romain PELISSE b1cae214cd pmd: fix #1004 targetjdk isn't attribute of PMD task 2013-01-28 00:53:41 +01:00
Romain PELISSE 5ffb5bc8c2 Merge branch 'master' of github.com:pmd/pmd 2013-01-26 20:23:50 +01:00
Romain PELISSE 167c4da9ba pmd: fix #1049 Errors in "How to write a rule" 2013-01-26 20:23:36 +01:00
Andreas Dangel 302bfe41fd pmd: configure surefire to run tests in alphabetical order, so that test failure are better reproducible 2013-01-26 20:03:39 +01:00
Andreas Dangel 6e01b91a73 pmd: fix #1030 CPD Java.lang.IndexOutOfBoundsException: Index: 2013-01-26 20:01:14 +01:00
Andreas Dangel 3f10a9ecb8 pmd: verify #946 ImmutableField false + 2013-01-26 15:50:56 +01:00
Andreas Dangel c2a20a9337 pmd: fixed #947 CloseResource rule fails if field is marked with annotation 2013-01-26 15:43:46 +01:00
Andreas Dangel ddb5c23926 pmd: verify #956 PMD Parse Exception 2013-01-26 15:34:20 +01:00
Andreas Dangel 45e2caae20 pmd: verify #1029 No instance level check in the close resource rule 2013-01-26 15:27:55 +01:00
Andreas Dangel 49b8e206d0 pmd: fixed #1011 CloseResource Rule ignores Constructors 2013-01-26 15:25:05 +01:00
Andreas Dangel 0344555956 pmd: fixed #1007 Parse Exception with annotation 2013-01-26 14:28:29 +01:00
Andreas Dangel c5ed215332 pmd: fixed #1046 ant task CPDTask doesn't accept ecmascript 2013-01-26 12:08:41 +01:00
Andreas Dangel cbadb87c0a pmd: fixed #1039 pmd-nicerhtml.xsl is packaged in wrong location 2013-01-26 11:45:21 +01:00
Andreas Dangel ebe8e5a5b5 pmd website: add fallback redirect to pmd-4.3.0 2013-01-26 11:14:20 +01:00
Andreas Dangel 4c4adcfdb8 pmd: update rule-guidelines to changed package names 2013-01-26 10:38:58 +01:00
Andreas Dangel 106ef1b1c4 pmd: fixed #1028 False-positive: Compare objects with equals for Enums 2013-01-24 19:28:17 +01:00
Andreas Dangel bf087132f8 pmd: verify #1020 Parsing Error 2013-01-24 18:59:07 +01:00
Andreas Dangel 721f79268f pmd: fixed #913 SignatureDeclareThrowsException is raised twice 2013-01-23 21:44:32 +01:00
Andreas Dangel 08a04bd16b pmd: fixed #878 False positive: UnusedFormalParameter for abstract methods 2013-01-23 21:24:36 +01:00
Andreas Dangel 77a6802621 pmd: fixed #1055 Please add a colon in the ant output after line,column for Oracle JDeveloper IDE usage 2013-01-21 21:18:18 +01:00
Andreas Dangel 83cbf65bdb pmd: verify #1057 False positive for UnnecessaryWrapperObjectCreation 2013-01-21 20:40:46 +01:00
Andreas Dangel b4db0afedd pmd: verify #1058 False positive for VariableNamingConventions 2013-01-19 19:25:22 +01:00
Andreas Dangel 4b0449fcf3 pmd: fixed #1059 Change rule name "Use Singleton" should be "Use Utility class" 2013-01-19 19:10:34 +01:00
Andreas Dangel a5e0dc9c7b pmd: fixed bug #1012 False positive: Useless parentheses. 2013-01-19 18:49:19 +01:00
Andreas Dangel 10a38d44f4 pmd: fixed #1060 GodClassRule >>> wrong method 2013-01-19 18:28:33 +01:00
Andreas Dangel c40fe0b7fb Removed pmd-jedit. JEdit's PMD Plugin has moved into an own repository at jedit.sf.net.
See http://jedit.git.sourceforge.net/git/gitweb.cgi?p=jedit/PMDPlugin;a=summary
2013-01-13 19:31:07 +01:00
Andreas Dangel 85d301bb86 Revert "merge from master"
This reverts commit df199cd2a0.
2013-01-13 19:17:44 +01:00
Philip Graf 7fd86d9fdd pmd: fix ignored property minimumLength of rule AvoidDuplicateLiterals
The rule AvoidDuplicateLiterals ignores its property minimumLength
because it is set not until after the source code has been analyzed.
This change sets the property before the analysis.
2013-01-04 02:07:10 +01:00
Dale Anson 473f5605b0 Documentation and javadoc updates. 2013-01-01 12:19:21 -07:00
Dale Anson d56bd5b8a0 Added service for status bar to automatically install the progress bar. 2013-01-01 12:17:58 -07:00
Dale Anson 1977db4c0e Bumped version number to 5.0.1 to match PMD version, added dependency on rhino plugin so ecmascript processing works. 2013-01-01 12:16:49 -07:00
Dale Anson aae0561e7c Use jEdit service API for progress bar widget, better thread handling for updating progress bar. 2013-01-01 12:16:23 -07:00
Dale Anson df199cd2a0 merge from master 2012-12-26 16:54:39 -07:00
Dale Anson e4c29d2ab5 Option pane update, removed language selector since it's no longer necessary, added option to clear error list on save. 2012-12-26 16:45:20 -07:00
Dale Anson fd45371dbf Integration with PMD 5.1. 2012-12-26 16:20:26 -07:00
Andreas Dangel 28a663707c pmd: minor fixes for CPD CLI 2012-12-22 09:34:04 +01:00
Romain PELISSE a7e4a11963 Merge branch 'master' of github.com:pmd/pmd 2012-12-21 20:18:40 +01:00
Romain PELISSE 5dc9cbc324 pmd: rework CPD CLI to use jcommander 2012-12-21 20:17:47 +01:00
Romain PELISSE 6de8aa5e06 pmd: Add CPD AntTask tests 2012-12-21 20:17:47 +01:00
Romain PELISSE dd754cb808 pmd: AntTask Tests helper
As a workaround is needed to have the AntTask related to work in Maven
I've moved it into a separate abstract class that will be shared betweeen
the PMD AntTask tests and the upcoming CPD AntTask tests.
2012-12-21 20:15:29 +01:00
Romain PELISSE 5eb160de5b pmd: removed unused imports 2012-12-21 17:50:33 +01:00
Romain PELISSE 64ebd6e259 ReadMe: disable clover, build quick release 2012-12-21 16:18:36 +01:00
Dale Anson dbc74fd5ee Better handling for ErrorList, use an error source per view. 2012-12-17 14:17:33 -07:00
Andreas Dangel 9756526adb pmd: fix #1037 Facing a showstopper issue in PMD Report Class
* wrapping the report listeners in a thread safe (synchronized) class
 * overtaking the listeners for each thread / report
2012-12-17 10:51:19 +01:00
Andreas Dangel e34ac7dd8c pmd: fixed #1026 PMD doesn't handle 'value =' in SuppressWarnings annotation 2012-12-16 23:10:17 +01:00
Andreas Dangel ca4393fd18 pmd: verify bug #1018 - it's fixed already 2012-12-16 22:09:45 +01:00
Andreas Dangel aed0478411 pmd: refactor to use apache's commons-io instead of our own IOUtil. 2012-12-16 18:16:13 +01:00
Andreas Dangel f9826bcfc7 pmd: fix #1043 node.getEndLine() always returns 0 (ECMAscript)
* added commons-io dependency
 * added a SourceCodePositioner to calculate line/column from position
2012-12-16 18:15:34 +01:00
Andreas Dangel 48e6520912 pmd: fix #1047 False Positive in 'for' loops for LocalVariableCouldBeFinal in 5.0.1 2012-12-16 12:06:09 +01:00
Andreas Dangel 58c9deab49 pmd: update java grammer changelog 2012-12-16 11:57:44 +01:00
Andreas Dangel fe63763e4c pmd: add check for multiple exception catching in java 1.7 2012-12-14 21:42:39 +01:00
Andreas Dangel ee3ac17273 pmd site: switch to fluido skin 2012-12-14 19:58:46 +01:00
Andreas Dangel a50b084ce2 pmd: updated logo - thanks to Simon Gijsen 2012-12-14 16:41:22 +01:00
Andreas Dangel d47e68e370 pmd: Fixed bug 1048: CommentContent Rule, String Index out of range Exception 2012-12-07 10:49:39 +01:00
Andreas Dangel 7515448393 pmd: CLI - make sure we display the usage help text
Therefore make the -h option a help option.
Make the auxclasspath option description look nicer - newlines break the layout.
Always display the jcommander usage help text.
And exit with an error code in case there are parameter errors.
2012-12-05 21:58:39 +01:00
Andreas Dangel 835e696ec5 pmd: fix bug #1044 - update suppressing documentation with new cli paramter name 2012-12-05 21:51:05 +01:00
Andreas Dangel 53787b6336 pmd: prepare release 5.0.1 (cherry-picked)
commit a66bbf2193
2012-11-30 20:58:26 +01:00
Andreas Dangel d57e4cf1ec pmd website: update for new release 5.0.1 2012-11-29 19:21:53 +01:00
Romain PELISSE 5c5c6e6e46 site: add missing information on release 2012-11-28 22:42:13 +01:00
Romain PELISSE 5eae70ec3f doc: update release process to use new CLI syntax 2012-11-28 21:40:59 +01:00
Andreas Dangel 46f6cc1888 pmd: fix failing unit test 2012-11-28 21:28:05 +01:00
Pelisse Romain 9fcc0a5c5f Merge pull request #11 from rsalvador/PMDASTClassLoader
Reuse PMDASMClassLoader instance across all compilation units analyzed.
2012-11-28 11:17:09 -08:00
Andreas Dangel ec9725bbda pmd: update changelog, add contributor info 2012-11-28 20:10:35 +01:00
Andreas Dangel 9a83980ff8 Merge remote-tracking branch 'adangel/cpd-suppression' 2012-11-28 20:08:33 +01:00
Andreas Dangel c3bf059fa4 Merge remote-tracking branch 'adangel/cstokenizer' 2012-11-28 20:07:10 +01:00
Andreas Dangel 4ec958197c Merge branch 'master' 2012-11-28 20:05:25 +01:00
rsalvador 9e4858b8c2 Reuse PMDASMClassLoader instance across all compilation units analyzed. 2012-11-28 10:08:43 -08:00
Romain PELISSE 14ea3c509d Merge branch 'fault-tolerant' of https://github.com/rsalvador/pmd 2012-11-28 15:30:49 +01:00
Pelisse Romain 57162d0ecd Merge pull request #9 from rsalvador/auxclasspath
Add missing handling for -auxclasspath parameter.
2012-11-27 16:02:34 -08:00
rsalvador b172c19de7 Make PMD more fault-tolerant. 2012-11-27 13:17:15 -08:00
rsalvador 9366ca2cde Add missing handling for -auxclasspath parameter. 2012-11-27 13:03:03 -08:00
Andreas Dangel 6b82ce4c48 pmd: using the release pmd-build plugin 2012-11-24 18:28:48 +01:00
Andreas Dangel 6a8d7c3bcc [maven-release-plugin] prepare for next development iteration 2012-11-24 17:56:05 +01:00
Andreas Dangel b242118d74 [maven-release-plugin] prepare release pmd-build/0.7 2012-11-24 17:56:04 +01:00
Andreas Dangel d1dfc93eb4 pmd/cpd: adding documentation and switches for suppressing ability and new ignore_annotations switch. 2012-11-23 22:12:04 +01:00
Andreas Dangel b2f3c070f5 Merge pull request #6 into tacitknowledge-master 2012-11-22 21:30:50 +01:00
Andreas Dangel 62ec54b152 pmd: added unit test for CsTokenizer
* behaves similar like Java, e.g. ignoring semicolons and comments
2012-11-22 20:18:07 +01:00
Andreas Dangel c563d8c4ce Merge remote-tracking branch 'tiobe/master' into tiobe-master 2012-11-20 22:53:47 +01:00
Andreas Dangel b0c2721c22 pmd (build): ignore rule definitions without a name in our documentation
This basically adds the question, how to deal with deprecated rule definitions.
We should document this, maybe in an own section per ruleset.
2012-11-20 18:12:42 +01:00
Andreas Dangel bed009c779 pmd site: fix broken links 2012-11-19 22:46:34 +01:00
Andreas Dangel dd283b27a5 pmd: updating TODOs in changelog.txt
* test framework: This is done AFAIK - we have tests in different languages.
* RuleViolations without Nodes: Created bug to follow up: https://sourceforge.net/p/pmd/bugs/1040/
* XPath functions doc: Created bug to follow up: https://sourceforge.net/p/pmd/bugs/1041/
* RuleSetReferenceId: Created bug to follow up: https://sourceforge.net/p/pmd/bugs/1042/
2012-11-18 18:15:49 +01:00
Andreas Dangel 0262776074 pmd: re-enable PMDCoverageTest 2012-11-17 17:22:06 +01:00
Andreas Dangel 68cc44b374 add a basic README.md file for github 2012-11-17 17:00:27 +01:00
Andreas Dangel cc17820ec2 pmd: add a parent pom file to help buildhive identify the maven build 2012-11-17 16:56:05 +01:00
Andreas Dangel fe0df04363 pmd website: update links, add a proper rewrite rule, add a nicer 404 error page 2012-11-17 16:25:32 +01:00
Romain PELISSE 3545b58820 Merge with remote 2012-11-14 22:55:39 +01:00
Romain PELISSE 5059c75b47 Merge with master 2012-11-14 22:46:12 +01:00
Romain PELISSE 7bc5810f7a pmd: adding changes suggested by Ryan Gustavson 2012-11-14 22:06:32 +01:00
Romain PELISSE a887700c8f pmd: Fix broken docs regarding new CLI tool usage 2012-11-14 22:06:24 +01:00
Romain PELISSE 1de9f7cd49 pmd: Reindent and whitespaces 2012-11-14 22:06:19 +01:00
Romain PELISSE 412322567e pmd: removes invalid call to System.exit() 2012-11-14 21:29:15 +01:00
Andreas Dangel d4ff29d2f7 Merge remote-tracking branch 'rpelisse/master' 2012-11-14 20:57:06 +01:00
Pelisse Romain 4a5afbcf75 Merge pull request #8 from adangel/property-renderer
Great job on Property renderer ! Thanks !
2012-11-14 11:30:33 -08:00
hooperbloob e2789335e4 new PMD snapshot jar 2012-11-09 08:17:35 -08:00
hooperbloob cd1e1ba133 Updates for the 4.0.0 release 2012-11-09 08:16:02 -08:00
hooperbloob d779fdb6a7 Updates relating to the 4.0.0 release of the plugin. Code to follow. 2012-11-08 22:46:38 -08:00
hooperbloob d6c2e505ab Bugfix for issue mentioned here:
http://sourceforge.net/p/pmd/discussion/188192/thread/888425ac
2012-10-31 23:35:36 -07:00
hooperbloob 09e0aaf335 Test commit, minor refactoring 2012-10-31 22:06:56 -07:00
Andreas Dangel a72c4f293c pmd: refactor renderers to use PropertyDescriptors 2012-10-26 20:13:20 +02:00
Andreas Dangel 940d5e36a8 pmd: make the old style properties deprecated for Renderer
* Provides also a default fall back to StringProperty
 * Use the new PropertyDescriptor for PMD command line help text
2012-10-26 19:31:26 +02:00
Andreas Dangel db22a424c4 pmd: remove old-style properties for renderers, where the properties were not used 2012-10-24 21:45:01 +02:00
Andreas Dangel 4304c8c455 pmd: updating tracker urls (bug 1025) 2012-10-22 20:21:54 +02:00
Andreas Dangel be6d551ba2 pmd (build): adjust release docu for git 2012-10-22 20:11:52 +02:00
Andreas Dangel 97b92fbf56 pmd: correct tracker url 2012-10-22 19:29:21 +02:00
Andreas Dangel 110fd248ca pmd: Merge pull request #7 2012-10-22 18:57:58 +02:00
Andreas Dangel d3d31968d5 pmd: #1034 UseConcurrentHashMap flags calls to methods that return Map 2012-10-21 19:59:32 +02:00
Andreas Dangel ce8a166a11 pmd: #1031 false DontImportJavaLang 2012-10-21 19:57:51 +02:00
Andreas Dangel d1d4fca5d5 pmd: #1035 UseObjectForClearerAPI has misspelled message 2012-10-21 19:24:01 +02:00
Andreas Dangel 3d2ff17d83 pmd: update bug ids 2012-10-21 17:04:45 +02:00
Andreas Dangel 86015e5277 pmd: using new pmd-build to fix bug 1036 - documentation of properties 2012-10-21 16:36:21 +02:00
Andreas Dangel 3941103714 pmd (build): add a RuntimeRulePropertiesAnalyzer to get the properties a rule supports for documentation (bug 1036)
* added maven plugin testing for a mojo test case
2012-10-21 16:32:30 +02:00
Andreas Dangel fefdc27c01 pmd (build): make sure the rulesets are sorted alphabetically
* fix TODO - use compiled regex pattern
2012-10-13 18:18:47 +02:00
Thomas a524a52008 Fix build; convert tests from JUnit 3 to 4; make some failing tests pass. 2012-10-08 11:19:20 -05:00
Andreas Dangel d126d9b0b8 pmd: bugfix 3546093 performance improving by caching not found classes 2012-10-07 10:38:52 +02:00
Andreas Dangel 60c2af73fd pmd: reintroducing check whether multi threading is support (bugfix for 3565001)
* created SystemUtils to check for multi-threading permission
Revert "pmd: Remove hack related to multithreading in jdk5 with Eclipse - no longer relevant today"

This reverts commit 720bb3d3b4.
2012-10-06 20:58:13 +02:00
Andreas Dangel 54cfe41206 pmd: improve javacc build with eclipse - add incremental build and only build if necessary 2012-10-06 19:24:32 +02:00
Andreas Dangel 99daea42a5 pmd: cleanup redundant test classes
* the two test suites are already integrated in DesignRulesTest and CouplingRulesTest
2012-10-06 19:20:25 +02:00
Andreas Dangel 28b37d6767 pmd: bugfix for 3574133: False+ : SingularField 2012-10-06 19:19:57 +02:00
Andreas Dangel da6e8fc05e pmd: updated changelog with bugfixes 2012-10-04 20:06:24 +02:00
Andreas Dangel 803e51f56b pmd: improve eclipse/maven integration 2012-10-03 21:51:58 +02:00
Andreas Dangel 5b7273bd47 pmd: delete the files that are generated by javacc from the repository
* the generated files are now located under target/generated-sources/javacc
 * Note: The files that are left in
   src/main/java/net/sourceforge/pmd/lang/java/ast
   were initially generated by javacc, but were modified
   (e.g. every AST*.java class)
2012-10-03 21:51:17 +02:00
Andreas Dangel 05b805b92c whitespaces / reformat 2012-10-03 21:48:52 +02:00
Andreas Dangel 97899e8b04 pmd website: make the site more friendly for smartphones. 2012-09-10 19:08:16 +02:00
Andreas Dangel ea6285dbf2 pmd (site): update release process with git specific commands. 2012-09-10 19:08:16 +02:00
Matthew Short 179ab9d708 First, I read this comment in the main tree and thought I'd put in some objects:
/*
	I'm doing a sort of State pattern thing here where
	this goes into "discarding" mode when it hits an import or package
	keyword and goes back into "accumulate mode" when it hits a semicolon.
	This could probably be turned into some objects.
	*/

I created a Discarder interface, and a couple implementations.  One handles keywords/tokens like import and package.  Another discards annotation blocks.  Another turns CPD on and off based on Strings within an annotation e.g. @SuppressWarnings("CPD-START") and @SuppressWarnings("CPD-END).

There have been two features desired by myself and my colleagues strongly.
1. Ability to ignore sections of source code, such as switch/case statements or parameterized factories.
2. Ability to ignore annotations.  More and more modern frameworks use annotations on classes and methods, which can be very redundant and trigger CPD matches.

Just to illustrate, here is a parametrized factory  example that can cause a false positive if you ignore literals (String and int values):

if ("A".equals(input)) return new A(1);
if ("B".equals(input)) return new A(2);
if ("C".equals(input)) return new A(3);
if ("D".equals(input)) return new A(4);
if ("E".equals(input)) return new A(5);
False positives cause the CPD reports to be a burden to review and read.  Many people start ignoring them when the first 20 entries are 'acceptable'.

For annotations, with J2EE (CDI, Transaction Handling, etc) and Spring (everything) become very redundant.  Often classes or methods have the same 5-6 lines of annotations.  This causes false positives.

For CPD-START and CPD-END, it would be much more desirable to use comments rather than annotations.  However, the parser drops comments and they can not be processed by the JavaTokenizer.  The current approach forces entire methods or classes to be skipped, rather than some blocks.  However, I feel its an improvement in cases like parameterized factories or case/switch statements where I don't want them polluting my results.
2012-09-03 20:25:21 -07:00
ryan-gustafson 051824beb8 Remove stray System.out. 2012-08-25 12:20:46 -05:00
ryan-gustafson 6419c3d6f5 Fixed bug 3560464: c/c++ \ as a continuation character not supported
Add ContinuationReader which entirely omits \\n and \\r\n from the
underlying Reader before anything reaches the parser.
2012-08-24 01:16:43 -05:00
TIOBE Software 3ceb80d7ac Added missing files for patch 2996539 : Add support for C# to CPD (simple parser) 2012-08-22 14:18:41 +02:00
ryan-gustafson 98c18554df Add ecmascript AvoidTrailingComma rule. 2012-08-15 05:42:50 -05:00
Romain PELISSE 37ec2f505b Add supported languages to generate usage/help text for CLI 2012-08-06 20:25:22 +02:00
Romain PELISSE 8709ade69f Add a positive value validator for the threads option 2012-08-06 19:54:57 +02:00
Romain PELISSE a66133e053 Remove now useless classes 2012-08-04 17:41:36 +02:00
Romain PELISSE a0236ee67f Move all CLI related logic into a class in the subpackage 'cli' - mostly to simplify and clarifiy PMD main class code. 2012-08-04 17:41:27 +02:00
Romain PELISSE f0b17e35ce Add a new Parameters class to hold all the parameters of PMD CLI 2012-08-04 17:37:02 +02:00
Romain PELISSE bd23033a82 Add jcommander as a dependency, in order to rework PMD CLI with it 2012-08-04 17:36:12 +02:00
Romain PELISSE 5d3f5f3ff4 Move XPathCLI to appropriate CLI subpackage 2012-08-04 17:35:17 +02:00
Romain PELISSE a248ca7da3 Whitespaces 2012-08-04 17:33:54 +02:00
Romain PELISSE e5083d3f59 Fix tests data directory, to ensure all files are properly generated inside the directory 2012-08-04 12:01:13 +02:00
Pelisse Romain 76b61e3054 Merge pull request #2 from rpelisse/master
Unit Test for CLI
2012-08-03 13:13:52 -07:00
Romain PELISSE 094e1bd490 Add unit test for CLI 2012-08-03 15:49:08 +02:00
Romain PELISSE 969678015d Modify PMD run to allow unit test to workaround the call to exit() - and retrieve the status code (using env's properties 2012-08-03 15:49:08 +02:00
Romain PELISSE 42ba8815b4 Add an handy public method to search for a pattern in a file 2012-08-03 15:49:08 +02:00
Romain PELISSE 30281b78af Add a handy class to iterate over a file, line by line (to be used in unit test, while checking result file) 2012-08-03 15:49:08 +02:00
Romain PELISSE baf4a9d903 Fix 3539117 - jnlp link for CPD is wrong. Thanks to Marcin Milkowski for spotting and reporting this. 2012-08-02 22:44:52 +02:00
Andreas Dangel 2b7bc6d300 Repository move to github 2012-07-29 16:43:36 +02:00
Andreas Dangel 094291e8ed pmd/bgastviewer: Moved the strings to the resources directory.
* removed accidentally added eclipse .project file, added .gitignore.
2012-07-26 20:19:25 +02:00
Andreas Dangel 2d9b4b400f Merge branch 'master' of https://github.com/victorbucutea/pmd into victorbucutea-master 2012-07-23 20:17:06 +02:00
Victor Bucutea 2b21c3e060 removed unwanted orig file 2012-07-23 19:00:38 +03:00
Victor Bucutea 1a8e374fbb Commit improved JSP parser + fix for ./bgastviewer 2012-07-23 18:52:40 +03:00
Andreas Dangel 8d2c08d5cb pmd: bugfix for 3484404 (Invalid NPath calculation in return statement)
Thanks to Prabhjot Singh for the patch.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7706 51baf565-9d33-0410-a72c-fc3788e3496d
2012-07-19 16:48:18 +00:00
Andreas Dangel 6926ba0647 pmd: added test for bug 3484404 (NPathComplexity and return statements)
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7705 51baf565-9d33-0410-a72c-fc3788e3496d
2012-07-19 16:47:43 +00:00
Dinesh Bolkensteyn c629e28711 Delete the empty lib folder
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7704 51baf565-9d33-0410-a72c-fc3788e3496d
2012-07-03 08:07:45 +00:00
Dinesh Bolkensteyn 7e9ef50cfe Clean up some empty folders
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7703 51baf565-9d33-0410-a72c-fc3788e3496d
2012-07-03 08:02:30 +00:00
Dinesh Bolkensteyn 58ae0344ff 3539585 AvoidLiteralsInIfCondition must NOT consider null
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7702 51baf565-9d33-0410-a72c-fc3788e3496d
2012-07-03 07:29:40 +00:00
Romain Pelisse faedbdd9b3 Site: Add link to a Gregorian translation recently contributed
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7701 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-12 15:56:35 +00:00
Romain Pelisse eab43fee83 Site: add documentation for new run.sh script (unices only)
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7700 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-12 15:56:12 +00:00
Andreas Dangel 732bb2de1f pmd: add test for bug 3524607 (annotated package)
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7699 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-11 17:47:36 +00:00
Andreas Dangel ad2017a073 pmd (site): renamed cpd.xml to cpd-usage.xml so that we can have a cpd report of PMD.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7698 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-11 17:47:11 +00:00
Andreas Dangel 8b586a5375 pmd: fix developer info in pom.xml
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7697 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-11 17:46:45 +00:00
Andreas Dangel f89c68a3bf pmd: added another test case for the parser
* see: http://jira.codehaus.org/browse/MPMD-126

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7696 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-11 17:46:25 +00:00
Brian Remedios bdb16fb1b5 minor cleanup
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7695 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 17:59:07 +00:00
Brian Remedios d447509c16 This class is quasi-obsolete, we should be transforming the XML renderer output instead, tagged with a FIXME.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7694 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 17:43:15 +00:00
Brian Remedios 38a959d939 minor tweak
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7693 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 17:26:23 +00:00
Brian Remedios eefb81a056 rm redundant methods
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7692 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 17:14:31 +00:00
Andreas Dangel c61a4f1543 pmd: configuring maven site
* removing the broken dependency icu4j - seems not to be needed
 * adding pmd report

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7691 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:11:03 +00:00
Andreas Dangel b5614ce718 pmd: added sourceforge tracking icons to the website
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7690 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:10:47 +00:00
Andreas Dangel 0e86ee33a4 pmd: make the output encoding of XMLRenderer of CPD and PMD more
easily configurable

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7689 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:10:25 +00:00
Andreas Dangel d04e8d32e9 pmd: ignoring tests with @Ignore, avoiding a little bit of configuration
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7688 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:09:54 +00:00
Andreas Dangel 9573085a9a pmd: filter the ruleset xml files to bring in the correct website URL
for the externalInfoU.

The website URL for snapshots and releases is different and now
controlled via the property pmd.website.baseurl.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7687 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:09:16 +00:00
Andreas Dangel ef057d6fc7 pmd: adding me as developer in the POM :)
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7686 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:07:49 +00:00
Andreas Dangel c2d113ead8 pmd: added additional parser tests for java 7
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7685 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:07:34 +00:00
Andreas Dangel e6e5c6dd7d pmd: fixed bug #2410201 False+ AvoidReassigningParameters
This is indeed a lack of the symbol table and type resolution, which is
not finished yet. We now stop trying to resolve the variables, once we
did not find the declaration in the middle.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7684 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:06:56 +00:00
Andreas Dangel eb6c0c8d31 pmd: fixed bug #3526212 with immutable field and compound assignment
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7683 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:05:50 +00:00
Andreas Dangel 196a5f15ea pmd: fixed bug #3526992 False + UselessParentheses
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7682 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:04:59 +00:00
Andreas Dangel 4ffeda09cf pmd: cleanup with the namespace handling in the ruleset files
noNameSpaceLocation is not needed as we use our namespace as
the default one. If we use anything else, we anyway need to
declare what we use.

Copied the schema and dtd to website.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7681 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:03:49 +00:00
Andreas Dangel 40c2a5d768 cpd: fixed bug #3523614, preserving the newlines in the XML report
Excluding the transitive xalan dependency and adding the missing saxon-dom
dependency, so that we have saxon complete and only one XML library.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7680 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:00:55 +00:00
Andreas Dangel 9eab491f2a pmd: fixed bug #3516101 (InsufficientStringBufferDeclaration fails to parse hex)
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7679 51baf565-9d33-0410-a72c-fc3788e3496d
2012-06-02 12:00:14 +00:00
Andreas Dangel 2ec09b626a pmd: Strings.InefficientStringBuffering: fixed bugs #1503099 and #3109408
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7678 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-31 18:22:48 +00:00
Andreas Dangel af59a4c38b pmd: update changelog
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7677 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-30 19:27:41 +00:00
Andreas Dangel dd5ae3869c pmd: Fix parser problem #3530124 with generics
Modified the grammar, so that the different usages of generics work.
Adjusted the rules, that use "super", as super is no longer a PrimarySuffix.
It's now either a ExplicitConstructorInvocation or a PrimaryPrefix.
See also test case ParserCornersTest/testParsersCases

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7676 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-30 18:29:22 +00:00
Andreas Dangel 65e7054972 pmd: improve MissingBreakInSwitch to ignore empty cases
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7675 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-28 17:46:36 +00:00
Andreas Dangel 933e4e4456 Added a new website front-page for pmd.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7674 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-28 06:18:14 +00:00
Andreas Dangel 4768da3e47 pmd: added test case for parser problem #3530124
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7673 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-28 06:17:41 +00:00
Andreas Dangel 04d5f470e8 pmd: improve MissingBreakInSwitch to fix false- #3496028
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7672 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-28 06:17:04 +00:00
Brian Remedios 7199a1103d Disable rules from markers shown in editors
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7671 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-03 19:10:53 +00:00
Andreas Dangel cfb9d30a4d pmd: merged r7665 and r7669 from 5.0.x branch to trunk
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7670 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-01 12:09:15 +00:00
Andreas Dangel d841cbaece [maven-release-plugin] prepare release 5.0.x
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7663 51baf565-9d33-0410-a72c-fc3788e3496d
2012-04-30 11:32:30 +00:00
1198 changed files with 48161 additions and 42796 deletions

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
[![PMD - Don't shoot the messenger][PMDLogo]][website]
PMD
===
About
-----
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, XML, XSL.
Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code in
Java, C, C++, C#, PHP, Ruby, Fortran, JavaScript.
Source
------
Our latest source of PMD can be found on [GitHub]. Fork us!
The current status of this repo can be seen at [BuildHive].
News and Website
----------------
More information can be found on our [Website] and on [SourceForge].
[PMDLogo]: http://pmd.sourceforge.net/pmd_logo.png
[GitHub]: https://github.com/pmd/pmd
[BuildHive]: https://buildhive.cloudbees.com/job/pmd/
[Website]: http://pmd.sourceforge.net
[SourceForge]: https://sourceforge.net/projects/pmd/
+46 -11
View File
@@ -6,12 +6,13 @@
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
<relativePath/>
</parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-build</artifactId>
<name>PMD Build Plugin</name>
<version>0.7-SNAPSHOT</version>
<version>0.9-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<description>
<![CDATA[
@@ -38,9 +39,10 @@ only if you modify the java code.
</licenses>
<scm>
<connection>scm:svn:https://pmd.svn.sourceforge.net/svnroot/pmd/trunk/maven-plugin-pmd-build</connection>
<developerConnection>scm:svn:https://pmd.svn.sourceforge.net/svnroot/pmd/trunk/maven-plugin-pmd-build</developerConnection>
<url>http://pmd.svn.sourceforge.net/viewvc/pmd/trunk/maven-plugin-pmd-build</url>
<connection>scm:git:git://github.com/pmd/pmd.git</connection>
<developerConnection>scm:git:ssh://git@github.com/pmd/pmd.git</developerConnection>
<url>https://github.com/pmd/pmd</url>
<tag>HEAD</tag>
</scm>
<developers>
@@ -73,13 +75,22 @@ only if you modify the java code.
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<tagBase>https://pmd.svn.sourceforge.net/svnroot/pmd/tags/maven-plugin-pmd-build</tagBase>
<tagNameFormat>@{project.artifactId}/@{project.version}</tagNameFormat>
<pushChanges>false</pushChanges>
<localCheckout>true</localCheckout>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<mavenVersion>3.0.3</mavenVersion>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
@@ -87,24 +98,48 @@ only if you modify the java code.
<version>1.8.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>2.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<reporting>
+8 -6
View File
@@ -3,7 +3,6 @@ Release Howto for pmd-build:
Prerequisites:
--------------
* You need to use SVN currently (git / git-svn is not supported at the moment)
* You need to have a Jira account at Sonatype: https://issues.sonatype.org/
* You need to have upload permissions to the staging repository for PMD at sonatype: https://issues.sonatype.org/browse/OSSRH-2295
* For more infos: https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
@@ -12,15 +11,16 @@ Prerequisites:
* You need to have your settings.xml filled:
-> configure the property gpg.keyname and any other property for the maven-gpg-plugin (e.g. via a profile)
-> configure the server section (you need to configure your sonatype jira account for server id "sonatype-nexus-staging").
* You'll need at least maven 3.0.4, see http://jira.codehaus.org/browse/MRELEASE-756
Step by step:
-------------
1. Checkout trunk via svn:
1. Checkout master branch:
svn co https://pmd.svn.sourceforge.net/svnroot/pmd/trunk/maven-plugin-pmd-build
cd maven-plugin-pmd-build
git clone https://github.com/pmd/pmd.git
cd pmd/maven-plugin-pmd-build
2. Prepare the release (creates a new release tag in SVN).
2. Prepare the release (creates a new release tag).
This will be done for you: http://maven.apache.org/plugins/maven-release-plugin/examples/prepare-release.html
Maven will ask you about the release version, the tag name and the new version. You can simply hit enter,
to use the default values.
@@ -32,7 +32,6 @@ mvn release:prepare
mvn release:perform
4. Release it via Sonatype Nexus
* Login to https://oss.sonatype.org/
* Go to Staging Repositories page
@@ -41,5 +40,8 @@ mvn release:perform
* Now you can download the artifacts again and verify they are working.
* Once you are sure they are working, click "Release" and the artifacts are eventually available through maven central.
5. Push your local changes if everything is fine
git push origin master
git push origin tag pmd-build/<version>
@@ -3,6 +3,8 @@
*/
package net.sourceforge.pmd.ant;
import java.net.URL;
import net.sourceforge.pmd.build.PmdBuildException;
import net.sourceforge.pmd.build.PmdBuildTools;
import net.sourceforge.pmd.build.RuleSetToDocs;
@@ -20,7 +22,14 @@ public class PmdBuildTask extends Task {
private String target;
private String siteXml;
private String siteXmlTarget;
private URL[] runtimeClasspath;
public URL[] getRuntimeClasspath() {
return runtimeClasspath;
}
public void setRuntimeClasspath(URL[] runtimeClasspath) {
this.runtimeClasspath = runtimeClasspath;
}
public String getSiteXml() {
return siteXml;
}
@@ -72,6 +81,7 @@ public class PmdBuildTask extends Task {
tool.setSiteXml(siteXml);
tool.setSiteXmlTarget(this.siteXmlTarget);
tool.setRulesDirectory(this.rulesDirectory);
tool.setRuntimeClasspath(runtimeClasspath);
try {
tool.convertRulesets();
@@ -90,6 +100,9 @@ public class PmdBuildTask extends Task {
throw new BuildException("Attribute rulesDirectory is not optional");
if ( this.siteXml == null ||"".equals(siteXml))
throw new BuildException("Attribute siteXml is not optional");
if ( this.runtimeClasspath == null || "".equals(runtimeClasspath)) {
throw new BuildException("Attribute pmdClasspath is not optional");
}
// Optional Attributes
if ( this.mergedRulesetFilename != null && ! "".equals(this.mergedRulesetFilename) )
tool.setMergedRuleSetFilename(this.mergedRulesetFilename);
@@ -1,5 +1,7 @@
package net.sourceforge.pmd.build;
import java.net.URL;
public interface PmdBuildTools {
@@ -42,4 +44,12 @@ public interface PmdBuildTools {
* @param siteXmlTaget
*/
public abstract void setSiteXmlTarget(String siteXmlTarget);
/**
* Configures the classpath to use to analyze the properties of rules.
* @param runtimeClasspath
* @see RuntimeRulePropertiesAnalyzer
*/
public void setRuntimeClasspath(URL[] runtimeClasspath);
}
@@ -7,6 +7,9 @@ import static net.sourceforge.pmd.build.util.ConfigUtil.getString;
import static net.sourceforge.pmd.build.util.XmlUtil.createXmlBackbone;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
@@ -19,6 +22,10 @@ import net.sourceforge.pmd.build.util.FileUtil;
import net.sourceforge.pmd.build.util.XmlUtil;
import net.sourceforge.pmd.build.xml.RulesetFileTemplater;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* A small class to convert files from pmd rulesets fmt to xdoc fmt
*
@@ -36,6 +43,16 @@ public class RuleSetToDocs implements PmdBuildTools {
private String targetDirectory;
private String siteXml;
private String siteXmlTarget;
private URL[] runtimeClasspath;
private RuntimeRulePropertiesAnalyzer ruleAnalyzer;
public URL[] getRuntimeClasspath() {
return runtimeClasspath;
}
public void setRuntimeClasspath(URL[] runtimeClasspath) {
this.runtimeClasspath = runtimeClasspath;
}
public String getSiteXmlTarget() {
return siteXmlTarget;
@@ -104,6 +121,7 @@ public class RuleSetToDocs implements PmdBuildTools {
private void init() throws PmdBuildException {
FileUtil.createDirIfMissing(targetDirectory);
xmlFileTemplater = new RulesetFileTemplater(rulesDirectory);
ruleAnalyzer = new RuntimeRulePropertiesAnalyzer(runtimeClasspath);
logger.fine("Merge xsl:" + xmlFileTemplater.getMergeRulesetXsl());
}
@@ -145,7 +163,19 @@ public class RuleSetToDocs implements PmdBuildTools {
}
private void convertRuleSetFile(File ruleset,File target) throws PmdBuildException {
xmlFileTemplater.transform(ruleset,target,xmlFileTemplater.getRulesetToDocsXsl());
try {
DOMSource dom = XmlUtil.createDomSourceFrom(new FileInputStream(ruleset));
Document document = (Document)dom.getNode();
NodeList rules = document.getElementsByTagName("rule");
for (int i = 0; i < rules.getLength(); i++) {
Node rule = rules.item(i);
ruleAnalyzer.analyze(document, rule);
}
xmlFileTemplater.transform(dom,target,xmlFileTemplater.getRulesetToDocsXsl());
} catch (FileNotFoundException e) {
throw new IllegalArgumentException(e);
}
}
private void addRulesetsToSiteXml(DOMSource backbone) {
@@ -0,0 +1,113 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.build;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class RuntimeRulePropertiesAnalyzer {
private static final String XPATH_RULE_CLASSNAME = "net.sourceforge.pmd.lang.rule.XPathRule";
private ClassLoader cl;
private Class<?> propertySource;
private Class<?> propertyDesc;
private Method nameMethod;
private Method descMethod;
private Method defaultValueMethod;
private Field propertiesField;
private Field propertiesValues;
public RuntimeRulePropertiesAnalyzer(URL[] runtimeClasspath) {
init(runtimeClasspath);
}
private void init(URL[] runtimeClasspath) {
try {
cl = new URLClassLoader(runtimeClasspath);
propertySource = cl.loadClass("net.sourceforge.pmd.AbstractPropertySource");
propertyDesc = cl.loadClass("net.sourceforge.pmd.PropertyDescriptor");
nameMethod = propertyDesc.getDeclaredMethod("name");
descMethod = propertyDesc.getDeclaredMethod("description");
defaultValueMethod = propertyDesc.getDeclaredMethod("defaultValue");
propertiesField = propertySource.getDeclaredField("propertyDescriptors");
propertiesValues = propertySource.getDeclaredField("propertyValuesByDescriptor");
propertiesField.setAccessible(true);
propertiesValues.setAccessible(true);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* Analyzes the class of the given rule definition to find the properties
* this rule supports.
* The properties are directly added to the rule node.
* @param document the document, used to create new property nodes
* @param rule the rule to analyze
*/
public void analyze(Document document, Node rule) {
Node classAttribute = rule.getAttributes().getNamedItem("class");
if (classAttribute == null) {
// some rule definitions, like <rule ref="..."/> have no class attribute
return;
}
String classAtt = classAttribute.getTextContent();
if (XPATH_RULE_CLASSNAME.equals(classAtt)) {
// xpath rules are ignored - they have there properties defined already in the rule definition xml
return;
}
try {
Class<?> clazz = cl.loadClass(classAtt);
Object ruleInstance = clazz.newInstance();
@SuppressWarnings("rawtypes")
List properties = (List)propertiesField.get(ruleInstance);
@SuppressWarnings("rawtypes")
Map values = (Map)propertiesValues.get(ruleInstance);
Element propsElem = null;
NodeList ruleChilds = rule.getChildNodes();
for (int j = 0; j < ruleChilds.getLength(); j++) {
Node item = ruleChilds.item(j);
if (item.getNodeType() == Node.ELEMENT_NODE && "properties".equals(item.getNodeName())) {
propsElem = (Element)item;
break;
}
}
if (propsElem == null) {
propsElem = document.createElement("properties");
rule.appendChild(propsElem);
}
for (Object o : properties) {
Object value = values.get(o);
if (value == null) {
value = defaultValueMethod.invoke(o);
}
Element propElem = document.createElement("property");
propElem.setAttribute("name", (String)nameMethod.invoke(o));
propElem.setAttribute("description", (String)descMethod.invoke(o));
if (value != null) {
String valueString = String.valueOf(value);
if (value.getClass().isArray()) {
valueString = Arrays.toString((Object[])value);
}
propElem.setAttribute("value", valueString);
}
propsElem.appendChild(propElem);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
@@ -5,6 +5,7 @@ package net.sourceforge.pmd.build.filefilter;
import java.io.File;
import java.io.FilenameFilter;
import java.util.regex.Pattern;
/**
*
@@ -15,8 +16,13 @@ import java.io.FilenameFilter;
public class RulesetFilenameFilter implements FilenameFilter {
// FUTURE: Make this somehow configurable ? Turn into an array passed by constructor ?
// TODO: move to compiled regex to improve perf.
private static final String[] patterns = { "^[0-9][0-9].*\\.xml", "^.*dogfood.*\\.xml", "^all-.*\\.xml", "^migrating_.*\\.xml", "^pmdspecific.xml"} ;
private static final Pattern EXCLUDE = Pattern.compile(
"(^[0-9][0-9].*\\.xml)" +
"|(^.*dogfood.*\\.xml)" +
"|(^all-.*\\.xml)" +
"|(^migrating_.*\\.xml)" +
"|(^pmdspecific.xml)"
);
public boolean accept(File file, String name) {
if ( doesNotMatchExcludeNames(name) )
@@ -26,10 +32,6 @@ public class RulesetFilenameFilter implements FilenameFilter {
}
private boolean doesNotMatchExcludeNames(String name) {
for ( String pattern : patterns ) {
if ( name.matches(pattern))
return false;
}
return true;
return !EXCLUDE.matcher(name).matches();
}
}
@@ -15,8 +15,10 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashSet;
import java.util.Set;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import net.sourceforge.pmd.build.PmdBuildException;
@@ -28,20 +30,20 @@ public final class FileUtil {
public static String pathToParent = "..";
private FileUtil() {};
private FileUtil() {}
public static Set<File> listFilesFrom(File dir) {
public static List<File> listFilesFrom(File dir) {
return filterFilesFrom(dir, null);
}
public static Set<File> filterFilesFrom(File dir, FilenameFilter filter) {
Set<File> filteredFiles = new HashSet<File>(0);
public static List<File> filterFilesFrom(File dir, FilenameFilter filter) {
List<File> filteredFiles = new LinkedList<File>();
if ( dir != null ) {
File[] files = dir.listFiles(filter);
if ( files != null && files.length > 0 )
for ( int fileIterator = 0 ; fileIterator < files.length ; fileIterator++ )
filteredFiles.add(files[fileIterator]);
filteredFiles.addAll(Arrays.asList(files));
}
Collections.sort(filteredFiles);
return filteredFiles;
}
@@ -1,15 +1,24 @@
package net.sourceforge.pmd.maven;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import net.sourceforge.pmd.build.PmdBuildException;
import net.sourceforge.pmd.build.PmdBuildTools;
import net.sourceforge.pmd.build.RuleSetToDocs;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
/**
* Says "Hi" to the user.
* @goal pmd-pre-site
* @requiresDependencyResolution runtime
*/
public class PmdPreSite extends AbstractMojo
{
@@ -37,28 +46,56 @@ public class PmdPreSite extends AbstractMojo
/**
* Path to the existing site descriptor
*
* @parameter expression="${pmd.rulesets}" default-value="src/main/resources/rulesets/
* @parameter expression="${pmd.rulesets}" default-value="src/main/resources/rulesets/"
*/
private String rulesetsDirectory;
private String rulesetsDirectory;
/**
* @parameter default-value="${project}"
* @required
* @readonly
*/
private MavenProject project;
public void execute() throws MojoExecutionException {
getLog().info("PMD: site generation preparation");
getLog().debug("- target:" + target);
getLog().debug("- siteXml:" + siteXml);
getLog().debug("- rulesets:" + rulesetsDirectory);
getLog().debug(" -siteXmlTarget" + siteXmlTarget);
PmdBuildTools tool = new RuleSetToDocs();
tool.setTargetDirectory(target);
tool.setSiteXml(siteXml);
tool.setRulesDirectory(rulesetsDirectory);
tool.setSiteXmlTarget(siteXmlTarget);
List<URL> runtimeClasspath = determineRuntimeClasspath();
getLog().info("PMD: site generation preparation");
getLog().debug("- target:" + target);
getLog().debug("- siteXml:" + siteXml);
getLog().debug("- rulesets:" + rulesetsDirectory);
getLog().debug(" -siteXmlTarget" + siteXmlTarget);
try {
tool.convertRulesets();
tool.preSiteGeneration();
}
catch ( PmdBuildException e) {
throw new MojoExecutionException(e.getMessage());
PmdBuildTools tool = new RuleSetToDocs();
tool.setTargetDirectory(target);
tool.setSiteXml(siteXml);
tool.setRulesDirectory(rulesetsDirectory);
tool.setSiteXmlTarget(siteXmlTarget);
tool.setRuntimeClasspath(runtimeClasspath.toArray(new URL[runtimeClasspath.size()]));
try {
tool.convertRulesets();
tool.preSiteGeneration();
}
catch ( PmdBuildException e) {
throw new MojoExecutionException(e.getMessage());
}
}
private List<URL> determineRuntimeClasspath() {
List<URL> runtimeClasspath;
try {
runtimeClasspath = new ArrayList<URL>();
runtimeClasspath.add(new File(project.getBuild().getOutputDirectory()).toURI().toURL());
Set<Artifact> runtimeArtifacts = project.getArtifacts();
for (Artifact a : runtimeArtifacts) {
if (Artifact.SCOPE_COMPILE.equals(a.getScope()) || Artifact.SCOPE_RUNTIME.equals(a.getScope()) ) {
runtimeClasspath.add(a.getFile().toURI().toURL());
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return runtimeClasspath;
}
}
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
BSD-style license; for more info see http://pmd.sourceforge.net/license.html
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="root">
<xsl:comment>
THIS FILE HAS BEEN AUTOMATICLY GENERATED.
@@ -33,7 +33,7 @@
</document>
</xsl:template>
<xsl:template match="rule">
<xsl:template match="rule[@name]">
<xsl:variable name="rulename" select="@name"/>
<xsl:variable name="classname" select="@class"/>
@@ -55,7 +55,7 @@
<xsl:with-param name="classname" select="$classname"/>
</xsl:call-template>
</xsl:variable>
<p><xsl:value-of select="$definedByJavaClass"/>:<a><xsl:attribute name="href"><xsl:value-of select="concat(concat('../../xref/',$classfile),'.html')"/></xsl:attribute><xsl:value-of select="@class"/></a>
<p><xsl:value-of select="$definedByJavaClass"/>: <a><xsl:attribute name="href"><xsl:value-of select="concat(concat('../../xref/',$classfile),'.html')"/></xsl:attribute><xsl:value-of select="@class"/></a>
</p>
</xsl:otherwise>
</xsl:choose>
@@ -29,6 +29,9 @@
</li>
</xsl:for-each>
</ul>
<xsl:variable name="urlPrefixLength"><xsl:value-of select="string-length('${pmd.website.baseurl}/rules/')"/></xsl:variable>
<xsl:for-each select="language">
<xsl:variable name="language"><xsl:value-of select="@name"/></xsl:variable>
<xsl:for-each select="ruleset">
@@ -40,8 +43,12 @@
<subsection>
<xsl:attribute name="name"><xsl:value-of select="@name"/> (<xsl:value-of select="$language"/>)</xsl:attribute>
<ul>
<xsl:for-each select="./rule">
<li> <xsl:value-of select="@name"/>: <xsl:value-of select="description"/></li>
<xsl:for-each select="./rule[@name]">
<li>
<a>
<xsl:attribute name="href"><xsl:value-of select="substring(@externalInfoUrl,$urlPrefixLength + 1)"/></xsl:attribute>
<xsl:value-of select="@name"/>
</a>: <xsl:value-of select="description"/></li>
</xsl:for-each>
</ul>
</subsection>
@@ -0,0 +1,41 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd;
/*
* Note: This class is here in pmd-build to test the RuntimeRulePropertiesAnalyzer
*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AbstractPropertySource {
protected List<PropertyDescriptor> propertyDescriptors = new ArrayList<PropertyDescriptor>();
protected Map<PropertyDescriptor, Object> propertyValuesByDescriptor = new HashMap<PropertyDescriptor, Object>();
protected void defineProperty(final String name, final String description, final Object defaultValue) {
net.sourceforge.pmd.PropertyDescriptor descriptor = new net.sourceforge.pmd.PropertyDescriptor() {
@Override
public String name() {
return name;
}
@Override
public String description() {
return description;
}
@Override
public Object defaultValue() {
return defaultValue;
}
};
propertyDescriptors.add(descriptor);
propertyValuesByDescriptor.put(descriptor, defaultValue);
}
}
@@ -0,0 +1,15 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd;
/*
* Note: This class is here in pmd-build to test the RuntimeRulePropertiesAnalyzer
*/
public interface PropertyDescriptor {
String name();
String description();
Object defaultValue();
}
@@ -5,10 +5,7 @@ package net.sourceforge.pmd;
import java.io.File;
import net.sourceforge.pmd.build.PmdBuildException;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.codehaus.plexus.util.FileUtils;
import org.junit.Before;
/**
@@ -19,31 +16,14 @@ import org.junit.Before;
public abstract class TestBase {
protected static String TEST_DIR = "target/test-environment/";
protected static File testDir = null;
protected static File testDir = new File(TEST_DIR);
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
testDir = new File(TEST_DIR);
if (! testDir.exists() && ! testDir.mkdir() )
{
throw new PmdBuildException("Can't create " + TEST_DIR);
}
else if ( ! testDir.isDirectory() )
{
throw new PmdBuildException("testdir " + TEST_DIR + " exist !");
}
FileUtils.copyDirectory(new File("src/test/resources/sample-pmd"), testDir);
}
@After
public void tearDown() throws Exception {
if (testDir != null) {
FileUtils.deleteDirectory(testDir);
}
testDir = null;
FileUtils.deleteDirectory(testDir);
FileUtils.copyDirectoryStructure(new File("src/test/resources/sample-pmd"), testDir);
}
}
@@ -4,8 +4,14 @@
package net.sourceforge.pmd.ant;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.net.URL;
import net.sourceforge.pmd.TestBase;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
/**
@@ -17,10 +23,16 @@ public class PmdBuildTaskTest extends TestBase {
@Test
public void antTask() throws Exception {
PmdBuildTask task = new PmdBuildTask();
task.setRulesDirectory(TEST_DIR + "rulesets");
task.setRulesDirectory(TEST_DIR + "src/main/resources/rulesets");
task.setTarget(TEST_DIR + "target");
task.setSiteXml(TEST_DIR + "site/site.pre.xml");
task.setSiteXmlTarget(TEST_DIR + "site/site.xml");
task.setSiteXml(TEST_DIR + "src/site/site.pre.xml");
task.setSiteXmlTarget(TEST_DIR + "src/site/site.xml");
task.setRuntimeClasspath(new URL[] {new File("target/test-classes").toURI().toURL()});
task.execute();
String site = IOUtils.toString(new File(TEST_DIR + "src/site/site.xml").toURI());
assertTrue(site.contains("<item name=\"Basic\""));
assertTrue(site.contains("<item name=\"Code Size\""));
assertTrue(site.indexOf("<item name=\"Basic\"") < site.indexOf("<item name=\"Code Size\""));
}
}
@@ -3,8 +3,19 @@
*/
package net.sourceforge.pmd.build;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.List;
import java.util.Map;
import net.sourceforge.pmd.TestBase;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
/**
@@ -16,9 +27,36 @@ public class RuleSetToDocsTest extends TestBase {
@Test
public void convertRulesetsTest() throws Exception {
RuleSetToDocs builder = new RuleSetToDocs();
builder.setRulesDirectory(TEST_DIR + "rulesets");
builder.setRulesDirectory(TEST_DIR + "src/main/resources/rulesets");
builder.setTargetDirectory(TEST_DIR + "target");
builder.setRuntimeClasspath(new URL[] {new File("target/test-classes").toURI().toURL()});
builder.convertRulesets();
String codeSizeRuleset = IOUtils.toString(new File(TEST_DIR + "target/java/codesize.xml").toURI());
assertTrue(codeSizeRuleset.contains("minimum"));
}
@Test
public void readPropertyDescriptors() throws Exception {
ClassLoader cl = RuleSetToDocsTest.class.getClassLoader();
Class<?> clazz = cl.loadClass("net.sourceforge.pmd.lang.java.rule.codesize.NPathComplexityRule");
Object ruleInstance = clazz.newInstance();
Class<?> propertySource = cl.loadClass("net.sourceforge.pmd.AbstractPropertySource");
Class<?> propertyDesc = cl.loadClass("net.sourceforge.pmd.PropertyDescriptor");
Method nameMethod = propertyDesc.getDeclaredMethod("name");
Method descMethod = propertyDesc.getDeclaredMethod("description");
Field propertiesField = propertySource.getDeclaredField("propertyDescriptors");
Field propertiesValues = propertySource.getDeclaredField("propertyValuesByDescriptor");
propertiesField.setAccessible(true);
propertiesValues.setAccessible(true);
@SuppressWarnings("rawtypes")
List properties = (List)propertiesField.get(ruleInstance);
@SuppressWarnings("rawtypes")
Map values = (Map)propertiesValues.get(ruleInstance);
assertEquals(1, properties.size());
assertEquals("minimum", nameMethod.invoke(properties.get(0)));
assertEquals("The minimum threshold property.", descMethod.invoke(properties.get(0)));
assertEquals("200.0", String.valueOf(values.get(properties.get(0))));
}
}
@@ -0,0 +1,29 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.build;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
import net.sourceforge.pmd.build.filefilter.RulesetFilenameFilter;
import org.junit.Test;
public class RulesetFilenameFilterTest {
@Test
public void testAccept() {
RulesetFilenameFilter filter = new RulesetFilenameFilter();
File directory = new File(".");
assertTrue(filter.accept(directory, "codesize.xml"));
assertFalse(filter.accept(directory, "some-text-file.txt"));
assertFalse(filter.accept(directory, "all-java.xml"));
assertFalse(filter.accept(directory, "dogfood.xml"));
}
}
@@ -0,0 +1,17 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codesize;
/*
* Note: This class is here in pmd-build to test the RuntimeRulePropertiesAnalyzer
*/
import net.sourceforge.pmd.AbstractPropertySource;
public class NPathComplexityRule extends AbstractPropertySource {
public NPathComplexityRule() {
defineProperty("minimum", "The minimum threshold property.", 200.0d);
}
}
@@ -0,0 +1,51 @@
package net.sourceforge.pmd.maven;
import java.io.File;
import org.apache.commons.io.IOUtils;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
import org.junit.Before;
import org.junit.Test;
public class PmdPreSiteTest extends AbstractMojoTestCase {
@Before
@Override
public void setUp() throws Exception {
super.setUp();
FileUtils.deleteDirectory( new File( getBasedir(), "target/unit/sample-pmd" ) );
}
@Test
public void testMojo() throws Exception {
FileUtils.copyDirectoryStructure(new File("src/test/resources/sample-pmd"),
new File("target/unit/sample-pmd"));
File pom = getTestFile( "target/unit/sample-pmd/pom.xml" );
assertNotNull( pom );
assertTrue( pom.exists() );
PmdPreSite myMojo = (PmdPreSite) lookupMojo( "pmd-pre-site", pom );
assertNotNull( myMojo );
myMojo.execute();
String codeSizeRuleset = IOUtils.toString(new File("target/unit/sample-pmd/target/generated-xdocs/rules/java/codesize.xml").toURI());
assertTrue(codeSizeRuleset.contains("minimum"));
String basicRuleset = IOUtils.toString(new File("target/unit/sample-pmd/target/generated-xdocs/rules/java/basic.xml").toURI());
assertEquals(1, StringUtils.countMatches(basicRuleset, "<subsection"));
String indexPage = IOUtils.toString(new File("target/unit/sample-pmd/target/generated-xdocs/rules/index.xml").toURI());
assertFalse(indexPage.contains("<li>: </li>"));
String site = IOUtils.toString(new File("target/unit/sample-pmd/src/site/site.xml").toURI());
assertTrue(site.contains("<item name=\"Basic\""));
assertTrue(site.contains("<item name=\"Code Size\""));
assertTrue(site.indexOf("<item name=\"Basic\"") < site.indexOf("<item name=\"Code Size\""));
}
}
@@ -0,0 +1,67 @@
package net.sourceforge.pmd.maven.stubs;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
import org.codehaus.plexus.util.ReaderFactory;
public class ProjectStub extends MavenProjectStub {
/**
* Default constructor
*/
public ProjectStub()
{
MavenXpp3Reader pomReader = new MavenXpp3Reader();
Model model;
try
{
model = pomReader.read( ReaderFactory.newXmlReader( new File( getBasedir(), "pom.xml" ) ) );
setModel( model );
}
catch ( Exception e )
{
throw new RuntimeException( e );
}
setGroupId( model.getGroupId() );
setArtifactId( model.getArtifactId() );
setVersion( model.getVersion() );
setName( model.getName() );
setUrl( model.getUrl() );
setPackaging( model.getPackaging() );
Build build = new Build();
build.setFinalName( model.getArtifactId() );
build.setDirectory( getBasedir() + "/target" );
build.setSourceDirectory( getBasedir() + "/src/main/java" );
build.setOutputDirectory( getBasedir() + "/target/classes" );
build.setTestSourceDirectory( getBasedir() + "/src/test/java" );
build.setTestOutputDirectory( getBasedir() + "/target/test-classes" );
setBuild( build );
List<String> compileSourceRoots = new ArrayList<String>();
compileSourceRoots.add( getBasedir() + "/src/main/java" );
setCompileSourceRoots( compileSourceRoots );
List<String> testCompileSourceRoots = new ArrayList<String>();
testCompileSourceRoots.add( getBasedir() + "/src/test/java" );
setTestCompileSourceRoots( testCompileSourceRoots );
}
/** {@inheritDoc} */
public File getBasedir()
{
return new File( super.getBasedir() + "/target/unit/sample-pmd/" );
}
@Override
public List<Artifact> getRuntimeArtifacts() {
return new ArrayList<Artifact>();
}
}
@@ -0,0 +1,37 @@
<?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>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<name>PMD</name>
<version>5.1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-build</artifactId>
<version>0.7-SNAPSHOT</version>
<configuration>
<siteXml>${basedir}/target/unit/sample-pmd/src/site/site.pre.xml</siteXml>
<siteXmlTarget>${basedir}/target/unit/sample-pmd/src/site/site.xml</siteXmlTarget>
<target>${basedir}/target/unit/sample-pmd/target/generated-xdocs/rules</target>
<rulesetsDirectory>${basedir}/target/unit/sample-pmd/src/main/resources/rulesets/</rulesetsDirectory>
<!-- The defined stubs -->
<project implementation="net.sourceforge.pmd.maven.stubs.ProjectStub"/>
</configuration>
<executions>
<execution>
<phase>pre-site</phase>
<goals>
<goal>pmd-pre-site</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
</dependencies>
</project>
@@ -47,4 +47,6 @@ public class JumbledIncrementerRule1 {
]]>
</example>
</rule>
<rule deprecated="true" ref="rulesets/java/codesize.xml/NPathComplexity"/>
</ruleset>
@@ -0,0 +1,58 @@
<?xml version="1.0"?>
<ruleset name="Code Size"
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>
The Code Size ruleset contains rules that find problems related to code size or complexity.
</description>
<rule name="NPathComplexity"
since="3.9"
message="The method {0}() has an NPath complexity of {1}"
class="net.sourceforge.pmd.lang.java.rule.codesize.NPathComplexityRule"
externalInfoUrl="${pmd.website.baseurl}/rules/java/codesize.html#NPathComplexity">
<description>
The NPath complexity of a method is the number of acyclic execution paths through that method.
A threshold of 200 is generally considered the point where measures should be taken to reduce
complexity and increase readability.
</description>
<priority>3</priority>
<example>
<![CDATA[
void bar() { // this is something more complex than it needs to be,
if (y) { // it should be broken down into smaller methods or functions
for (j = 0; j < m; j++) {
if (j > r) {
doSomething();
while (f < 5 ) {
anotherThing();
f -= 27;
}
} else {
tryThis();
}
}
}
if ( r - n > 45) {
while (doMagic()) {
findRabbits();
}
}
try {
doSomethingDangerous();
} catch (Exception ex) {
makeAmends();
} finally {
dontDoItAgain();
}
}
}
]]>
</example>
</rule>
</ruleset>
+5
View File
@@ -0,0 +1,5 @@
10-08-2012:
- Fix build: Update MANIFEST.MF Bundle-Version, add js-cvs-12122009.jar, use JDK 1.6 instead of 1.5. Also changed eclipse/plugins/org.eclipse.pde.build_3.8.0.v20110728/scripts/build.xml to set the builderDirectory using pathconvert. This is almost certainly the Wrong Way but has the advantage of working.
- Convert all tests from JUnit 3.x to 4.x.
- Make some failing tests pass.
-34
View File
@@ -1,34 +0,0 @@
Compilation
===========
'ant plugin' will generate a new version in the 'build' directory.
Setup
=====
If the default configuration is not accurate for your setup, customization
can be done in local.properties to point to the Eclipse installation directory
and the pde and launcher versions:
----- local.properties example -----------------
eclipse.home=/usr/java/eclipse
eclipse.pde.version=3.4.0.v20080604
eclipse.launcher.version=1.0.100.v20080509-1800
------ end -------------------------------------
Importing the projects in Eclipse
=================================
In the Java perspective, select "Import" -> "Existing Java projects", select
the directory where this file is located. The next panel should have four
projects:
net.sourceforge.pmd.eclipse
net.sourceforge.pmd.eclipse.plugin
pmd-eclipse-test
pmd-eclipse-test-fragment
+122
View File
@@ -0,0 +1,122 @@
PMD Eclipse Plugin
==================
Compilation
-----------
Simply run `mvn clean install`. The plugin's update site will be generated in
`net.sourceforge.pmd.eclipse.p2updatesite/target/repository`. You can use this directory as
an update site to install the new plugin version directly into your Eclipse.
Importing the projects in Eclipse
---------------------------------
Make sure you have the Maven Integration (m2e - http://eclipse.org/m2e/) installed. Then you can
import *Existing Maven Projects*.
You should see 6 projects:
* net.sourceforge.pmd.eclipse - that's the feature
* net.sourceforge.pmd.eclipse.p2updatesite - generates the update site
* net.sourceforge.pmd.eclipse.parent - the parent pom project
* net.sourceforge.pmd.eclipse.plugin - the actual plugin code
* net.sourceforge.pmd.eclipse.plugin.test - the (unit) tests for the plugin
* net.sourceforge.pmd.eclipse.plugin.test.fragment - an example extension of the plugin used during the tests
Releasing and updating the official eclipse update site
-------------------------------------------------------
# Pick a release BUILDQUALIFIER (e.g. v20130420-0001) and update versions
E.g. version is: "4.0.0" and BUILDQUALIFIER is "v20130420-0001".
The complete version of the plugin will be "4.0.0.v20130420-0001
export BUILDQUALIFIER=$(date -u +v%Y%m%d-%H%M) && echo $BUILDQUALIFIER
# Pick the version of the new release and the next development version
export VERSION=4.0.0
export NEXT=4.0.1
# Define the location of the local copy of the update site
export UPDATE_SITE_MIRROR=/location/of/local/update-site/
# Define your sourceforge login
export SFUSER=sf-user
# First get a copy of the current update site
rsync -avhP $SFUSER@web.sourceforge.net:/home/frs/project/pmd/pmd-eclipse/update-site/ $UPDATE_SITE_MIRROR
# Create a release branch
git branch pmd-eclipse-plugin-rb-$VERSION
# Update master branch to the next -SNAPSHOT version.
mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=$NEXT-SNAPSHOT
# Update versions in n.s.p.e.p2updatesite/category.xml
sed -i -e "s/$VERSION.qualifier/$NEXT.qualifier/" net.sourceforge.pmd.eclipse.p2updatesite/category.xml
# Update the ReleaseNotes with the release date and version and add a next version entry
vim ReleaseNotes.md
# Commit and push
git commit -a -m "Prepare next pmd-eclipse-plugin development version $NEXT-SNAPSHOT"
git push origin master
# Checkout the release branch
git checkout pmd-eclipse-plugin-rb-$VERSION
# update versions with the BUILDQUALIFIER
mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=$VERSION.$BUILDQUALIFIER
# Update versions in n.s.p.e.p2updatesite/category.xml
sed -i -e "s/$VERSION.qualifier/$VERSION.$BUILDQUALIFIER/" net.sourceforge.pmd.eclipse.p2updatesite/category.xml
# Update the ReleaseNotes with the release date and version
vim ReleaseNotes.md
# Commit and tag
git commit -a -m "Prepare release pmd-eclipse-plugin $VERSION.$BUILDQUALIFIER"
git tag pmd-eclipse-plugin/$VERSION.$BUILDQUALIFIER
# Build the plugin
mvn clean install -Ppublish-to-update-site -Declipse.updatesite.path=$UPDATE_SITE_MIRROR
# Test the new update site with eclipse - it should contain the new version
# If everything is fine, push the local changes
git push origin master
git push origin tag pmd-eclipse-plugin/$VERSION.$BUILDQUALIFIER
# upload the official update site
rsync -avhP $UPDATE_SITE_MIRROR $SFUSER@web.sourceforge.net:/home/frs/project/pmd/pmd-eclipse/update-site/
# Cleanup the release branch which was only needed during the release process
git checkout master
git branch -D pmd-eclipse-plugin-rb-$VERSION
Finally announce the new plugin version in the news section of SF: <https://sourceforge.net/p/pmd/news/>.
You can use the following template:
PMD for Eclipse $VERSION released
A new PMD for Eclipse plugin version has been released.
It is available via the update site: <https://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/>
* Release Notes: <https://github.com/pmd/pmd/blob/pmd-eclipse-plugin/$VERSION/pmd-eclipse-plugin/ReleaseNotes.md>
Updating the used PMD version
-----------------------------
The parent pom contains the property `pmd.version`. This is used inside the plugin module, to resolve the dependencies.
In order to change the PMD version, change this property and rebuild (`mvn clean package`). In case PMD has some
changed (added/removed) transitive dependencies, you'll need to update `n.s.p.e.plugin/META-INF/MANIEFEST.MF` as well.
All transitive dependencies are copied into the folder `n.s.p.e.plugin/target/lib` during the build.
Useful References
-----------------
* <http://wiki.eclipse.org/Equinox/p2/Publisher>
* <http://wiki.eclipse.org/Equinox_p2_Repository_Mirroring>
* <http://wiki.eclipse.org/Category:Tycho>
* <http://wiki.eclipse.org/Tycho/Additional_Tools>
* <http://codeiseasy.wordpress.com/2012/07/26/managing-a-p2-release-repository-with-tycho/>
* <http://wiki.eclipse.org/Tycho/Demo_Projects>
* <http://wiki.eclipse.org/Tycho/Reference_Card>
* <http://eclipse.org/tycho/sitedocs/index.html>
* <https://docs.sonatype.org/display/M2ECLIPSE/Staging+and+releasing+new+M2Eclipse+release>
* <http://wiki.eclipse.org/Tycho/Packaging_Types>
* <http://wiki.eclipse.org/Tycho/Reproducible_Version_Qualifiers>
* <http://www.vogella.com/articles/EclipseTycho/article.html>
* <http://git.eclipse.org/c/tycho/org.eclipse.tycho-demo.git/tree/itp01/tycho.demo.itp01.tests/pom.xml>
* <http://www.sonatype.com/people/2008/11/building-eclipse-plugins-with-maven-tycho/>
* <http://zeroturnaround.com/labs/building-eclipse-plug-ins-with-maven-3-and-tycho/>
* <https://github.com/open-archetypes/tycho-eclipse-plugin-archetype>
* <http://wiki.eclipse.org/Tycho/How_Tos/Dependency_on_pom-first_artifacts>
+52
View File
@@ -0,0 +1,52 @@
# PMD For Eclipse - Release Notes
Installation instructions: <http://pmd.sourceforge.net/eclipse/>
Eclipse Update Site: <https://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/>
## 31-October-2013: 4.0.2.v20131031-1124
* Fixed Plugin does not execute custom xpath rules ([bug #1132])
* Fixed After changing exclude filters violations are not cleared ([bug #1148])
[bug #1132]: https://sourceforge.net/p/pmd/bugs/1132/
[bug #1148]: https://sourceforge.net/p/pmd/bugs/1148/
## 11-August-2013: 4.0.1.v20130811-0001
* Updated PMD to 5.0.5
* Fixed Build path exclusions not honored ([bug #988])
* Fixed right click to add reviewed comment missing ([bug #1052])
* Fixed PMD Eclipse: How to ... documentation missing ([bug #1061])
* Fixed Properties page: "Rule-Selection" should be disabled if project-local config is selected ([bug #1070])
* Fixed Violations are reported multiple times ([bug #1071])
* Fixed Exclude pattern does not work ([bug #1079])
* Fixed SWTError: No more handles on Violation Outline View ([bug #1096])
* Fixed Selecting non-duplicates during import doesn't work. ([bug #1110])
* Fixed Eclipse log file will not be filled ([bug #1112])
* Fixed PMD Eclipse plugin doesn't analyze project if it has non-existing source folders ([bug #1116])
* Fixed An internal error occurred during: "RenderReport" ([bug #1117])
* The official update site is now: <https://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/>
[bug #988]: https://sourceforge.net/p/pmd/bugs/988/
[bug #1052]: https://sourceforge.net/p/pmd/bugs/1052/
[bug #1061]: https://sourceforge.net/p/pmd/bugs/1061/
[bug #1070]: https://sourceforge.net/p/pmd/bugs/1070/
[bug #1071]: https://sourceforge.net/p/pmd/bugs/1071/
[bug #1079]: https://sourceforge.net/p/pmd/bugs/1079/
[bug #1096]: https://sourceforge.net/p/pmd/bugs/1096/
[bug #1110]: https://sourceforge.net/p/pmd/bugs/1110/
[bug #1112]: https://sourceforge.net/p/pmd/bugs/1112/
[bug #1116]: https://sourceforge.net/p/pmd/bugs/1116/
[bug #1117]: https://sourceforge.net/p/pmd/bugs/1117/
## 10-May-2013: 4.0.0.v20130510-1000
* Updated PMD to 5.0.4
* Fixed False Positive: LocalVariableCouldBeFinal ([bug #1075])
[bug #1075]: http://sourceforge.net/p/pmd/bugs/1075/
Loaded 30 of 1198 files, more files were not shown because too many files have changed in this diff. Show more