Compare commits

...
Author SHA1 Message Date
Andreas Dangel 59b360a60a [maven-release-plugin] prepare release pmd_releases/6.2.0 2018-03-26 09:23:14 +02:00
Andreas Dangel a9dfd6e218 Prepare pmd release 6.2.0 2018-03-26 09:17:36 +02:00
Andreas Dangel 3bcecddbb0 Merge branch 'pr-986' 2018-03-26 09:03:24 +02:00
Juan Martín Sotuyo Dodero 7ef2168eae Merge branch 'pr-958' 2018-03-25 23:39:14 -03:00
Juan Martín Sotuyo Dodero a895d9d3d9 Update changelog, refs #958 2018-03-25 23:37:37 -03:00
BBG 9d9fa22c31 Issue #956: fixed comments 2018-03-25 14:06:43 +08:00
Clément Fournier ea700d84ec Fix designer 2018-03-24 23:48:46 +01:00
Travis CI (pmd-bot) 3f1c441a5c Update documentation 2018-03-24 21:31:12 +00:00
Clément Fournier dbcaf663f4 Fix CompareObjectsWithEquals 2018-03-24 22:17:59 +01:00
Andreas Dangel 14d474f333 Merge branch 'pr-991'
Closes #974
2018-03-24 22:13:37 +01:00
Andreas Dangel 8dfef6c165 Update changelog, refs #974 2018-03-24 22:13:27 +01:00
Clément Fournier ee85254bd0 Merge branch 'master' 2018-03-24 19:05:13 +01:00
Clément Fournier a193af1d4a Use auxclasspath ClassLoader to resolve type qualified names 2018-03-24 19:03:29 +01:00
BBG f0ed81751a Issue #956: add AbstractJavaAnnotatableNode class 2018-03-24 18:39:22 +08:00
BBG f86ca456a0 Issue #956: fixed comments 2018-03-24 18:39:22 +08:00
BBG 7616f8b7a8 Issue #956: Refactor ignoredAnnotationsDescripror in AbstractIgnoredAnnotRule class 2018-03-24 18:39:22 +08:00
BBG e654c265a9 Issue #956: fixed comment 2018-03-24 18:39:21 +08:00
BBG 6888806e12 Fixed issue956 2018-03-24 18:39:21 +08:00
Juan Martín Sotuyo Dodero cec32a8508 Merge branch 'pr-996' 2018-03-23 11:23:31 -03:00
Andreas Dangel 579914fb7e Delete old dogfood rulesets 2018-03-23 10:33:41 +01:00
Andreas Dangel f9ef2c8c4b Remove maven profile jdk8-modules and enable all modules by default
We are now enforcing java9 for building, so these modules are anyway
enabled always
2018-03-23 10:23:56 +01:00
Andreas Dangel f335e83043 Cleanup pom.xml files 2018-03-23 10:21:16 +01:00
Andreas Dangel 6cd084b7ce Use release build-tools 1.1.0: uses latest dogfood ruleset
Closes #361
2018-03-23 10:12:38 +01:00
Juan Martín Sotuyo Dodero f00a085087 Merge branch 'pr-987' 2018-03-22 11:51:14 -03:00
Clément Fournier 5ebde0a0e9 Update changelog, refs #993
Closes #992
2018-03-22 15:05:20 +01:00
Clément Fournier d4c5bd011c Merge branch 'pr-993' 2018-03-22 15:03:40 +01:00
Clément Fournier 89db6fe71d Structure improvement 2018-03-22 15:02:53 +01:00
Clément Fournier d699c277ea Update release notes, refs #989
Closes #978
2018-03-22 14:41:13 +01:00
Clément Fournier b969974653 Merge branch 'pr-989' 2018-03-22 14:40:40 +01:00
Clément Fournier dba594353f Fix link and grammar 2018-03-22 14:35:44 +01:00
Andreas Dangel f2c8b5e2e8 Make the project be importable by IntelliJ IDEA
See https://youtrack.jetbrains.com/issue/IDEA-188690
2018-03-21 21:54:31 +01:00
Bolarinwa Saheed 08f1fea25b Update writing_documentation.md to fix Issue #992 2018-03-21 19:22:15 +01:00
Travis CI (pmd-bot) d865fb4627 Update documentation 2018-03-21 16:11:04 +00:00
Clément Fournier e6e07d22b4 Merge branch 'pr-990' 2018-03-21 16:59:48 +01:00
Clément Fournier da8969ecb7 Update release notes, refs #990
Closes #832
2018-03-21 16:55:58 +01:00
Clément Fournier 6c9c229516 Remove one example
That example would have been flagged by the rule
2018-03-21 16:52:13 +01:00
Bolarinwa Saheed 3e24180da1 Moved all the description inside a single CDATA tag 2018-03-21 14:17:27 +01:00
Travis CI (pmd-bot) 482cb01d7c Update documentation 2018-03-20 22:56:50 +00:00
Clément Fournier b52bd878f6 Update the description of MissingOverride 2018-03-20 23:43:15 +01:00
Bolarinwa Saheed 8f54d451d9 Extended the documentation with some markdown inline 2018-03-20 21:58:38 +01:00
Bolarinwa Saheed 87aafcc8ef Added link to Writing Documentation (Dev Docs) 2018-03-20 20:25:43 +01:00
Bolarinwa Saheed e04f7c2d4f Update design.xml - AvoidThrowingNullPointerException to close Issue #832 2018-03-20 19:54:19 +01:00
Bolarinwa Saheed d3aa3df15e Revert "Doc on AvoidThrowingNullPointerException updated to close Issue #832"
This reverts commit e27dad1862.
2018-03-20 17:58:17 +01:00
Clément Fournier 603a306370 Deprecate former rules, update changelog 2018-03-20 17:47:09 +01:00
Clément Fournier 67acede81f Report multiple blocks under case label 2018-03-20 17:47:09 +01:00
Clément Fournier b4b52e037b Revert "Refine case statement treatment"
This reverts commit 580560c28c56cb57ca5350f9035856b1362400ec.
2018-03-20 17:47:09 +01:00
Clément Fournier 1ae8b1c8e6 Refine case statement treatment
Every dangling unbraced statement will be flagged individually
This complexifies the expression, and still ignores some cases, eg:
  case 3:
    {
      x++;
    }
    {
      y++;
      break;
    }

in which the label should be flagged anyway
2018-03-20 17:47:09 +01:00
Clément Fournier 2711d88e3c Add support for case stmts
A case label is flagged if one of its subordinate
    statements is not braced. The message could be more
    explicit, eg, if we flagged the unbraced statement
    instead of the label in case part of the label's
    statements are braced
