PMD is a static source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, and so forth. It’s mainly concerned with Java and Apex, but supports six other languages.
PMD features many built-in checks (in PMD lingo, rules), which are documented for each language in our Rule references. Also support an extensive API to write your own rules, which you can do either in Java or as a self-contained XPath query.
PMD is most useful when integrated into your build process. It can then be used as a quality gate, to enforce a coding standard for your codebase. Among other things, PMD can be run:
- As a Maven goal
- As an Ant task
- As a Gradle task
- From command-line
CPD, the copy-paste detector, is also distributed with PMD. You can also use it in a variety of ways
Screenshots are not available
CPD now supports Kotlin. This means, you can use CPD to find duplicated code in your Kotlin projects.
– The new Java rule UseUnderscoresInNumericLiterals (java-codestyle) verifies that numeric literals over a given length (4 chars by default, but configurable) are using underscores every 3 digits for readability. The rule only applies to Java 7+ codebases.
– The Java rule JUnitTestsShouldIncludeAssert (java-bestpractices) now also detects Soft Assertions.
– The property exceptionfile of the rule AvoidDuplicateLiterals (java-errorprone) has been deprecated and will be removed with 7.0.0. Please use exceptionList instead.
– [doc] Keep record of every currently deprecated API
– [test] Kotlin DSL to ease test writing
– [ci] Building docs for release fails
– [doc] Documentation Error with Regex Properties
– [doc] Missing escaping leads to XSS
– [core] XMLRenderer: ProcessingErrors from exceptions without a message missing
– [core] Analysis cache fails with wildcard classpath entries
– [java] Intermittent PMD failure : PMD processing errors while no violations reported
– [java] JUnitTestsShouldIncludeAssertRule should support this.exception as well as just exception
– [java] JUnitTestsShouldIncludeAssert: Support AssertJ soft assertions
– [java] Detector for large numbers not separated by _
– [java] false positive for UselessQualifiedThis
– [java] CommentDefaultAccessModifierRule shows incorrect message
– [java] ImmutableField false positive with multiple constructors
– [java] Cyclo metric should count conditions of for statements correctly
– [java] InvalidSlf4jMessageFormatRule causes NPE in lambda and static blocks
– [plsql] ParseException for IF/CASE statement with >=, <=, !=