2018-03-20 17:46:54 +01:00
Clément Fournier ac3e59a4b7 Add new rule ControlStatementBraces 2018-03-20 17:45:44 +01:00
Bolarinwa Saheed e27dad1862 Doc on AvoidThrowingNullPointerException updated to close Issue #832 2018-03-20 15:45:39 +01:00
Bolarinwa Saheed 55c34feb97 Update Contibute.md to close Issue #978 2018-03-20 14:09:17 +01:00
Clément Fournier 045308948a Fix pmd-java8 tests 2018-03-20 14:07:33 +01:00
Clément Fournier 73f6b2f6cf Fix compilation + checkstyle + pmd 2018-03-20 13:46:45 +01:00
Clément Fournier 9ff4636194 Add getPrintableName to MethodLikeKind 2018-03-19 15:41:56 +01:00
Clément Fournier 0ebd2ba35c Hide ImmutableList, exposing List instead 2018-03-19 15:23:44 +01:00
Clément Fournier 0f61f2576d Move qname classes into another package 2018-03-19 14:25:00 +01:00
Clément Fournier 26e97032ef Minor changes 2018-03-19 14:25:00 +01:00
Clément Fournier 4154a5931e Add qname resolution step to the designer 2018-03-19 14:25:00 +01:00
Clément Fournier ccc1443373 Use JavaQualifiedName to resolve anonymous classes types in ClassTypeResolver
Success! We still need to figure out a straightforward bridge between JavaTypeDefinition and qualified names
2018-03-19 14:25:00 +01:00
Clément Fournier eb8908796c Allow TypeQualifiedNames to resolve their own type lazily
This could allow us to share the JavaQualifiedName implementations
with type resolution
2018-03-19 14:25:00 +01:00
Clément Fournier 1f1637bafd Split JavaQualifiedName into type and operation specific subclasses 2018-03-19 14:24:56 +01:00
Clément Fournier 3c8fcfa6c2 Cleanup QualifiedNameFactory 2018-03-19 14:05:51 +01:00
Clément Fournier 0bba8a2249 Resolve all MethodLike qnames 2018-03-19 14:05:51 +01:00
Clément Fournier 134d529442 Consider anonymous classes
* ASTAllocationExpression and ASTEnumConstant implement JavaQualifiableNode
* It's not satisfying yet, too much code duplication. They should  be
considered by the metrics framework. A good solution would be to add a
new node (see #905)
2018-03-19 14:05:51 +01:00
Clément Fournier 06e38128c4 Wire the visitor into SourceCodeProcessor
We need a way to configure which visitors are run on nodes
obtained from ParserTstUtil
2018-03-19 14:05:51 +01:00
Clément Fournier ba3611f241 Add visitor to populate qualified names
* Currently populates ASTAnyTypeDeclarations with their qname
* Package tails are shared
2018-03-19 14:05:51 +01:00
Juan Martín Sotuyo Dodero 36ac7ddd4c Merge branch 'pr-975' 2018-03-19 01:39:06 -03:00
Juan Martín Sotuyo Dodero 4254fb3f15 Merge branch 'pr-895' 2018-03-19 01:33:07 -03:00
Juan Martín Sotuyo Dodero 1301a3821b Update changelog, refs #895 2018-03-19 01:32:52 -03:00
Travis CI (pmd-bot) 5d2ed89dc1 Update documentation 2018-03-18 15:43:17 +00:00
Juan Martín Sotuyo Dodero acd365ad98 Add new rule to release ruleset 2018-03-18 12:32:04 -03:00
Juan Martín Sotuyo Dodero 2a6a3c5832 Merge branch 'pr-984' 2018-03-18 12:28:38 -03:00
Juan Martín Sotuyo Dodero 0f63ac9131 Update changelog, refs #984 2018-03-18 12:28:19 -03:00
Kirk Clemens 1bd44a3b52 issue983 Update rule to use rule chain pattern 2018-03-17 22:55:04 -05:00
Kirk Clemens 844ab0e6d4 issue983 Add a new test case for an annotation with a single non value element 2018-03-17 19:38:40 -05:00
Kirk Clemens 313da24a71 issue983 Remove pom changes checked in by mistake 2018-03-17 19:37:07 -05:00
Kirk Clemens 28f292f736 issue983 Add new UnnecessaryAnnotationValueElement rule 2018-03-17 19:33:49 -05:00
Clément Fournier c967e63e6a Merge branch 'master', fix merge conflicts 2018-03-13 16:15:44 +01:00
Clément Fournier 58f76f054e Use javadoc @deprecated for ASTConstructorDeclaration.getParameters 2018-03-13 16:13:39 +01:00
Clément Fournier 92da9faee4 Fix pmd warnings 2018-03-13 00:33:37 +01:00
Andreas Dangel b6c84e2ba3 [java] Remove new method getFormalParameters to preserve API compatibility
Refs #912
Refs #881
2018-03-12 20:38:38 +01:00
Clément Fournier 9eb79af16b Update docs 2018-03-12 01:01:58 +01:00
Clément Fournier e643da230d Merge branch 'master' 2018-03-12 00:36:56 +01:00
Travis CI (pmd-bot) f25e35f42d Update documentation 2018-03-11 09:50:28 +00:00
Andreas Dangel d27273581f Fix PMD / Checkstyle issues 2018-03-11 10:32:37 +01:00
Andreas Dangel f4441ce938 Merge branch 'pr-912' 2018-03-11 10:15:28 +01:00
Andreas Dangel 96446f384b Update release notes, new rule MissingOverride, refs #912 2018-03-11 10:07:51 +01:00
Andreas Dangel 4514e6fb19 Update versions for new classes 2018-03-11 10:07:11 +01:00
Juan Martín Sotuyo Dodero 451815bf0a Merge branch 'pr-954' 2018-03-11 02:23:26 -03:00
Juan Martín Sotuyo Dodero 1577931fe3 Update changelog 2018-03-11 02:21:59 -03:00
Juan Martín Sotuyo Dodero 5ead2eda16 Use TemporaryFolder instead 2018-03-11 02:16:01 -03:00
Juan Martín Sotuyo Dodero 53e11481dc Merge branch 'pr-952' 2018-03-11 01:41:22 -03:00
Juan Martín Sotuyo Dodero 75b74afe8d Update changelog, refs #952 2018-03-11 01:40:28 -03:00
Juan Martín Sotuyo Dodero 136d147210 Use positive checks 2018-03-11 01:38:29 -03:00
Juan Martín Sotuyo Dodero 309a2a4924 Merge branch 'pr-951' 2018-03-11 01:28:54 -03:00
Juan Martín Sotuyo Dodero 8f5b2a04b8 Update changelog, refs #951 2018-03-11 01:26:19 -03:00
Clément Fournier 6943803ccb Merge branch 'pr-908' 2018-03-11 01:59:55 +01:00
Juan Martín Sotuyo Dodero df2677457c Use relative links in docs 2018-03-10 18:23:19 -03:00
Juan Martín Sotuyo Dodero 161d7be37e Update broken links in doc 2018-03-10 17:30:19 -03:00
Juan Martín Sotuyo Dodero 05ab784d0b Merge branch 'pr-969' 2018-03-10 17:16:51 -03:00
Juan Martín Sotuyo Dodero 20cddf5079 Update changelog, refs #969 2018-03-10 17:16:12 -03:00
Juan Martín Sotuyo Dodero 185fd15953 Refactor lombok check into separate method 2018-03-10 17:13:25 -03:00
Andreas Dangel d6ccc58f20 Corrections from PR review (#908), make the metrics visitors extendable again 2018-03-10 20:52:11 +01:00
Juan Martín Sotuyo Dodero 5ba5082ae2 Merge branch 'pr-965' 2018-03-10 16:49:13 -03:00
Juan Martín Sotuyo Dodero 7a0a31b149 Update changelog, refs #963 2018-03-10 16:47:56 -03:00
Clément Fournier 9766e632a9 Remove breaking API changes of JavaQualifiedName
Checked with japicmp
2018-03-10 19:20:02 +01:00
Clément Fournier 2fd5d7c41b Remove breaking binary changes with metrics framework
Spotted using japicmp
2018-03-10 18:49:48 +01:00
Clément Fournier 110c8db6e0 Update release notes, refs #970 2018-03-10 17:13:35 +01:00
Clément Fournier c88641fa5c Merge branch 'pr-970' 2018-03-10 17:11:27 +01:00
epidemia 87f2403ec3 Remove unused import 2018-03-10 16:43:59 +03:00
epidemia 6e2b75e245 Fixed inefficient use of keySet iterator instead of entrySet iterator for pdm-java 2018-03-10 16:35:43 +03:00
epidemia 219b80a13b Fixed inefficient use of keySet iterator instead of entrySet iterator for pdm-java 2018-03-10 16:03:19 +03:00
Clément Fournier e592d4baf2 Update release notes, refs #967 2018-03-10 13:50:51 +01:00
Clément Fournier 75ecf7b66f Merge branch 'pr-967' 2018-03-10 13:47:43 +01:00
Clément Fournier 4053e548bf Fix link 2018-03-10 13:47:31 +01:00
Andreas Dangel 8bd1e3b486 Fix PMD dogfood: UncommentedEmptyMethodBody, SimplifyBooleanReturns,
UnnecessaryLocalBeforeReturn, OptimizableToArrayCall,
ClassWithOnlyPrivateConstructorsShouldBeFinal,
UseLocaleWithCaseConversions, NonStaticInitializer, UseCollectionIsEmpty
2018-03-10 12:04:50 +01:00
Kirk Clemens d0ba8998e7 Minor code cleanup 2018-03-09 23:22:49 -06:00
Kirk Clemens d94ff95db8 Fix checkstyle issues 2018-03-09 23:02:29 -06:00
Kirk Clemens 9938a4491c Issue 968 Add logic to handle lombok private constructors with utility classes 2018-03-09 22:53:14 -06:00
epidemia 4c76a7f695 Issue 959: fixed broken link to XPath Rule Tutorial 2018-03-09 18:55:52 +03:00
Andreas Dangel 5b93b14373 Fix PMD dogfood: AssignmentInOperand, LooseCoupling 2018-03-09 16:28:14 +01:00
Stephen 264403b354 Make Varargs trigger ArrayIsStoredDirectly
fixes #963
2018-03-09 07:05:13 -08:00
Andreas Dangel c85abd258a Fix PMD dogfood: AvoidPrefixingMethodParameters, UnnecessaryConstructor,
AvoidUsingShortType
2018-03-09 16:04:15 +01:00
Andreas Dangel 9fb3206d9e PMD dogfood: Upgrade PMD to 6.1.0 2018-03-09 13:00:52 +01:00
Andreas Dangel cf88117820 Fix PMD dogfood: UnusedFormalParameter, UselessParentheses and UselessOverridingMethod 2018-03-09 12:52:20 +01:00
Andreas Dangel b8a34eda97 TypeHelper: Remove misleading warning of incomplete auxclasspath
*   Failing to resolve a class in that situation might happen, since
    we use it to probe types
*   Simplify AbstractJUnitRule
2018-03-09 11:22:15 +01:00
Andreas Dangel f452adbf6a Fix PMD dogfood: SimplifiedTernary 2018-03-09 10:26:23 +01:00
Andreas Dangel 5972c32ecf Fix checkstyle 2018-03-09 10:01:00 +01:00
Andreas Dangel fb4d564e8b Fix PMD dogfood: AvoidBranchingStatementAsLastInLoop 2018-03-09 09:58:04 +01:00
Andreas Dangel f3a358c419 Fix PMD dogfood: EmptyCatchBlock 2018-03-09 09:58:04 +01:00
Andreas Dangel 7aaa9966c2 Fix PMD dogfood: AvoidCatchingThrowable
Refs #361
2018-03-09 09:57:15 +01:00
Andreas Dangel 4ace14899c Fix PMD dogfood: UnusedPrivateField
Refs #361
2018-03-09 09:57:15 +01:00
Andreas Dangel e9abdf7a92 Update pmd configuration to use dogfood and fail build on violations
Refs #361
2018-03-09 09:53:15 +01:00
Clément Fournier ca4500b40b Delete multi property, add tests 2018-03-06 23:42:41 +01:00
Clément Fournier 9fcf146241 Add RegexMultiProperty 2018-03-06 23:41:32 +01:00
Clément Fournier d489698157 Add RegexProperty 2018-03-06 23:40:56 +01:00
Clément Fournier f60a64adb8 checkstyle 2018-03-05 22:25:26 +01:00
Clément Fournier 3d5a0aa4c6 Cleanup 2018-03-05 22:14:57 +01:00
Clément Fournier f8864e9060 Make real Ant test cases 2018-03-05 21:58:05 +01:00
Clément Fournier f74a6b3887 Update release notes 2018-03-05 20:56:48 +01:00
Clément Fournier 5d590a259e Add basic Ant test cases, correct behaviour 2018-03-05 20:52:39 +01:00
Clément Fournier 07a9859ce3 Update Ant task and user docs 2018-03-05 17:15:08 +01:00
Clément Fournier ff1c90d753 Some corrections for PR #954 2018-03-05 16:47:34 +01:00
Clément Fournier 0967d50275 Merge branch 'pr-950' 2018-03-05 14:42:21 +01:00
Clément Fournier e2c6f1e467 Add '-no-cache' CLI switch, to disable incremental analysis
- The switch discards the argument provided to '-cache' if any
- Using the switch disables the suggestion to use incremental analysis
- Rule tests use that option to avoid the warning, which clutters build logs
- Refs #946
2018-03-05 13:47:48 +01:00
BBG 4e2aee3da3 Issue #839: SignatureDeclareThrowsException's IgnoreJUnitCompletely property not honored for constructors 2018-03-04 22:03:58 +08:00
BBG 92031b1792 Add ignoredAnnotations ptoperty to unusedPrivateMethod rule 2018-03-04 21:32:19 +08:00
Juan Martín Sotuyo Dodero 30afff46c6 [java] Avoid a NPE in Type Resolution
- If a class extends a class that references / extends a missing class,
it's possible for the `NoClassDefFoundError` to only rise once we call
`isAnonymousClass()` on the `Class`.
 - For consistency with missing classes, we set the type to null.
 - Logging such missing classes is still pending #194
2018-03-04 03:46:05 -03:00
Travis CI (pmd-bot) dc4f6b180b Update documentation 2018-03-04 00:22:50 +00:00
Clément Fournier e43e7316a7 Merge branch pr-943 2018-03-04 01:06:45 +01:00
Clément Fournier 534d0b62f2 Update release notes, refs #943
Closes #907
2018-03-04 00:57:13 +01:00
Clément Fournier c96358506b Minor cleanups 2018-03-04 00:52:00 +01:00
Clément Fournier ba8aeaf648 Use abstract class + interface for AnyTypeDeclaration hierarchy
Remove one breaking API change
2018-03-04 00:37:04 +01:00
Clément Fournier c9cfb1f29f Rename MethodLike to MethodLikeNode 2018-03-04 00:37:01 +01:00
Clément Fournier 0ef1955080 Use abstract class + interface for MethodLike hierarchy
Removes a breaking API change
2018-03-04 00:36:21 +01:00
Juan Martín Sotuyo Dodero fdd399393d Update changelog, refs #941 2018-03-03 17:08:07 -03:00
Juan Martín Sotuyo Dodero 0e4a793dd3 Merge branch 'pr-941' 2018-03-03 17:06:56 -03:00
Juan Martín Sotuyo Dodero a802fafb29 Merge branch 'pr-948' 2018-03-03 16:02:45 -03:00
Juan Martín Sotuyo Dodero 1415d283bc Merge branch 'pr-947' 2018-03-03 16:01:53 -03:00
BBG 8b279fac25 fixes #907 2018-03-03 22:01:21 +08:00
Andreas Dangel 65a5d3f835 [java] Migrate internal rulesets used in unit tests
Avoiding deprecation warnings
References #946
2018-03-03 11:53:22 +01:00
Andreas Dangel 5a5977b1ea Update release notes, fixes #928 2018-03-02 20:34:34 +01:00
Andreas Dangel d6508c1b28 Fix checkstyle 2018-03-02 20:26:36 +01:00
Andreas Dangel c94b3790bf Upgrade checkstyle, use pmd-build-tools 1.1.0-SNAPSHOT 2018-03-02 20:24:48 +01:00
Clément Fournier 57e050f8c5 Fix typo 2018-03-02 18:34:46 +01:00
reudismam e1b954289a Use char notation to represent a character to improve performance. 2018-02-26 19:40:40 -03:00
Juan Martín Sotuyo Dodero c8cd8e1fa8 Changelog update, Add more details about changes in Rhino 2018-02-25 19:29:23 -03:00
Juan Martín Sotuyo Dodero 502e96e3a3 Merge branch 'pr-930' 2018-02-25 19:27:02 -03:00
Juan Martín Sotuyo Dodero 5bf8945f99 Merge branch 'pr-937' 2018-02-25 19:24:52 -03:00
Andreas Dangel 8947876dab Update release script to follow documented release procedure 2018-02-25 12:05:56 +01:00
Andreas Dangel 67a9f84a9c Fix release script 2018-02-25 10:04:45 +01:00
Andreas Dangel b71857e02b Prepare next development version 2018-02-25 10:00:22 +01:00
Andreas Dangel 098b0dcac0 [maven-release-plugin] prepare for next development iteration 2018-02-25 09:53:26 +01:00
Andreas Dangel 101b71a13e [maven-release-plugin] prepare release pmd_releases/6.1.0 2018-02-25 09:53:19 +01:00
Andreas Dangel 17e991b662 Prepare pmd release 6.1.0 2018-02-25 09:45:42 +01:00
Andreas Dangel 84e388cdf2 Merge branch 'pr-801' 2018-02-24 22:42:20 +01:00
Andreas Dangel 6b4962e479 Update release notes, refs #801 2018-02-24 22:41:36 +01:00
Andreas Dangel 039e4157e8 Merge branch 'pr-931' 2018-02-24 21:40:02 +01:00
Andreas Dangel 3c280b8ef2 Use Files.move instead of File.renameTo
This prevents problems when building PMD under Windows
2018-02-24 20:40:38 +01:00
Andreas Dangel 8f6f8e9842 Corrections for PR #931 2018-02-22 08:54:29 +01:00
Andreas Dangel cc08bd47cf [java] UnusedImports false positive for static import
Fixes #925
2018-02-21 20:43:14 +01:00
Andreas Dangel d619fd360d [ecmascript] Update rhino to 1.7.7.2
Refs #699
2018-02-21 19:56:20 +01:00
Travis CI (pmd-bot) bff93c53fb Update documentation 2018-02-20 17:01:00 +00:00
Juan Martín Sotuyo Dodero 97d8893b43 Merge branch 'pr-927' 2018-02-20 13:47:14 -03:00
Juan Martín Sotuyo Dodero 906c162d04 Update changelog, refs #927 2018-02-20 13:46:43 -03:00
Andreas Dangel 09f871d92e Merge branch 'pr-918', fixes #909 2018-02-20 08:36:59 +01:00
Andreas Dangel 25421ba340 Update release notes, refs #918, refs #909 2018-02-20 08:35:49 +01:00
wata727 8127b3c8e3 Fix example of AbstractClassWithoutAnyMethod 2018-02-20 14:45:22 +09:00
Travis CI (pmd-bot) 23b25056f0 Update documentation 2018-02-20 04:51:36 +00:00
Juan Martín Sotuyo Dodero e6bf9f031f Merge branch 'pr-926' 2018-02-20 01:40:06 -03:00
Juan Martín Sotuyo Dodero 90095480b0 Merge branch 'pr-924' 2018-02-20 01:37:10 -03:00
Clément Fournier a6d3c2baa1 Miscellaneous cleanups 2018-02-20 01:24:23 +01:00
Clément Fournier 1c991dd79e Fix property test random crash 2018-02-20 01:24:02 +01:00
Clément Fournier 3257aeae4f Corrections for PR #912 2018-02-20 00:34:15 +01:00
Akshat Bahety e2f37d4d97 Indentation
changed to 8 spaces for qa plugin.
2018-02-20 04:20:55 +05:30
Andreas Dangel acf6a31bed [java] ConsecutiveLiteralAppends with types other than string
*   Updated documentation to include also non-string literals
*   Added additional test cases
*   Fixes #541
2018-02-19 20:03:31 +01:00
Juan Martín Sotuyo Dodero b6a8402dc7 Merge branch 'pr-923' 2018-02-18 20:22:21 -03:00
Andreas Dangel 73de6eb1f0 [ci] Use Java9 for building PMD
Fixes #854
2018-02-18 21:49:25 +01:00
Juan Martín Sotuyo Dodero 1c9a4fd31c Merge branch 'pr-922' 2018-02-18 17:36:57 -03:00
Andreas Dangel 394948624f Update release notes, fixes #853 2018-02-18 20:37:59 +01:00
Andreas Dangel 18c79a34f4 Fix deprecations 2018-02-18 20:25:42 +01:00
Andreas Dangel 2087dd9472 Fix integration test - scala is now active always 2018-02-18 20:24:04 +01:00
Andreas Dangel 9392239c45 scala update, part 2
* Update to new scala API
* remove comments support which was not used anyway
* Use scala-maven-plugin to generate javadoc
2018-02-18 20:23:32 +01:00
Andreas Dangel 74ae8d0d6e Remove profile jdk9-disabled - scala is now active always 2018-02-18 19:07:37 +01:00
Andreas Dangel fc21190bb7 scala update, part 1 2018-02-18 18:52:07 +01:00
Andreas Dangel 9c007afb57 Fixes #795
Merge branch 'pr-919'
2018-02-18 18:40:33 +01:00
Andreas Dangel 9fbaa835ab Fix typo, add removal version for deprecated interfaces/classes 2018-02-18 18:40:25 +01:00
Andreas Dangel 7997e16f1b Merge branch 'pr-920' 2018-02-18 18:35:22 +01:00
Andreas Dangel aac36cb11e Update release notes, refs #920 2018-02-18 18:35:12 +01:00
Juan Martín Sotuyo Dodero 32af9cabf2 [java] Update valid identifiers
- Newer Java versions have allowed for a lot more tokens in identifiers
2018-02-18 04:44:27 -03:00
Juan Martín Sotuyo Dodero 21d02f90af Remove unused import 2018-02-18 04:37:44 -03:00
Juan Martín Sotuyo Dodero 6d1a8888a9 Update changelog, refs #795 2018-02-17 21:45:15 -03:00
Juan Martín Sotuyo Dodero 1c68248eee Update tests 2018-02-17 21:39:59 -03:00
Juan Martín Sotuyo Dodero 46aa1e2f2a Remove usages of deprecated classes 2018-02-17 21:39:10 -03:00
Juan Martín Sotuyo Dodero 08560add78 Deprecate FileReporter 2018-02-17 21:38:39 -03:00
Juan Martín Sotuyo Dodero 33626e7a2d Implement new renderer for CPD
- Write directly to writers, don't handle strings
2018-02-17 21:37:51 -03:00
Juan Martín Sotuyo Dodero 78890afe13 Merge branch 'pr-884' 2018-02-17 17:32:52 -03:00
Juan Martín Sotuyo Dodero cdb28f72ff Update changelog 2018-02-17 17:32:09 -03:00
Juan Martín Sotuyo Dodero 0253a0c615 Merge branch 'pr-916' 2018-02-17 17:25:54 -03:00
Travis CI (pmd-bot) 94bb23d22c Update documentation 2018-02-17 17:30:18 +00:00
Juan Martín Sotuyo Dodero 123f2139b9 Merge branch 'pr-914' 2018-02-17 14:17:04 -03:00
Juan Martín Sotuyo Dodero 1992a0d33b Update changelog, refs #914 2018-02-17 14:16:47 -03:00
Juan Martín Sotuyo Dodero f4c7cc70bc Merge branch 'pr-901' 2018-02-17 14:13:55 -03:00
Juan Martín Sotuyo Dodero 99d853c39d Update changelog, refs #901 2018-02-17 14:13:32 -03:00
Juan Martín Sotuyo Dodero f62fe38d97 Minor cleanups 2018-02-17 14:12:23 -03:00
Akshat Bahety d2fb476eae Docs Updated qa-Eclipse
Added a qa-Eclipse plugin to the table.
2018-02-17 12:28:11 +05:30
Clément Fournier 22596e5176 Add ghost production for TypeAnnotation to cleanup the grammar
Type annotations can be nearly everywhere since Java 8, which makes the grammar
really hard to read when the check for correct jdk version is repeated all over
the place.
2018-02-16 23:53:37 +01:00
Clément Fournier c401e2cbc6 Move boilerplate to an abstract class 2018-02-16 15:31:52 +01:00
Clément Fournier d25fbcf8c0 Remove unnecessary javadoc 2018-02-16 00:25:06 +01:00
Clément Fournier f2ba4e442c Update FormalParameter type resolution for varargs 2018-02-15 23:58:20 +01:00
Clément Fournier 4e3f1395e4 Consider return type covariance 2018-02-15 11:58:02 +01:00
Clément Fournier 6440d043c8 Cleanup, ensure no false positive 2018-02-15 02:33:33 +01:00
Clément Fournier ab634bf720 Consider Object methods inherited into interfaces 2018-02-15 01:15:33 +01:00
Akshat Bahety 997a1f61fa Documentation Updated
As written in issue #891 apex uses Single Quotes ' ' instead of Double " "
Updated the document to represent the same to the user.
2018-02-15 05:32:47 +05:30
Clément Fournier 8884599f8d Consider varargs parameters 2018-02-15 00:12:21 +01:00
Clément Fournier 64a7e3780e Use bridge method as cue to which method is overridden
This adds support for methods inherited from a supertype with type parameters.
Overloads of the inherited (bridged) methods defined in the subclass
with the same number of parameters still go undetected.

RuleViolationComparator contains a good example of this: the two compare
methods compile to three methods: compare(RV,RV), compare(String,String)
and a bridge method compare(Object,Object). But short of doing more
complicated analysis on the type parameters (or reading the bytecode),
there is no way to determine whether the bridge delegates to the
compare(String,String) or compare(RV,RV), so we can't know which is
overridden.

Another corner case is the following:
public <V> void setProperty(MultiValuePropertyDescriptor<V> propertyDescriptor, V... values)

in AbstractDelegateRule, inherited from Rule. I don't know yet why it's
not detected.
2018-02-14 19:40:29 +01:00
Clément Fournier f330007278 Change algorithm to explore hierarchy only once, avoid exploring same classes twice 2018-02-14 17:32:19 +01:00
Clément Fournier f1d0d74087 Checkstyle 2018-02-14 01:22:22 +01:00
Clément Fournier 4bb707a3bd Test case for generic method 2018-02-14 00:42:07 +01:00
Clément Fournier 5ddb5a2a29 Make ASTFormalParameter a typenode
It feels right
2018-02-14 00:25:00 +01:00
Clément Fournier 9b93311c53 Cleanup ASTAnnotation
It's now a typenode
2018-02-14 00:14:20 +01:00
Clément Fournier 7db3f4a006 Add MissingOverrideRule and some tests
Doesn't support method overriden from generic supertype.
Known limitations that are supposed to be fixed shortly
are #910 and anonymous enum constants (the fix for that
is somewhere in my branches, after #895)
2018-02-13 23:29:37 +01:00
Clément Fournier 8cb7573379 Fix problem with outer enum and annotation types 2018-02-13 12:30:38 +01:00
Clément Fournier 733c871b96 Fix nested anonymous class bug with type resolution 2018-02-13 02:46:55 +01:00
Juan Martín Sotuyo Dodero cd9f4f2248 Merge branch 'pr-892' 2018-02-08 23:06:02 -03:00
Clément Fournier 1d9a2f194d Fix merge fail + checkstyle 2018-02-08 18:55:00 +01:00
Clément Fournier 40a5e3c569 Merge branch 'master' into improve-javaqualifiedname 2018-02-08 17:03:15 +01:00
Clément Fournier a039788dfb Fix the bugfix
Qualified names now use structural comparison to determine equality. Using toString
hid away some bugs. We still use toString to shortcut the comparison,
since it's cached.
2018-02-08 16:59:07 +01:00
Clément Fournier 3ede676e0a Fix two bugs with qname regex parsing 2018-02-08 16:24:46 +01:00
Clément Fournier 8d520b6d8d Update JavaParserVisitorReducedAdapter to consider MethodLike 2018-02-07 23:14:28 +01:00
Juan Martín Sotuyo Dodero 2909eb02b7 Merge branch 'pr-903' 2018-02-07 12:59:26 -03:00
Juan Martín Sotuyo Dodero ef85cf4c8f Update changelog, refs #903 2018-02-07 12:59:08 -03:00
Clément Fournier c245ef1ea9 Format test cases 2018-02-07 14:18:33 +01:00
Clément Fournier 45cb5f3252 Minor style corrections 2018-02-07 14:12:01 +01:00
Clément Fournier bb2e35b815 Fix ImmutableField false positive when lambda is in constructor
Fixes #855
2018-02-07 14:05:47 +01:00
Clément Fournier 240ccfb32f Improve a confusing code construct 2018-02-06 18:30:09 +01:00
Juan Martín Sotuyo Dodero 90527c646e Update changelog, refs #900 2018-02-05 02:30:22 -03:00
Clément Fournier 3d8d9ff013 Corrections for PR comments #901 2018-02-04 20:47:20 +01:00
Clément Fournier 5a3e1941d0 Use multi valued property as a PoC 2018-02-03 14:31:31 +01:00
Clément Fournier 5e8e125afa Replace synthetic proxy with static proxy for Xml nodes
Fixes #739
2018-02-03 14:24:24 +01:00
Juan Martín Sotuyo Dodero 117f4cf87a Merge branch 'pr-900' 2018-02-02 13:48:54 -03:00
reudismam 7e380e5d98 Use isEmpty method. 2018-02-02 12:28:25 -03:00
Andreas Dangel 7938dcd8c4 [ci] Add pmd-commits@lists.sourceforge.net for build notifications 2018-02-01 19:25:46 +01:00
Clément Fournier b30d64dd4f Make cyclo count lambdas separately 2018-02-01 00:28:32 +01:00
Clément Fournier 7e2930be3f Adapt the metrics framework to consider MethodLike 2018-02-01 00:28:32 +01:00
Clément Fournier ba10a60a7c Add JavaQualifiedName support for lambdas.
Add MethodLike superclass to ASTMethodDecl, ASTConstructorDecl, ASTLambdaExpr
2018-02-01 00:28:27 +01:00
Clément Fournier 1f6fc296c5 Split JavaQualifiedName into static factory + class 2018-01-31 22:44:59 +01:00
Clément Fournier 72a901089f Optimise format regex
Use possessive quantifiers to make it fail faster
2018-01-31 22:44:59 +01:00
Clément Fournier 332dadce2d Cleanup JavaQualifiedName to make it really immutable
Use an immutable list to avoid array copies everywhere
2018-01-31 22:44:59 +01:00
Clément Fournier 5fcfb0af8f Formatting and code rearrangement 2018-01-31 22:44:59 +01:00
Clément Fournier ece8c7e84c Add qualified name support for anonymous classes
* Simplify the API of JavaQualifiedName
* The name of an anonymous class is for now
  only available via JavaQualifiedName factories,
  not from the nodes
2018-01-31 22:44:59 +01:00
Clément Fournier a3c0f7d3ab Documentation 2018-01-31 22:44:59 +01:00
Clément Fournier f7636f27f3 Make JavaQualifiedName represent packages like in the JLS
The unnamed package is not represented as a lone full stop anymore.

Rename QualifiedNameTest into JavaQualifiedNameTest
2018-01-31 22:44:59 +01:00
Clément Fournier 55d3bbe881 Refactor ASTAnyTypeDeclaration into an abstract class.
Remove getQualifiedName's copypasta.
2018-01-31 22:44:59 +01:00
Clément Fournier 6ab52371cc Fix NPE in ForLoopCanBeForeach 2018-01-30 16:29:00 +01:00
Clément Fournier 47cfc3909c Merge branch 'master' into issue-784 2018-01-30 16:09:44 +01:00
Andreas Dangel 79882b1eb0 [ci] Fix coveralls integration: run a install first 2018-01-30 09:53:59 +01:00
Andreas Dangel 5c8016e58e Merge branch 'pr-889' 2018-01-30 09:43:29 +01:00
Andreas Dangel 257402cf95 Merge branch 'pr-890' 2018-01-30 09:34:06 +01:00
Juan Martín Sotuyo Dodero f86a06be4a Fix checkstyle 2018-01-29 23:26:42 -03:00
Juan Martín Sotuyo Dodero c2e11ddff2 [ci] Upgrade m-pmd-p
- Reenable pmd dogfoding
 - Upgrade to use PMD 6.0.1 on self
2018-01-29 23:19:43 -03:00
Juan Martín Sotuyo Dodero 75b60b8a88 Update changelog, refs #888 2018-01-29 14:12:54 -03:00
Juan Martín Sotuyo Dodero f9df6ed01e [java] Fix grammar for <> in Java 1.8
- Fixes #888
 - Allow the contents of an anonymous class to use diamong notation, but
the anonymous class itself can't use it
2018-01-29 14:10:40 -03:00
Juan Martín Sotuyo Dodero 53fa98a672 Merge branch 'pr-886' 2018-01-27 20:03:43 -03:00
Juan Martín Sotuyo Dodero 4c079ff9c5 Update changelog, refs #886 2018-01-27 20:03:26 -03:00
Matias Comercio bdf988030c Add missing unit test 2018-01-26 19:02:18 -03:00
Matias Comercio d8d271c2f1 Fix issue-885
False positive on Java rule: CompareObjectsWithEqualsRule

Enum class exlicit usage was not being considered an Enum type in the rule
2018-01-26 18:18:10 -03:00
Andreas Dangel 22a42ecd6f Merge branch 'pr-878' 2018-01-26 10:13:42 +01:00
Andreas Dangel 9062b4f09e [java] CommentRequiredRule: Add unit test
Add a unit test to verify the dysfunctionalReason is detected
correctly.

Refs #877
2018-01-26 09:58:50 +01:00
Juan Martín Sotuyo Dodero b439bb823f Merge branch 'pr-875' 2018-01-25 21:25:18 -03:00
Juan Martín Sotuyo Dodero 0360e0838e Update changelog, refs #875 2018-01-25 21:24:15 -03:00
Juan Martín Sotuyo Dodero 41de94776e Properly handle shortnames with comma-separated args
- Also added unit tests to make sure the behavior is as expected
2018-01-25 21:20:13 -03:00
Clément Fournier 91790c387d Merge branch 'pr-870' 2018-01-26 00:22:34 +01:00
Clément Fournier 21650ba85a Move util.documents into n.s.pmd.documents
Fix commit 40ad978 compilation errors
2018-01-26 00:20:38 +01:00
Juan Martín Sotuyo Dodero c34519431c Merge branch 'pr-828' 2018-01-25 19:55:33 -03:00
Juan Martín Sotuyo Dodero 476d9a6d4d Update changelog, refs #828 2018-01-25 19:54:16 -03:00
Juan Martín Sotuyo Dodero 6a801ee26c Move document classes out of the util package 2018-01-25 19:53:58 -03:00
Juan Martín Sotuyo Dodero a33958bc63 Merge branch 'pr-882' 2018-01-25 19:49:32 -03:00
Juan Martín Sotuyo Dodero f816bb65ba Merge branch 'pr-883' 2018-01-25 19:43:58 -03:00
Clément Fournier 35157be961 Update release notes, refs #784 2018-01-25 23:22:41 +01:00
Clément Fournier 69937a40e5 Fix ForLoopCanBeForeach flagging loops with two iterators
Resolves #784
2018-01-25 23:16:46 +01:00
Clément Fournier 34c29e93fb Update release notes, refs #825 2018-01-25 22:59:24 +01:00
Clément Fournier 6fb01ca19d ExcessiveClassLength considers annotation and enum types 2018-01-25 22:57:28 +01:00
Clément Fournier 3f38835d78 ExcessiveMethodLength considers constructors 2018-01-25 22:52:44 +01:00
Clément Fournier b7950cca1b Merge branch 'pr-868' 2018-01-25 18:46:03 +01:00
Clément Fournier 95eede5493 Update release notes, refs #868 2018-01-25 18:41:27 +01:00
Juan Martín Sotuyo Dodero 49a7c7d75b update broken url 2018-01-25 12:10:27 -03:00
Clément Fournier 0578b36145 Cleanup AbstractNode 2018-01-25 14:15:57 +01:00
Juan Martín Sotuyo Dodero ae0ef47e1d Merge branch 'pr-879' 2018-01-25 10:09:45 -03:00
gonzalo c25089ef9a PR Improvements - 3 2018-01-25 09:46:38 -03:00
Clément Fournier b1c5e3dfc0 Revert making AbstractVFNode and AbstractJspNode abstract
Revert me for 7.0.0

see #881, #879
2018-01-25 12:14:22 +01:00
gonzalo 80aba0c858 PR Improvements - 2 2018-01-24 23:35:22 -03:00
Clément Fournier 0316462916 Checkstyle 2018-01-25 03:13:22 +01:00
Clément Fournier 1bdca98f03 Flag deprecated impl to find it quickly 2018-01-25 03:10:04 +01:00
Clément Fournier 27ccd140ef Cleanup 2018-01-25 03:06:54 +01:00
Clément Fournier 6a3b332aee Abstract toString into AbstractNode, deprecate the implementation
Log that the default implementation will be removed
2018-01-25 03:02:44 +01:00
gonzalo 3d818b0963 PR Improvements - 1 2018-01-24 20:09:13 -03:00
Clément Fournier cd105125d8 Update release notes, refs #879 2018-01-24 19:36:17 +01:00
Clément Fournier 3c0bb45a60 Add getXPathNodeName to the Node interface
A default implementation is available in AbstractNode
to preserve compatibility with the previous way, which
used Object.toString.

Fixes #569
2018-01-24 19:22:36 +01:00
Juan Martín Sotuyo Dodero ccb8bae42d Update changelog, refs #877 2018-01-24 01:46:10 -03:00
Juan Martín Sotuyo Dodero 7ec99ba218 [java] Fix misconfiguration detection
- Resolves #877
2018-01-24 01:45:02 -03:00
Clément Fournier 0fb9c4678c Update release notes, refs #845 2018-01-23 21:17:31 +01:00
Clément Fournier 80bd38485a Merge branch 'pr-845'
Refs #543
2018-01-23 21:09:08 +01:00
Alberto Fernandez 9936b1f833 removed unnecesary counter 2018-01-23 17:56:10 +01:00
John Zhang aeb554ee62 Issue 872 fix
This commit attempts a fix to issue 872.
The inputFileName ('master' file) parameter may be null,
in which case the function returns just the file name if short name is required.
2018-01-23 11:46:02 +11:00
Travis CI (pmd-bot) 8aeddd09a4 Update documentation 2018-01-21 20:01:11 +00:00
Juan Martín Sotuyo Dodero 02e84360aa [doc] Update sidebar generation 2018-01-21 16:50:02 -03:00
Juan Martín Sotuyo Dodero 10d8b194bb Revert "Update documentation"
This reverts commit 3548fd14c0.
2018-01-21 16:24:40 -03:00
Juan Martín Sotuyo Dodero c436e9bd94 Fix checkstyle errors 2018-01-21 16:16:06 -03:00
Juan Martín Sotuyo Dodero 26288b0022 [core] Remove usages of deprecated PMD.VERSION
- Take the chance to add some helpers to PMDVersion that seem needed
 - Have CodeClimate renderer point to pmd.github.io rather than SF
2018-01-21 16:02:48 -03:00
Travis CI (pmd-bot) 3548fd14c0 Update documentation 2018-01-21 18:12:05 +00:00
Juan Martín Sotuyo Dodero 142fb16358 Merge branch 'pr-860' 2018-01-21 14:59:31 -03:00
Juan Martín Sotuyo Dodero 33edaeb46b Update changelog, refs #803 2018-01-21 14:52:55 -03:00
Juan Martín Sotuyo Dodero 527bfce72f Merge branch 'pr-803' 2018-01-21 14:52:00 -03:00
Juan Martín Sotuyo Dodero 77f3637f53 Remove quotes 2018-01-21 14:51:43 -03:00
Juan Martín Sotuyo Dodero 1065006b8a Upodate changelog, refs #790 2018-01-21 14:47:45 -03:00
Juan Martín Sotuyo Dodero e1e8ad5984 Merge branch 'pr-790' 2018-01-21 14:47:11 -03:00
Juan Martín Sotuyo Dodero 17c925b9db Update changelog, refs #830 2018-01-21 14:45:06 -03:00
Juan Martín Sotuyo Dodero 3de3335714 Merge branch 'pr-830' 2018-01-21 14:42:09 -03:00
Juan Martín Sotuyo Dodero 69fc4ffc2d Update changelog, refs #791 2018-01-21 14:39:57 -03:00
Juan Martín Sotuyo Dodero e6be5b3e44 Merge branch 'pr-818' 2018-01-21 14:39:07 -03:00
Andreas Dangel 5bcc09ccc4 Release script: add step to update docs/_config.yml 2018-01-21 16:51:52 +01:00
Andreas Dangel 182dadaa4b Prepare next development version 2018-01-21 16:45:02 +01:00
Andreas Dangel 8fbb156fd9 [maven-release-plugin] prepare for next development iteration 2018-01-21 16:42:50 +01:00
gonzalo 9d7d89b669 Add XPath flow documentation && Made small refactor 2018-01-21 11:09:50 -03:00
Andreas Dangel 3472bf1764 [doc] Fix wrong bootclasspath to be able to use java8 api 2018-01-18 16:33:33 +01:00
Andreas Dangel 7faba76809 Update release notes, fixes #848 2018-01-17 20:57:28 +01:00
Andreas Dangel 411be4ac00 [doc] Further changes for windows compatibility 2018-01-17 20:51:56 +01:00
Andreas Dangel 090975a972 [doc] Fix file handle leak in SidebarGenerator 2018-01-17 20:19:33 +01:00
Andreas Dangel 1ef5367498 [doc] Fix build/unit tests under windows
* expect line names with windows path normalized to unix paths
* normalize line endings
* File.separator might be a backslash and needs to be escaped in regex
2018-01-17 19:41:45 +01:00
Alberto Fernandez 2c2c2f4dd9 Checkstyle fixes 2018-01-17 16:06:54 +01:00
Alberto Fernandez 883bed3cf8 Better detection of corner cases
the firts changes checks for a exact level to search AdditiveExpression.

So code like
throw new Exception("something bad:" + (e)); gets undetected.

This change search if part of a AdditiveExpression to the base node.
2018-01-17 15:25:38 +01:00
Alberto Fernandez a4d5ff683d Fix checkstyle 2018-01-12 23:31:58 +01:00
Alberto Fernandez 4f67d99c9f Fix false negative PreserveStackTrace on string concatenation
PMD should fire PreserveStackTrace in the following code

public void foo(String a) throws Exception {
    try {
        int i = Integer.parseInt(a);
    } catch(Exception e){
        throw new Exception("something bad:" + e);
        // Stack trace is lost, but no violation was reported!
    }
}

Closes pmd/pmd#543
2018-01-12 23:09:17 +01:00
gonzalo 40ad978d8f Receive Charset of Document in the constructor 2018-01-08 08:56:40 -03:00
gonzalo de09472421 Change filePath type from String to Path 2018-01-08 02:34:30 -03:00
gonzalo 000d72d3be Change name in document operations comparator inner method && Change visibility of getter in DocumentFile 2018-01-08 02:29:44 -03:00
gonzalo bb8b2cdd4e [WIP] Working fix for <Line, Offset> mapping to support any type of line separators in the same source file && other minor fixes 2018-01-08 01:55:52 -03:00
Tobias Weimer fd51f6254a Update performance.xml
Added missing CDATA
2018-01-07 19:19:17 +01:00
Tobias Weimer af4c5b2a87 Update performance.xml
Added note about Arrays.asList()
2018-01-05 15:47:16 +01:00
Tobias Weimer 142e533833 Update performance.xml
new Boolean(), new Byte() and new Short() are deoprecated in JDK 9 too.
2018-01-05 15:29:59 +01:00
gonzalo 40bb0a0fe6 Remove Java 8 and 9 language usages 2018-01-03 23:37:58 -03:00
gonzalo f09a9b62bd Remove source/target configuration for maven-compiler-plugin added by IDEA 2018-01-03 12:03:13 -03:00
gonzalo 8f6484cadc Add operations to manipulate a document 2018-01-03 11:30:07 -03:00
Clément Fournier ea63134e6b Reorganise sidebar and files 2017-12-31 00:36:18 +01:00
Tobias Weimer 99ea002a95 Update similarprojects.md
Added SpotBugs
2017-12-21 20:58:13 +01:00
Clément Fournier bc95ca803c Beanify controllers, new settings persistence logic
Add property edition to the XPath panel
2017-12-21 17:08:11 +01:00
Tobias Weimer 766565a0bf Update performance.xml
new Integer() and new Long() is deoprecated in JDK 9.
2017-12-19 20:55:48 +01:00
Tobias Weimer fbd9306889 Update performance.xml
Reference to Arrays.copyOf
2017-12-19 20:52:23 +01:00
Tobias Weimer 75fe76cbf5 Update errorprone.xml
Note that Oracle has declared Object.finalize() as deprecated since JDK 9.
2017-12-19 20:48:45 +01:00
606 changed files with 15002 additions and 6105 deletions

No files matched your search

+3 -2
View File
@@ -3,13 +3,13 @@ sudo: false
addons:
apt:
packages:
- oracle-java8-installer
- oracle-java9-installer
ssh_known_hosts:
- web.sourceforge.net
language: java
jdk: oraclejdk8
jdk: oraclejdk9
env:
global:
@@ -58,6 +58,7 @@ notifications:
email:
recipients:
- andreas.dangel@adangel.org
- pmd-commits@lists.sourceforge.net
on_success: always
on_failure: always
cache:
+3 -2
View File
@@ -14,6 +14,7 @@ fi
#
# for java9: enable all modules.
# coveralls plugin seems to need java.xml.bind module
# echo "MAVEN_OPTS='-Xms1g -Xmx1g --add-modules java.se.ee'" > ${HOME}/.mavenrc
echo "MAVEN_OPTS='-Xms1g -Xmx1g --add-modules java.se.ee'" > ${HOME}/.mavenrc
./mvnw clean test jacoco:report coveralls:report -Pcoveralls -B -V
./mvnw clean install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
./mvnw test jacoco:report coveralls:report -Pcoveralls -B -V
+1 -5
View File
@@ -25,11 +25,7 @@ function push_docs() {
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1)
echo "Building PMD ${VERSION} on branch ${TRAVIS_BRANCH}"
# determine java 7 path
JAVA7_HOME=$(jdk_switcher home openjdk7)
# TODO : Once we release PMD 6.0.0 and have a compatible PMD plugin, enable PMD once again
MVN_BUILD_FLAGS="-B -V -Djava7.home=${JAVA7_HOME} -Dpmd.skip=true"
MVN_BUILD_FLAGS="-B -V"
if travis_isPullRequest; then
+1 -1
View File
@@ -14,7 +14,7 @@ fi
#
# for java9: enable all modules.
# sonar plugin seems to need java.xml.bind module
# echo "MAVEN_OPTS='-Xms1g -Xmx1g --add-modules java.se.ee'" > ${HOME}/.mavenrc
echo "MAVEN_OPTS='-Xms1g -Xmx1g --add-modules java.se.ee'" > ${HOME}/.mavenrc
# Run the build, truncate output due to Travis log limits
./mvnw clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${SONAR_TOKEN} -B -V
+4 -3
View File
@@ -29,10 +29,11 @@ When filing a bug report, please provide as much information as possible, so tha
## Documentation
There is some documentation available under <https://pmd.github.io>. Feel free to create a bug report if
documentation is missing, incomplete or outdated.
There is some documentation available under <https://pmd.github.io/pmd>. Feel free to create a bug report if
documentation is missing, incomplete or outdated. See [Bug reports](#bug-reports).
The documentation is generated as a maven site, the source is available at: <https://github.com/pmd/pmd/tree/master/src/site>
The documentation is generated as a Jekyll site, the source is available at: <https://github.com/pmd/pmd/tree/master/docs>. You can find build instructions there.
For more on contributing documentation check <https://pmd.github.io/pmd/pmd_devdocs_writing_documentation.html>
## Questions
+14 -7
View File
@@ -86,7 +86,7 @@ git commit -a -m "Prepare pmd release ${RELEASE_VERSION}"
(
echo "Committing current changes (pmd.github.io)"
cd ../pmd.github.io
git add _posts/$(date -u +%d-%m-%Y)-PMD-${RELEASE_VERSION}.md
git add _posts/$(date -u +%Y-%m-%d)-PMD-${RELEASE_VERSION}.md
git commit -a -m "Prepare pmd release ${RELEASE_VERSION}"
git push
)
@@ -107,24 +107,26 @@ echo
cat <<EOF
PMD ${RELEASE_VERSION} released
* minor version with lots of bug fixes
* Release Notes: https://pmd.github.io/pmd-${RELEASE_VERSION}/pmd_release_notes.html
* Downloads: https://github.com/pmd/pmd/releases/tag/pmd_releases%2F${RELEASE_VERSION}
* Fixed Bugs: https://sourceforge.net/p/pmd/bugs/milestone/PMD-${RELEASE_VERSION}/
* Documentation: https://pmd.github.io/pmd-${RELEASE_VERSION}/
And Copy-Paste the release notes
EOF
echo
echo "Press enter to continue..."
read
echo
echo "Check the milestone on sourceforge:"
echo "<https://sourceforge.net/p/pmd/bugs/milestones>"
echo "Check the milestone on github:"
echo "<https://github.com/pmd/pmd/milestones>"
echo " --> move any open issues to the next milestone, close the current milestone"
echo " --> Maybe there are some milestones on sourceforge, too: <https://sourceforge.net/p/pmd/bugs/milestones>."
echo
echo
echo
echo "Prepare Next development version:"
echo "* Move version/release info from **docs/pages/release_notes.md** to **docs/pages/release_notes_old.md**."
echo "* Update version/date info in **docs/_config.yml**."
echo "* Update version/release info in **docs/pages/release_notes.md**."
echo
cat <<EOF
@@ -170,7 +172,12 @@ echo
echo "Send out an announcement mail to the mailing list:"
echo "To: PMD Developers List <pmd-devel@lists.sourceforge.net>"
echo "Subject: [ANNOUNCE] PMD ${RELEASE_VERSION} Released"
echo "Body: !!Copy Changelog!!"
echo
echo " * Downloads: https://github.com/pmd/pmd/releases/tag/pmd_releases%2F${RELEASE_VERSION}"
echo " * Documentation: https://pmd.github.io/pmd-${RELEASE_VERSION}/"
echo
echo " And Copy-Paste the release notes"
echo
echo
echo
echo "------------------------------------------"
+2 -2
View File
@@ -1,8 +1,8 @@
repository: pmd/pmd
pmd:
version: 6.0.1
date: 2018-01-21
version: 6.2.0
date: 2018-03-26
output: web
# this property is useful for conditional filtering of content that is separate from the PDF.
+108 -78
View File
@@ -15,30 +15,66 @@ entries:
url: /tocpage
output: pdf
type: frontmatter
- title: User Documentation
- title: About
output: web, pdf
folderitems:
- title: Introduction
url: /index.html
output: web, pdf
type: homepage
- title: Release Notes
- title: Release notes
url: /pmd_release_notes.html
output: web, pdf
- title: Getting Started
- title: Getting help
url: /pmd_about_help.html
output: web, pdf
- title: User Documentation
output: web, pdf
folderitems:
- title: Getting started
url: /pmd_userdocs_getting_started.html
output: web, pdf
- title: Understanding Rulesets
- title: Understanding rulesets
url: /pmd_userdocs_understanding_rulesets.html
output: web, pdf
- title: Best Pratices
- title: Making rulesets
url: /pmd_userdocs_making_rulesets.html
output: web, pdf
- title: Using rule properties
url: /pmd_userdocs_using_properties.html
output: web, pdf
- title: Best practices
url: /pmd_userdocs_best_practices.html
output: web, pdf
- title: Copy-Paste Detection
url: /pmd_userdocs_cpd.html
- title: Suppressing warnings
url: /pmd_userdocs_suppressing_warnings.html
output: web, pdf
- title: Suppressing
url: /pmd_userdocs_suppressing.html
- title: null
output: web, pdf
subfolders:
- title: Extending PMD
output: web, pdf
subfolderitems:
- title: Writing a rule
url: /pmd_userdocs_extending_writing_pmd_rules.html
output: web, pdf
- title: Writing XPath rules
url: /pmd_userdocs_extending_writing_xpath_rules.html
output: web, pdf
- title: Defining rule properties
url: /pmd_userdocs_extending_defining_properties.html
output: web, pdf
- title: Using and defining code metrics
url: /pmd_userdocs_extending_metrics_howto.html
output: web, pdf
- title: Rule guidelines
url: /pmd_userdocs_extending_rule_guidelines.html
output: web, pdf
- title: Testing your rules
url: /pmd_userdocs_extending_testing.html
output: web, pdf
- title: Copy-paste detection
url: /pmd_userdocs_cpd.html
output: web, pdf
- title: null
output: web, pdf
@@ -46,42 +82,18 @@ entries:
- title: Tools / Integrations
output: web, pdf
subfolderitems:
- title: Maven PMD Plugin
- title: Maven PMD plugin
output: web, pdf
url: /pmd_userdocs_tools_maven.html
- title: Ant
output: web, pdf
url: /pmd_userdocs_tools_ant.html
- title: CI integrations
output: web, pdf
url: /pmd_userdocs_tools_ci.html
- title: Other Tools / Integrations
output: web, pdf
url: /pmd_userdocs_tools.html
- title: FAQ
url: /pmd_userdocs_faq.html
output: web, pdf
- title: Getting Help
url: /pmd_userdocs_help.html
output: web, pdf
- title: PMD in the press
url: /pmd_userdocs_news.html
output: web, pdf
- title: Products/books related to PMD
url: /pmd_userdocs_products.html
output: web, pdf
- title: Similar Projects
url: /pmd_userdocs_similarprojects.html
output: web, pdf
- title: License
url: /license.html
output: web, pdf
- title: Credits
url: /pmd_userdocs_credits.html
output: web, pdf
- title: What does 'PMD' mean?
url: /pmd_userdocs_meaning.html
output: web, pdf
- title: Old Release Notes
url: /pmd_release_notes_old.html
output: web, pdf
- title: Rule Reference
output: web, pdf
folderitems:
@@ -289,64 +301,82 @@ entries:
- title: Developer Documentation
output: web, pdf
folderitems:
- title: Developer Resources
- title: Developer resources
url: /pmd_devdocs_development.html
output: web, pdf
- title: Writing Documentation
url: /pmd_devdocs_writing_documentation.html
output: web, pdf
- title: Code Style
url: /pmd_devdocs_codestyle.html
output: web, pdf
- title: Setting up your IDE
url: /pmd_devdocs_setting_up_ide.html
output: web, pdf
- title: Pull Requests
url: /pmd_devdocs_pull_requests.html
output: web, pdf
- title: Building PMD from source
url: /pmd_devdocs_building.html
output: web, pdf
- title: Testing / Test Framework
url: /pmd_devdocs_testing.html
- title: Contributing
url: /pmd_devdocs_contributing.html
output: web, pdf
- title: Releasing
url: /pmd_devdocs_releasing.html
output: web, pdf
- title: Architecture
url: /pmd_devdocs_architecture.html
- title: Writing documentation
url: /pmd_devdocs_writing_documentation.html
output: web, pdf
- title: Roadmap
url: /pmd_devdocs_roadmap.html
output: web, pdf
- title: How PMD Works
- title: How PMD works
url: /pmd_devdocs_how_pmd_works.html
output: web, pdf
- title: Writing a Rule
url: /pmd_devdocs_writing_pmd_rules.html
- title: null
output: web, pdf
- title: Writing XPath Rules
url: /pmd_devdocs_writing_xpath_rules.html
subfolders:
- title: Major contributions
output: web, pdf
subfolderitems:
- title: Adding a new language
url: /pmd_devdocs_major_adding_new_language.html
output: web, pdf
- title: Adding a new CPD language
url: /pmd_devdocs_major_adding_new_cpd_language.html
output: web, pdf
- title: Adding metrics support to a language
url: /pmd_devdocs_major_adding_new_metrics_framework.html
output: web, pdf
- title: Project documentation
output: web, pdf
folderitems:
- title: null
output: web, pdf
- title: Using code metrics in custom rules
url: /pmd_devdocs_metrics_howto.html
subfolders:
- title: Trivia about PMD
output: web, pdf
subfolderitems:
- title: PMD in the press
url: /pmd_projectdocs_trivia_news.html
output: web, pdf
- title: Products & books related to PMD
url: /pmd_projectdocs_trivia_products.html
output: web, pdf
- title: Similar projects
url: /pmd_projectdocs_trivia_similarprojects.html
output: web, pdf
- title: What does 'PMD' mean?
url: /pmd_projectdocs_trivia_meaning.html
output: web, pdf
- title: FAQ
url: /pmd_projectdocs_faq.html
output: web, pdf
- title: Making Rulesets
url: /pmd_devdocs_making_rulesets.html
- title: License
url: /license.html
output: web, pdf
- title: Rule Guidelines
url: /pmd_devdocs_rule_guidelines.html
- title: Credits
url: /pmd_projectdocs_credits.html
output: web, pdf
- title: Working with properties
url: /pmd_devdocs_working_with_properties.html
- title: Old release notes
url: /pmd_release_notes_old.html
output: web, pdf
- title: Adding a New Language
url: /pmd_devdocs_adding_new_language.html
output: web, pdf
- title: Adding a New CPD Language
url: /pmd_devdocs_adding_new_cpd_language.html
output: web, pdf
- title: Adding metrics support to a language
url: /pmd_devdocs_adding_metrics_support_to_language.html
- title: null
output: web, pdf
subfolders:
- title: Project management
output: web, pdf
subfolderitems:
- title: Release process
url: /pmd_projectdocs_committers_releasing.html
output: web, pdf
- title: Merging pull requests
url: /pmd_projectdocs_committers_merging_pull_requests.html
output: web, pdf
@@ -1,6 +1,6 @@
---
title: Getting Help
permalink: pmd_userdocs_help.html
permalink: pmd_about_help.html
author: Andreas Dangel <andreas.dangel@adangel.org>
last_updated: September 2017
---
-10
View File
@@ -1,10 +0,0 @@
---
title: Architecture
sidebar: pmd_sidebar
permalink: pmd_devdocs_architecture.html
folder: pmd/devdocs
---
PMD high-level building blocks
TODO
+3
View File
@@ -4,6 +4,9 @@ permalink: pmd_devdocs_building.html
author: Tom Copeland, Xavier Le Vourch <xlv@users.sourceforge.net>
---
<!-- Gives visibility -->
{%include note.html content="TODO add IDE specific indications" %}
# Compiling PMD
* JDK 9 or higher
-10
View File
@@ -1,10 +0,0 @@
---
title: Code Style
sidebar: pmd_sidebar
permalink: pmd_devdocs_codestyle.html
folder: pmd/devdocs
---
TODO
* Checkstyle
+24
View File
@@ -0,0 +1,24 @@
---
title: Contributing to PMD
sidebar: pmd_sidebar
permalink: pmd_devdocs_contributing.html
folder: pmd/devdocs
---
## Contributing via pull requests
First off, thanks for taking the time to contribute!
* Please create your pull request against the `master` branch. We will rebase/merge it to the maintenance
branches, if necessary. Just fork the [pmd repo](https://github.com/pmd/pmd/) and
create a [pull request](https://github.com/pmd/pmd/pulls).
* We are using [checkstyle](http://checkstyle.sourceforge.net/) to enforce a common code style.
The check is integrated into the default build - so, make sure, you can [build PMD](pmd_devdocs_building.html)
without errors.
The following section goes into more details about our Checkstyle configuration.
## Code style
* Checkstyle
@@ -1,15 +1,13 @@
---
title: PMD How to Add a New CPD Language
short_title: Add a New CPD Language
title: How to add a new CPD language
short_title: Add a new CPD language
tags: [customizing]
summary: How to Add a New CPD Language
summary: How to add a new CPD language
last_updated: July 3, 2016
permalink: pmd_devdocs_adding_new_cpd_language.html
permalink: pmd_devdocs_major_adding_new_cpd_language.html
author: Romain PELISSE <belaran@gmail.com>
---
# How to Add a New Language to CPD
If you wish CPD to parse a unsupported language, you can easily develop a new parser for CPD. All you need to is implements the following interface:
* net.sourceforge.pmd.cpd.Language
@@ -1,15 +1,14 @@
---
title: PMD Adding a New Language
short_title: Adding a New Language
title: Adding PMD support for a new language
short_title: Adding a new language
tags: [customizing]
summary: Adding a New Language to PMD
summary: "How to add a new language to PMD."
last_updated: July 3, 2016
sidebar: pmd_sidebar
permalink: pmd_devdocs_adding_new_language.html
permalink: pmd_devdocs_major_adding_new_language.html
folder: pmd/devdocs
---
# How to Add a New Language to PMD
## 1. Start with a new sub-module.
* See pmd-java or pmd-vm for examples.
@@ -6,7 +6,7 @@ summary: "PMD's Java module has an extensive framework for the calculation of me
to implement and use new code metrics very simply. Most of the functionality of this framework is abstracted in such
a way that any PMD supported language can implement such a framework without too much trouble. Here's how."
last_updated: December 2017
permalink: pmd_devdocs_adding_metrics_support_to_language.html
permalink: pmd_devdocs_major_adding_new_metrics_framework.html
author: Clément Fournier <clement.fournier76@gmail.com>
---
+2
View File
@@ -6,7 +6,9 @@ author: >
Juan Martín Sotuyo Dodero <juansotuyo@gmail.com>, Andreas Dangel <adangel@users.sourceforge.net>
---
TODO:
* Update
* Future direction
* projects, plans
* Google Summer of Code
-6
View File
@@ -1,6 +0,0 @@
---
title: Setting up your IDE
sidebar: pmd_sidebar
permalink: pmd_devdocs_setting_up_ide.html
folder: pmd/devdocs
---
@@ -1,5 +1,5 @@
---
title: Writing Documentation
title: Writing documentation
last_update: August 2017
permalink: pmd_devdocs_writing_documentation.html
keywords: documentation, jekyll, markdown
@@ -17,13 +17,48 @@ The pages are in general in [Github Flavored Markdown](https://kramdown.gettalon
## Structure
All documentation is stored in the folder `docs/`. This is the folder, that github and the travis-ci scripts
use to render the site.
The documentation sources can be found in two places based on how they are generated:
- the ones that are manually written (like the one you are reading);
- and the ones that are generated automatically from the category files. All the rule documentation
pages are generated that way.
New pages are stored in the different subfolders under `pages`. The folder structure resembles the sidebar structure.
### Handwritten documentation
All handwritten documentation is stored in the subfolders under `docs/pages`. The folder structure resembles the sidebar structure.
Since all pages use a simple *permalink*, in the rendered html pages, all pages are flattened in one directory.
This makes it easy to view the documentation also offline.
### Rule documentation
The categories for a language `%lang%` are located in
`pmd-%lang%/src/main/resources/category/%lang% `. So for Java the categories
can be found under [pmd-java/src/main/resources/category/java](https://github.com/pmd/pmd/tree/master/pmd-java/src/main/resources/category/java).
The XML category files in this directory are transformed during build into markdown pages
describing the rules they contain. These pages are placed under `docs/` like the handwritten
documentation, and are then rendered with Jekyll like the rest of them. The rule documentation
generator is the separate submodule `pmd-doc`.
Modifying the documentation of a rule should thus not be done on the markdown page,
but directly on the XML `rule` tag corresponding to the rule, in the relevant
category file.
The XML documentation of rules can contain GitHub flavoured markdown.
Just wrap the markdown inside CDATA section in the xml. CDATA sections preserve
all formatting inside the delimiters, and allow to write code samples without
escaping special xml characters. For example:
```
<rule ...>
<description>
<![CDATA[
Full description, can contain markup
And paragraphs
]]>
</description>
...
</rule>
```
## Building
There are two ways, to execute jekyll:
@@ -1,27 +1,11 @@
---
title: Pull-Request Merge
permalink: pmd_devdocs_pull_requests.html
title: Merging pull requests
permalink: pmd_projectdocs_committers_merging_pull_requests.html
last_updated: August 2017
author: Andreas Dangel <andreas.dangel@adangel.org>
---
## Contributing via pull requests
First off, thanks for taking the time to contribute!
* Please create your pull request against the `master` branch. We will rebase/merge it to the maintenance
branches, if necessary. Just fork the [pmd repo](https://github.com/pmd/pmd/) and
create a [pull request](https://github.com/pmd/pmd/pulls).
* We are using [checkstyle](http://checkstyle.sourceforge.net/) to enforce a common code style.
The check is integrated into the default build - so, make sure, you can [build PMD](pmd_devdocs_building.html)
without errors.
See [code style](pmd_devdocs_codestyle.html) for more info.
## Merging pull requests
### Example 1: Merging PR #123 into master
## Example 1: Merging PR #123 into master
1. Review the pull request
@@ -81,12 +65,12 @@ First off, thanks for taking the time to contribute!
`git branch -d pr-123`.
### Example 2: Merging PR #124 into a maintenance branch
## Example 2: Merging PR #124 into a maintenance branch
We ask, to create every pull request against master, to make it easier to contribute.
But if a pull request is intended to fix a bug in an older version of PMD, then we need to backport this pull request.
#### Creating a maintenance branch
### Creating a maintenance branch
For older versions, we use maintenance branches, like `pmd/5.8.x`. If there is no maintenance branch for
the specific version, then we'll have to create it first. Let's say, we want a maintenance branch for
@@ -107,7 +91,7 @@ PMD version 5.8.0, so that we can create a bugfix release 5.8.1.
git commit -m "prepare next version 5.8.1-SNAPSHOT"
```
#### Merging the PR
### Merging the PR
1. As above: Review the PR
@@ -143,7 +127,7 @@ PMD version 5.8.0, so that we can create a bugfix release 5.8.1.
You need to manually close the pull request. Leave a comment, that it has been
rebased onto the maintenance branch.
#### Merging into master
### Merging into master
Now the PR has been merged into the maintenance branch, but it is missing in any later version of PMD.
Therefore, we merge first into the next minor version maintenance branch (if existing):
@@ -164,7 +148,7 @@ We could avoid this by merging only the temporary branch \"pr-124\" into each ma
eventually into master, with the risk of missing single commits in a maintenance branch, that have been
done outside the temporary branch." %}
#### Merging vs. Cherry-Picking
### Merging vs. Cherry-Picking
We are not using cherry-picking, so that each fix is represented by a single commit.
Cherry-picking would duplicate the commit and you can't see in the log, on which branches the fix has been
@@ -1,6 +1,6 @@
---
title: Releasing
permalink: pmd_devdocs_releasing.html
permalink: pmd_projectdocs_committers_releasing.html
author: Romain Pelisse <rpelisse@users.sourceforge.net>, Andreas Dangel <adangel@users.sourceforge.net>
---
@@ -1,6 +1,6 @@
---
title: Credits
permalink: pmd_userdocs_credits.html
permalink: pmd_projectdocs_credits.html
author: Tom Copeland <tom@infoether.org>
---
@@ -1,7 +1,7 @@
---
title: FAQ
sidebar: pmd_sidebar
permalink: pmd_userdocs_faq.html
permalink: pmd_projectdocs_faq.html
folder: pmd/userdocs
---
@@ -1,6 +1,6 @@
---
title: What does 'PMD' mean?
permalink: pmd_userdocs_meaning.html
permalink: pmd_projectdocs_trivia_meaning.html
author: David Dixon-Peugh
---
@@ -1,6 +1,6 @@
---
title: PMD in the press
permalink: pmd_userdocs_news.html
permalink: pmd_projectdocs_trivia_news.html
author: Tom Copeland <tom@infoether.org>
---
@@ -1,6 +1,6 @@
---
title: Products/books related to PMD
permalink: pmd_userdocs_products.html
permalink: pmd_projectdocs_trivia_products.html
author: Tom Copeland <tom@infoether.org>
---
@@ -1,6 +1,6 @@
---
title: Similar projects
permalink: pmd_userdocs_similarprojects.html
permalink: pmd_projectdocs_trivia_similarprojects.html
author: Tom Copeland <tom@infoether.org>, David Dixon-Peugh <ddp@apache.org>
---
@@ -16,6 +16,7 @@ author: Tom Copeland <tom@infoether.org>, David Dixon-Peugh <ddp@apache.org>
Uses Java Modeling Language annotations.
* <a href="http://findbugs.sourceforge.net/">FindBugs</a> - works on bytecode, uses BCEL. Source code uses
templates, nifty stuff!
* <a href="https://spotbugs.github.io/">SpotBugs</a> - SpotBugs is the spiritual successor of FindBugs, carrying on from the point where it left off with support of its community.
* <a href="http://www.hammurapi.biz/hammurapi-biz/ef/xmenu/hammurapi-group/products/hammurapi/index.html">Hammurapi</a> -
Uses ANTLR, excellent documentation, lots of rules
* <a href="http://grothoff.org/christian/xtc/jamit/">Jamit</a> - bytecode analyzer, nice graphs
+13 -10
View File
@@ -30,6 +30,7 @@ folder: pmd/rules
* [JUnitUseExpected](pmd_rules_java_bestpractices.html#junituseexpected): In JUnit4, use the @Test(expected) annotation to denote tests that should throw exceptions.
* [LooseCoupling](pmd_rules_java_bestpractices.html#loosecoupling): The use of implementation types (i.e., HashSet) as object references limits your ability to use a...
* [MethodReturnsInternalArray](pmd_rules_java_bestpractices.html#methodreturnsinternalarray): Exposing internal arrays to the caller violates object encapsulation since elements can be remove...
* [MissingOverride](pmd_rules_java_bestpractices.html#missingoverride): Annotating overridden methods with @Override ensures at compile time that the method r...
* [OneDeclarationPerLine](pmd_rules_java_bestpractices.html#onedeclarationperline): Java allows the use of several variables declaration of the same type on one line. However, itcan...
* [PositionLiteralsFirstInCaseInsensitiveComparisons](pmd_rules_java_bestpractices.html#positionliteralsfirstincaseinsensitivecomparisons): Position literals first in comparisons, if the second argument is null then NullPointerExceptions...
* [PositionLiteralsFirstInComparisons](pmd_rules_java_bestpractices.html#positionliteralsfirstincomparisons): Position literals first in comparisons, if the second argument is null then NullPointerExceptions...
@@ -68,6 +69,7 @@ folder: pmd/rules
* [ClassNamingConventions](pmd_rules_java_codestyle.html#classnamingconventions): Class names should always begin with an upper case character.
* [CommentDefaultAccessModifier](pmd_rules_java_codestyle.html#commentdefaultaccessmodifier): To avoid mistakes if we want that a Method, Constructor, Field or Nested class have a default acc...
* [ConfusingTernary](pmd_rules_java_codestyle.html#confusingternary): Avoid negation within an "if" expression with an "else" clause. For example, rephrase:'if (x != ...
* [ControlStatementBraces](pmd_rules_java_codestyle.html#controlstatementbraces): Enforce a policy for braces on control statements. It is recommended to use braces on 'if ... els...
* [DefaultPackage](pmd_rules_java_codestyle.html#defaultpackage): Use explicit scoping instead of accidental usage of default package private level.The rule allows...
* [DontImportJavaLang](pmd_rules_java_codestyle.html#dontimportjavalang): Avoid importing anything from the package 'java.lang'. These classes are automatically imported ...
* [DuplicateImports](pmd_rules_java_codestyle.html#duplicateimports): Duplicate or overlapping import statements should be avoided.
@@ -75,10 +77,10 @@ folder: pmd/rules
* [ExtendsObject](pmd_rules_java_codestyle.html#extendsobject): No need to explicitly extend Object.
* [FieldDeclarationsShouldBeAtStartOfClass](pmd_rules_java_codestyle.html#fielddeclarationsshouldbeatstartofclass): Fields should be declared at the top of the class, before any method declarations, constructors, ...
* [ForLoopShouldBeWhileLoop](pmd_rules_java_codestyle.html#forloopshouldbewhileloop): Some for loops can be simplified to while loops, this makes them more concise.
* [ForLoopsMustUseBraces](pmd_rules_java_codestyle.html#forloopsmustusebraces): Avoid using 'for' statements without using curly braces. If the code formatting or indentation is...
* [ForLoopsMustUseBraces](pmd_rules_java_codestyle.html#forloopsmustusebraces): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Avoid using 'for' statements without using curly braces. If the code formatting or indentation is...
* [GenericsNaming](pmd_rules_java_codestyle.html#genericsnaming): Names for references to generic values should be limited to a single uppercase letter.
* [IfElseStmtsMustUseBraces](pmd_rules_java_codestyle.html#ifelsestmtsmustusebraces): Avoid using if..else statements without using surrounding braces. If the code formatting or inden...
* [IfStmtsMustUseBraces](pmd_rules_java_codestyle.html#ifstmtsmustusebraces): Avoid using if statements without using braces to surround the code block. If the code formatting...
* [IfElseStmtsMustUseBraces](pmd_rules_java_codestyle.html#ifelsestmtsmustusebraces): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Avoid using if..else statements without using surrounding braces. If the code formatting or inden...
* [IfStmtsMustUseBraces](pmd_rules_java_codestyle.html#ifstmtsmustusebraces): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Avoid using if statements without using braces to surround the code block. If the code formatting...
* [LocalHomeNamingConvention](pmd_rules_java_codestyle.html#localhomenamingconvention): The Local Home interface of a Session EJB should be suffixed by 'LocalHome'.
* [LocalInterfaceSessionNamingConvention](pmd_rules_java_codestyle.html#localinterfacesessionnamingconvention): The Local Interface of a Session EJB should be suffixed by 'Local'.
* [LocalVariableCouldBeFinal](pmd_rules_java_codestyle.html#localvariablecouldbefinal): A local variable assigned only once can be declared final.
@@ -98,6 +100,7 @@ folder: pmd/rules
* [ShortVariable](pmd_rules_java_codestyle.html#shortvariable): Fields, local variables, or parameter names that are very short are not helpful to the reader.
* [SuspiciousConstantFieldName](pmd_rules_java_codestyle.html#suspiciousconstantfieldname): Field names using all uppercase characters - Sun's Java naming conventions indicating constants -...
* [TooManyStaticImports](pmd_rules_java_codestyle.html#toomanystaticimports): If you overuse the static import feature, it can make your program unreadable and unmaintainable,...
* [UnnecessaryAnnotationValueElement](pmd_rules_java_codestyle.html#unnecessaryannotationvalueelement): Avoid the use of value in annotations when it's the only element.
* [UnnecessaryConstructor](pmd_rules_java_codestyle.html#unnecessaryconstructor): This rule detects when a constructor is not necessary; i.e., when there is only one constructor,i...
* [UnnecessaryFullyQualifiedName](pmd_rules_java_codestyle.html#unnecessaryfullyqualifiedname): Import statements allow the use of non-fully qualified names. The use of a fully qualified namew...
* [UnnecessaryLocalBeforeReturn](pmd_rules_java_codestyle.html#unnecessarylocalbeforereturn): Avoid the creation of unnecessary local variables
@@ -106,7 +109,7 @@ folder: pmd/rules
* [UselessParentheses](pmd_rules_java_codestyle.html#uselessparentheses): Useless parentheses should be removed.
* [UselessQualifiedThis](pmd_rules_java_codestyle.html#uselessqualifiedthis): Look for qualified this usages in the same class.
* [VariableNamingConventions](pmd_rules_java_codestyle.html#variablenamingconventions): A variable naming conventions rule - customize this to your liking. Currently, itchecks for fina...
* [WhileLoopsMustUseBraces](pmd_rules_java_codestyle.html#whileloopsmustusebraces): Avoid using 'while' statements without using braces to surround the code block. If the code forma...
* [WhileLoopsMustUseBraces](pmd_rules_java_codestyle.html#whileloopsmustusebraces): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> Avoid using 'while' statements without using braces to surround the code block. If the code forma...
## Design
@@ -117,7 +120,7 @@ folder: pmd/rules
* [AvoidDeeplyNestedIfStmts](pmd_rules_java_design.html#avoiddeeplynestedifstmts): Avoid creating deeply nested if-then statements since they are harder to read and error-prone to ...
* [AvoidRethrowingException](pmd_rules_java_design.html#avoidrethrowingexception): Catch blocks that merely rethrow a caught exception only add to code size and runtime complexity.
* [AvoidThrowingNewInstanceOfSameException](pmd_rules_java_design.html#avoidthrowingnewinstanceofsameexception): Catch blocks that merely rethrow a caught exception wrapped inside a new instance of the same typ...
* [AvoidThrowingNullPointerException](pmd_rules_java_design.html#avoidthrowingnullpointerexception): Avoid throwing NullPointerExceptions. These are confusing because most people will assume that th...
* [AvoidThrowingNullPointerException](pmd_rules_java_design.html#avoidthrowingnullpointerexception): Avoid throwing NullPointerExceptions manually. These are confusing because most people will assum...
* [AvoidThrowingRawExceptionTypes](pmd_rules_java_design.html#avoidthrowingrawexceptiontypes): Avoid throwing certain exception types. Rather than throw a raw RuntimeException, Throwable,Excep...
* [ClassWithOnlyPrivateConstructorsShouldBeFinal](pmd_rules_java_design.html#classwithonlyprivateconstructorsshouldbefinal): A class with only private constructors should be final, unless the private constructoris invoked ...
* [CollapsibleIfStatements](pmd_rules_java_design.html#collapsibleifstatements): Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with...
@@ -213,7 +216,7 @@ folder: pmd/rules
* [DontImportSun](pmd_rules_java_errorprone.html#dontimportsun): Avoid importing anything from the 'sun.' packages. These packages are not portable and are likel...
* [DontUseFloatTypeForLoopIndices](pmd_rules_java_errorprone.html#dontusefloattypeforloopindices): Don't use floating point for loop indices. If you must use floating point, use doubleunless you'r...
* [EmptyCatchBlock](pmd_rules_java_errorprone.html#emptycatchblock): Empty Catch Block finds instances where an exception is caught, but nothing is done. In most cir...
* [EmptyFinalizer](pmd_rules_java_errorprone.html#emptyfinalizer): Empty finalize methods serve no purpose and should be removed.
* [EmptyFinalizer](pmd_rules_java_errorprone.html#emptyfinalizer): Empty finalize methods serve no purpose and should be removed. Note that Oracle has declared Obje...
* [EmptyFinallyBlock](pmd_rules_java_errorprone.html#emptyfinallyblock): Empty finally blocks serve no purpose and should be removed.
* [EmptyIfStmt](pmd_rules_java_errorprone.html#emptyifstmt): Empty If Statement finds instances where a condition is checked but nothing is done about it.
* [EmptyInitializer](pmd_rules_java_errorprone.html#emptyinitializer): Empty initializers serve no purpose and should be removed.
@@ -224,8 +227,8 @@ folder: pmd/rules
* [EmptyTryBlock](pmd_rules_java_errorprone.html#emptytryblock): Avoid empty try blocks - what's the point?
* [EmptyWhileStmt](pmd_rules_java_errorprone.html#emptywhilestmt): Empty While Statement finds all instances where a while statement does nothing. If it is a timin...
* [EqualsNull](pmd_rules_java_errorprone.html#equalsnull): Tests for null should not use the equals() method. The '==' operator should be used instead.
* [FinalizeDoesNotCallSuperFinalize](pmd_rules_java_errorprone.html#finalizedoesnotcallsuperfinalize): If the finalize() is implemented, its last action should be to call super.finalize.
* [FinalizeOnlyCallsSuperFinalize](pmd_rules_java_errorprone.html#finalizeonlycallssuperfinalize): If the finalize() is implemented, it should do something besides just calling super.finalize().
* [FinalizeDoesNotCallSuperFinalize](pmd_rules_java_errorprone.html#finalizedoesnotcallsuperfinalize): If the finalize() is implemented, its last action should be to call super.finalize. Note that Ora...
* [FinalizeOnlyCallsSuperFinalize](pmd_rules_java_errorprone.html#finalizeonlycallssuperfinalize): If the finalize() is implemented, it should do something besides just calling super.finalize(). N...
* [FinalizeOverloaded](pmd_rules_java_errorprone.html#finalizeoverloaded): Methods named finalize() should not have parameters. It is confusing and most likely an attempt ...
* [FinalizeShouldBeProtected](pmd_rules_java_errorprone.html#finalizeshouldbeprotected): When overriding the finalize(), the new method should be set as protected. If made public, other...
* [IdempotentOperations](pmd_rules_java_errorprone.html#idempotentoperations): Avoid idempotent operations - they have no effect.
@@ -291,7 +294,7 @@ folder: pmd/rules
* [AddEmptyString](pmd_rules_java_performance.html#addemptystring): The conversion of literals to strings by concatenating them with empty strings is inefficient.It ...
* [AppendCharacterWithChar](pmd_rules_java_performance.html#appendcharacterwithchar): Avoid concatenating characters as strings in StringBuffer/StringBuilder.append methods.
* [AvoidArrayLoops](pmd_rules_java_performance.html#avoidarrayloops): Instead of manually copying data between two arrays, use the efficient System.arraycopy method in...
* [AvoidArrayLoops](pmd_rules_java_performance.html#avoidarrayloops): Instead of manually copying data between two arrays, use the efficient Arrays.copyOf or System.ar...
* [AvoidFileStream](pmd_rules_java_performance.html#avoidfilestream): The FileInputStream and FileOutputStream classes contains a finalizer method which will cause gar...
* [AvoidInstantiatingObjectsInLoops](pmd_rules_java_performance.html#avoidinstantiatingobjectsinloops): New objects created within loops should be checked to see if they can created outside them and re...
* [AvoidUsingShortType](pmd_rules_java_performance.html#avoidusingshorttype): Java uses the 'short' type to reduce memory usage, not to optimize calculation. In fact, the JVM ...
@@ -299,7 +302,7 @@ folder: pmd/rules
* [BooleanInstantiation](pmd_rules_java_performance.html#booleaninstantiation): Avoid instantiating Boolean objects; you can reference Boolean.TRUE, Boolean.FALSE, or call Boole...
* [ByteInstantiation](pmd_rules_java_performance.html#byteinstantiation): Calling new Byte() causes memory allocation that can be avoided by the static Byte.valueOf().It m...
* [ConsecutiveAppendsShouldReuse](pmd_rules_java_performance.html#consecutiveappendsshouldreuse): Consecutive calls to StringBuffer/StringBuilder .append should be chained, reusing the target obj...
* [ConsecutiveLiteralAppends](pmd_rules_java_performance.html#consecutiveliteralappends): Consecutively calling StringBuffer/StringBuilder.append with String literals
* [ConsecutiveLiteralAppends](pmd_rules_java_performance.html#consecutiveliteralappends): Consecutively calling StringBuffer/StringBuilder.append(...) with literals should be avoided.Sinc...
* [InefficientEmptyStringCheck](pmd_rules_java_performance.html#inefficientemptystringcheck): String.trim().length() is an inefficient way to check if a String is really empty, as itcreates a...
* [InefficientStringBuffering](pmd_rules_java_performance.html#inefficientstringbuffering): Avoid concatenating non-literals in a StringBuffer constructor or append() since intermediate buf...
* [InsufficientStringBufferDeclaration](pmd_rules_java_performance.html#insufficientstringbufferdeclaration): Failing to pre-size a StringBuffer or StringBuilder properly could cause it to re-size many times...
+42 -1
View File
@@ -5,7 +5,7 @@ permalink: pmd_rules_java_bestpractices.html
folder: pmd/rules/java
sidebaractiveurl: /pmd_rules_java.html
editmepath: ../pmd-java/src/main/resources/category/java/bestpractices.xml
keywords: Best Practices, AbstractClassWithoutAbstractMethod, AccessorClassGeneration, AccessorMethodGeneration, ArrayIsStoredDirectly, AvoidPrintStackTrace, AvoidReassigningParameters, AvoidStringBufferField, AvoidUsingHardCodedIP, CheckResultSet, ConstantsInInterface, DefaultLabelNotLastInSwitchStmt, ForLoopCanBeForeach, GuardLogStatement, JUnit4SuitesShouldUseSuiteAnnotation, JUnit4TestShouldUseAfterAnnotation, JUnit4TestShouldUseBeforeAnnotation, JUnit4TestShouldUseTestAnnotation, JUnitAssertionsShouldIncludeMessage, JUnitTestContainsTooManyAsserts, JUnitTestsShouldIncludeAssert, JUnitUseExpected, LooseCoupling, MethodReturnsInternalArray, OneDeclarationPerLine, PositionLiteralsFirstInCaseInsensitiveComparisons, PositionLiteralsFirstInComparisons, PreserveStackTrace, ReplaceEnumerationWithIterator, ReplaceHashtableWithMap, ReplaceVectorWithList, SwitchStmtsShouldHaveDefault, SystemPrintln, UnusedFormalParameter, UnusedImports, UnusedLocalVariable, UnusedPrivateField, UnusedPrivateMethod, UseAssertEqualsInsteadOfAssertTrue, UseAssertNullInsteadOfAssertTrue, UseAssertSameInsteadOfAssertTrue, UseAssertTrueInsteadOfAssertEquals, UseCollectionIsEmpty, UseVarargs
keywords: Best Practices, AbstractClassWithoutAbstractMethod, AccessorClassGeneration, AccessorMethodGeneration, ArrayIsStoredDirectly, AvoidPrintStackTrace, AvoidReassigningParameters, AvoidStringBufferField, AvoidUsingHardCodedIP, CheckResultSet, ConstantsInInterface, DefaultLabelNotLastInSwitchStmt, ForLoopCanBeForeach, GuardLogStatement, JUnit4SuitesShouldUseSuiteAnnotation, JUnit4TestShouldUseAfterAnnotation, JUnit4TestShouldUseBeforeAnnotation, JUnit4TestShouldUseTestAnnotation, JUnitAssertionsShouldIncludeMessage, JUnitTestContainsTooManyAsserts, JUnitTestsShouldIncludeAssert, JUnitUseExpected, LooseCoupling, MethodReturnsInternalArray, MissingOverride, OneDeclarationPerLine, PositionLiteralsFirstInCaseInsensitiveComparisons, PositionLiteralsFirstInComparisons, PreserveStackTrace, ReplaceEnumerationWithIterator, ReplaceHashtableWithMap, ReplaceVectorWithList, SwitchStmtsShouldHaveDefault, SystemPrintln, UnusedFormalParameter, UnusedImports, UnusedLocalVariable, UnusedPrivateField, UnusedPrivateMethod, UseAssertEqualsInsteadOfAssertTrue, UseAssertNullInsteadOfAssertTrue, UseAssertSameInsteadOfAssertTrue, UseAssertTrueInsteadOfAssertEquals, UseCollectionIsEmpty, UseVarargs
---
## AbstractClassWithoutAbstractMethod
@@ -783,6 +783,35 @@ public class SecureSystem {
<rule ref="category/java/bestpractices.xml/MethodReturnsInternalArray" />
```
## MissingOverride
**Since:** PMD 6.2.0
**Priority:** Medium (3)
**Minimum Language Version:** Java 1.5
Annotating overridden methods with @Override ensures at compile time that
the method really overrides one, which helps refactoring and clarifies intent.
**This rule is defined by the following Java class:** [net.sourceforge.pmd.lang.java.rule.bestpractices.MissingOverrideRule](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/MissingOverrideRule.java)
**Example(s):**
``` java
public class Foo implements Runnable {
// This method is overridden, and should have an @Override annotation
public void run() {
}
}
```
**Use this rule by referencing it:**
``` xml
<rule ref="category/java/bestpractices.xml/MissingOverride" />
```
## OneDeclarationPerLine
**Since:** PMD 5.0
@@ -1198,6 +1227,12 @@ public class Something {
}
```
**This rule has the following properties:**
|Name|Default Value|Description|
|----|-------------|-----------|
|ignoredAnnotations|[lombok.Setter, lombok.Getter, lombok.Builder, lombok.Data, lombok.RequiredArgsConstructor, lombok.AllArgsConstructor, lombok.Value, lombok.NoArgsConstructor, java.lang.Deprecated, javafx.fxml.FXML]|Fully qualified names of the annotation types that should be ignored by this rule|
**Use this rule by referencing it:**
``` xml
<rule ref="category/java/bestpractices.xml/UnusedPrivateField" />
@@ -1221,6 +1256,12 @@ public class Something {
}
```
**This rule has the following properties:**
|Name|Default Value|Description|
|----|-------------|-----------|
|ignoredAnnotations|[java.lang.Deprecated]|Fully qualified names of the annotation types that should be ignored by this rule|
**Use this rule by referencing it:**
``` xml
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" />
+115 -1
View File
@@ -5,7 +5,7 @@ permalink: pmd_rules_java_codestyle.html
folder: pmd/rules/java
sidebaractiveurl: /pmd_rules_java.html
editmepath: ../pmd-java/src/main/resources/category/java/codestyle.xml
keywords: Code Style, AbstractNaming, AtLeastOneConstructor, AvoidDollarSigns, AvoidFinalLocalVariable, AvoidPrefixingMethodParameters, AvoidProtectedFieldInFinalClass, AvoidProtectedMethodInFinalClassNotExtending, AvoidUsingNativeCode, BooleanGetMethodName, CallSuperInConstructor, ClassNamingConventions, CommentDefaultAccessModifier, ConfusingTernary, DefaultPackage, DontImportJavaLang, DuplicateImports, EmptyMethodInAbstractClassShouldBeAbstract, ExtendsObject, FieldDeclarationsShouldBeAtStartOfClass, ForLoopShouldBeWhileLoop, ForLoopsMustUseBraces, GenericsNaming, IfElseStmtsMustUseBraces, IfStmtsMustUseBraces, LocalHomeNamingConvention, LocalInterfaceSessionNamingConvention, LocalVariableCouldBeFinal, LongVariable, MDBAndSessionBeanNamingConvention, MethodArgumentCouldBeFinal, MethodNamingConventions, MIsLeadingVariableName, NoPackage, OnlyOneReturn, PackageCase, PrematureDeclaration, RemoteInterfaceNamingConvention, RemoteSessionInterfaceNamingConvention, ShortClassName, ShortMethodName, ShortVariable, SuspiciousConstantFieldName, TooManyStaticImports, UnnecessaryConstructor, UnnecessaryFullyQualifiedName, UnnecessaryLocalBeforeReturn, UnnecessaryModifier, UnnecessaryReturn, UselessParentheses, UselessQualifiedThis, VariableNamingConventions, WhileLoopsMustUseBraces
keywords: Code Style, AbstractNaming, AtLeastOneConstructor, AvoidDollarSigns, AvoidFinalLocalVariable, AvoidPrefixingMethodParameters, AvoidProtectedFieldInFinalClass, AvoidProtectedMethodInFinalClassNotExtending, AvoidUsingNativeCode, BooleanGetMethodName, CallSuperInConstructor, ClassNamingConventions, CommentDefaultAccessModifier, ConfusingTernary, ControlStatementBraces, DefaultPackage, DontImportJavaLang, DuplicateImports, EmptyMethodInAbstractClassShouldBeAbstract, ExtendsObject, FieldDeclarationsShouldBeAtStartOfClass, ForLoopShouldBeWhileLoop, ForLoopsMustUseBraces, GenericsNaming, IfElseStmtsMustUseBraces, IfStmtsMustUseBraces, LocalHomeNamingConvention, LocalInterfaceSessionNamingConvention, LocalVariableCouldBeFinal, LongVariable, MDBAndSessionBeanNamingConvention, MethodArgumentCouldBeFinal, MethodNamingConventions, MIsLeadingVariableName, NoPackage, OnlyOneReturn, PackageCase, PrematureDeclaration, RemoteInterfaceNamingConvention, RemoteSessionInterfaceNamingConvention, ShortClassName, ShortMethodName, ShortVariable, SuspiciousConstantFieldName, TooManyStaticImports, UnnecessaryAnnotationValueElement, UnnecessaryConstructor, UnnecessaryFullyQualifiedName, UnnecessaryLocalBeforeReturn, UnnecessaryModifier, UnnecessaryReturn, UselessParentheses, UselessQualifiedThis, VariableNamingConventions, WhileLoopsMustUseBraces
---
## AbstractNaming
@@ -462,6 +462,65 @@ boolean bar(int x, int y) {
<rule ref="category/java/codestyle.xml/ConfusingTernary" />
```
## ControlStatementBraces
**Since:** PMD 6.2.0
**Priority:** Medium (3)
Enforce a policy for braces on control statements. It is recommended to use braces on 'if ... else'
statements and loop statements, even if they are optional. This usually makes the code clearer, and
helps prepare the future when you need to add another statement. That said, this rule lets you control
which statements are required to have braces via properties.
From 6.2.0 on, this rule supersedes WhileLoopMustUseBraces, ForLoopMustUseBraces, IfStmtMustUseBraces,
and IfElseStmtMustUseBraces.
```
//WhileStatement[$checkWhileStmt and not(Statement/Block) and not($allowEmptyLoop and Statement/EmptyStatement)]
|
//ForStatement[$checkForStmt and not(Statement/Block) and not($allowEmptyLoop and Statement/EmptyStatement)]
|
//DoStatement[$checkDoWhileStmt and not(Statement/Block) and not($allowEmptyLoop and Statement/EmptyStatement)]
|
(: The violation is reported on the sub statement -- not the if statement :)
//Statement[$checkIfElseStmt and parent::IfStatement and not(child::Block or child::IfStatement)]
|
(: Reports case labels if one of their subordinate statements is not braced :)
//SwitchLabel[$checkCaseStmt]
[count(following-sibling::BlockStatement except following-sibling::SwitchLabel[1]/following-sibling::BlockStatement) > 1
or (some $stmt (: in only the block statements until the next label :)
in following-sibling::BlockStatement except following-sibling::SwitchLabel[1]/following-sibling::BlockStatement
satisfies not($stmt/Statement/Block))]
```
**Example(s):**
``` java
while (true) // not recommended
x++;
while (true) { // preferred approach
x++;
}
```
**This rule has the following properties:**
|Name|Default Value|Description|
|----|-------------|-----------|
|checkIfElseStmt|true|Require that 'if ... else' statements use braces|
|checkWhileStmt|true|Require that 'while' loops use braces|
|checkForStmt|true|Require that 'for' loops should use braces|
|checkDoWhileStmt|true|Require that 'do ... while' loops use braces|
|checkCaseStmt|false|Require that cases of a switch have braces|
|allowEmptyLoop|false|Allow loops with an empty statement, e.g. 'while(true);'|
**Use this rule by referencing it:**
``` xml
<rule ref="category/java/codestyle.xml/ControlStatementBraces" />
```
## DefaultPackage
**Since:** PMD 3.4
@@ -682,6 +741,8 @@ public class Foo {
## ForLoopsMustUseBraces
<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f;">Deprecated</span>
**Since:** PMD 0.7
**Priority:** Medium (3)
@@ -749,6 +810,8 @@ public interface GenericDao<EF extends BaseModel, K extends Serializable> {
## IfElseStmtsMustUseBraces
<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f;">Deprecated</span>
**Since:** PMD 0.2
**Priority:** Medium (3)
@@ -784,6 +847,8 @@ if (foo)
## IfStmtsMustUseBraces
<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f;">Deprecated</span>
**Since:** PMD 1.0
**Priority:** Medium (3)
@@ -1431,6 +1496,53 @@ import static Yoko; // Too much !
<rule ref="category/java/codestyle.xml/TooManyStaticImports" />
```
## UnnecessaryAnnotationValueElement
**Since:** PMD 6.2.0
**Priority:** Medium (3)
Avoid the use of value in annotations when it's the only element.
**This rule is defined by the following Java class:** [net.sourceforge.pmd.lang.java.rule.codestyle.UnnecessaryAnnotationValueElementRule](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryAnnotationValueElementRule.java)
**Example(s):**
``` java
@TestClassAnnotation(value = "TEST")
public class Foo {
@TestMemberAnnotation(value = "TEST")
private String y;
@TestMethodAnnotation(value = "TEST")
public void bar() {
int x = 42;
return;
}
}
// should be
@TestClassAnnotation("TEST")
public class Foo {
@TestMemberAnnotation("TEST")
private String y;
@TestMethodAnnotation("TEST")
public void bar() {
int x = 42;
return;
}
}
```
**Use this rule by referencing it:**
``` xml
<rule ref="category/java/codestyle.xml/UnnecessaryAnnotationValueElement" />
```
## UnnecessaryConstructor
**Since:** PMD 1.0
@@ -1771,6 +1883,8 @@ public class Foo {
## WhileLoopsMustUseBraces
<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f;">Deprecated</span>
**Since:** PMD 0.7
**Priority:** Medium (3)
Loaded 30 of 606 files, more files were not shown because too many files have changed in this diff. Show more