An extensible multilanguage static code analyzer.
🎉 After a long time, we're excited to bring you now the next major version of PMD! 🎉
Since this is a big release, we provide here only a concise version of the release notes. We prepared a separate page with the full Detailed Release Notes for PMD 7.0.0.
🤝🙏 Many thanks to all users and contributors who were testing the release candidates and provided feedback and/or PRs!
✨ PMD 7...
💥 Note: Since PMD 7 is a major release, it is not a drop-in replacement for PMD 6.55.0. A detailed documentation of required changes are available in the Migration Guide for PMD 7.
This section lists the most important changes from the last release candidate. The remaining section describes the complete release notes for 7.0.0.
In order to use PMD 7 with maven-pmd-plugin a new compatibility module has been created. This allows to use PMD 7 by simply adding one additional dependency:
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-compat6</artifactId>
<version>${pmdVersion}</version>
</dependency>
It is important to add this dependency as the first in the list, so that maven-pmd-plugin sees the (old) compatible versions of some classes.
This module is available beginning with version 7.0.0-rc4 and will be there at least for the first final version PMD 7 (7.0.0). It's not decided yet, whether we will keep updating it, after PMD 7 is finally released.
Note: This compatibility module only works for the built-in rules, that are still available in PMD 7. E.g. you need to review your rulesets and look out for deprecated rules and such. See the use case I'm using only built-in rules in the Migration Guide for PMD 7.
As PMD 7 revamped the Java module, if you have custom rules, you need to migrate these rules. See the use case I'm using custom rules in the Migration Guide.
Note: Once the default version of PMD is upgraded to PMD7 in maven-pmd-plugin (see MPMD-379), this compatibility module is no longer needed. The module pmd-compat6 might not be maintained then any further, hence it is already declared as deprecated.
No guarantee is given, that the (deprecated) module pmd-compat6 is being maintained over the whole lifetime of PMD 7.
This release of PMD brings support for Java 22. There are the following new standard language features, that are supported now:
PMD also supports the following preview language features:
In order to analyze a project with PMD that uses these language features,
you'll need to enable it via the environment variable PMD_JAVA_OPTS
and select the new language
version 22-preview
:
export PMD_JAVA_OPTS=--enable-preview
pmd check --use-version java-22-preview ...
Note: Support for Java 20 preview language features have been removed. The version "20-preview" is no longer available.
CPD-ON
/CPD-OFF
comment pairs.This PMD release ships a new version of the pmd-designer. The designer artifact has been renamed from "pmd-ui" to "pmd-designer". While the designer still works with Java 8, the recommended Java Runtime is Java 11 (or later) with OpenJFX 17 (or later).
For the detailed changes, see PMD Designer Changelog (7.0.0).
When PMD added Apex support with version 5.5.0, it utilized the Apex Jorje library to parse Apex source and generate an AST. This library is however a binary-blob provided as part of the Salesforce Extensions for VS Code, and it is closed-source.
This causes problems, if binary blobs are not allowed by e.g. a company-wide policy. In that case, the Jorje library prevented that PMD Apex could be used at all.
Also having access to the source code, enhancements and modifications are easier to do.
Under the hood, we use two open source libraries instead:
Although the parser is completely switched, there are only little known changes to the AST. These are documented in the Migration Guide for PMD 7: Apex AST.
With the new Apex parser, the new language constructs like
User Mode Database Operations
and the new Null Coalescing Operator ??
can be parsed now. PMD should be able to parse Apex code up to version 60.0 (Spring '24).
See #3766 for details.
Contributors: Aaron Hurst (@aaronhurst-google), Edward Klimoshenko (@eklimo)
There was an inconsistency between the naming of the maven module and the language id. The language id used the abbreviation "vf", while the maven module used the longer name "visualforce". This has been solved by renaming the language module to its full name "visualforce". The java packages have been renamed as well.
If you import rules, you also need to adjust the paths, e.g.
category/vf/security.xml
➡️ category/visualforce/security.xml
Support for HTML was introduced in PMD 6.55.0 as an experimental feature. With PMD 7.0.0 this is now considered stable.
Support for Kotlin was introduced with PMD 7.0.0-rc1 as an experimental feature. With PMD 7.0.0 this is now considered stable.
The module was named just "vm" which was not a good name. Its module name, language id and package names have been renamed to "velocity".
If you import rules, you also need to adjust the paths, e.g.
category/vm/...
➡️ category/velocity/...
New Rules
OperationWithHighCostInLoop
finds Schema class methods called in a loop, which is a
potential performance issue.UseExplicitTypes
reports usages of var
keyword, which was introduced with Java 10.MissingEncoding
finds XML files without explicit encoding.Changed Rules
EmptyControlStatement
: The rule has a new property to allow empty blocks when
they contain a comment (allowCommentedBlocks
).MethodNamingConventions
: The deprecated rule property skipTestMethodUnderscores
has
been removed. It was actually deprecated since PMD 6.15.0, but was not mentioned in the release notes
back then. Use the property testPattern
instead to configure valid names for test methods.CommentRequired
: The deprecated property headerCommentRequirement
has been removed.
Use the property classCommentRequirement
instead.NonSerializableClass
: The deprecated property prefix
has been removed
without replacement. In a serializable class all fields have to be serializable regardless of the name.Renamed Rulesets
category/vf/security.xml
➡️ category/visualforce/security.xml
category/vm/bestpractices.xml
➡️ category/velocity/bestpractices.xml
category/vm/design.xml
➡️ category/velocity/design.xml
category/vm/errorprone.xml
➡️ category/velocity/errorprone.xml
Removed Rules
The following previously deprecated rules have been finally removed:
OperationWithLimitsInLoop
OperationWithLimitsInLoop
OperationWithLimitsInLoop
NcssCount
NcssCount
NonSerializableClass
EmptyControlStatement
EmptyControlStatement
EmptyControlStatement
EmptyControlStatement
UnnecessarySemicolon
EmptyControlStatement
EmptyControlStatement
EmptyControlStatement
EmptyControlStatement
Removed deprecated rulesets
The following previously deprecated rulesets have been removed. These were the left-over rulesets from PMD 5. The rules have been moved into categories with PMD 6.
n.s.pmd.reporting
packagen.s.pmd.lang.rule
packagecolor
and system property pmd.color
in TextColorRenderer
--no-ruleset-compatibility
--ignore-literals
and --ignore-identifiers
workSee Detailed Release Notes for PMD 7.
The new official logo of PMD:
For more information, see the Detailed Release Notes for PMD 7.
For more information, see the Detailed Release Notes for PMD 7.
Contributors: Clément Fournier (@oowekyala), Andreas Dangel (@adangel), Juan Martín Sotuyo Dodero (@jsotuyod)
pmd
(pmd.bat
for Windows) to launch the different utilities:
pmd check
to run PMD rules and analyze a projectpmd cpd
to run CPD (copy paste detector)pmd designer
to run the PMD Rule Designerpmd check
For more information, see the Detailed Release Notes for PMD 7.
Contributors: Juan Martín Sotuyo Dodero (@jsotuyod)
For more information, see the Detailed Release Notes for PMD 7.
Contributors: Lucas Soncini (@lsoncini), Matías Fraga (@matifraga), Tomás De Lucca (@tomidelucca)
This PMD release ships a new version of the pmd-designer. The designer artifact has been renamed from "pmd-ui" to "pmd-designer". While the designer still works with Java 8, the recommended Java Runtime is Java 11 (or later) with OpenJFX 17 (or later).
For the detailed changes, see
Thanks to @mohan-chinnappan-n a new CPD report format has been added which features a data table. It uses an XSLT stylesheet to convert CPD's XML format into HTML.
See the example report.
Contributors: Mohan Chinnappan (@mohan-chinnappan-n)
Note that this is just a concise listing of the highlights. For more information on the languages, see the Detailed Release Notes for PMD 7.
PMD supported Apache Velocity for a very long time, but the CPD integration never got finished.
This is now done and CPD supports Apache Velocity Template language for detecting copy and paste.
It is shipped in the module pmd-velocity
.
Thanks to a contribution, CPD now supports Coco, a modern programming language
designed specifically for building event-driven software. It is shipped in the new
module pmd-coco
.
Contributors: Wener (@wener-tiobe)
Thanks to a contribution, CPD now supports the Julia language. It is shipped
in the new module pmd-julia
.
Contributors: Wener (@wener-tiobe)
Thanks to a contribution, CPD now supports the TypeScript language. It is shipped
with the rest of the JavaScript support in the module pmd-javascript
.
Contributors: Paul Guyot (@pguyot)
This release of PMD brings support for Java 21 and 22. There are the following new standard language features, that are supported now:
PMD also supports the following preview language features:
In order to analyze a project with PMD that uses these preview language features,
you'll need to enable it via the environment variable PMD_JAVA_OPTS
and select the new language
version 22-preview
:
export PMD_JAVA_OPTS=--enable-preview
pmd check --use-version java-22-preview ...
Note: Support for Java 19 and Java 20 preview language features have been removed. The versions "19-preview" and "20-preview" are no longer available.
Contributors: Jeroen Borgers (@jborgers), Peter Paul Bakker (@stokpop)
Contributors: Lucas Soncini (@lsoncini), Matías Fraga (@matifraga), Tomás De Lucca (@tomidelucca)
When PMD added Apex support with version 5.5.0, it utilized the Apex Jorje library to parse Apex source and generate an AST. This library is however a binary-blob provided as part of the Salesforce Extensions for VS Code, and it is closed-source.
This causes problems, if binary blobs are not allowed by e.g. a company-wide policy. In that case, the Jorje library prevented that PMD Apex could be used at all.
Also having access to the source code, enhancements and modifications are easier to do.
Under the hood, we use two open source libraries instead:
Although the parsers is completely switched, there are only little known changes to the AST.
These are documented in the Migration Guide for PMD 7: Apex AST.
With the new Apex parser, the new language constructs like
User Mode Database Operations
and the new Null Coalescing Operator ??
can be parsed now. PMD should be able to parse Apex code up to version 60.0 (Spring '24).
See #3766 for details.
Contributors: Aaron Hurst (@aaronhurst-google), Edward Klimoshenko (@eklimo)
--ignore-sequences
.--ignore-literal-sequences
, only
literals were ignored. The new option additionally ignores identifiers as well in sequences.Contributors: Wener (@wener-tiobe)
CPD-ON
/CPD-OFF
comment pairs.Contributors: Juan Martín Sotuyo Dodero (@jsotuyod)
Support for HTML was introduced in PMD 6.55.0 as an experimental feature. With PMD 7.0.0 this is now considered stable.
minimumLanguageVersion
and
maximumLanguageVersion
attributes.IntProperty
and StringProperty
have been removed. Please use
PropertyFactory
to create properties.,
) as a delimiter. The previous default was a
pipe character (|
). The delimiter is not configurable anymore. If needed, the comma can be escaped
with a backslash.min
and max
attributes in property definitions in the XML are now optional and can appear separately
or be omitted.The module was named just "vm" which was not a good name. Its module name, language id and package names have been renamed to "velocity".
If you import rules, you also need to adjust the paths, e.g.
category/vm/...
➡️ category/velocity/...
There was an inconsistency between the naming of the maven module and the language id. The language id used the abbreviation "vf", while the maven module used the longer name "visualforce". This has been solved by renaming the language module to its full name "visualforce". The java packages have been renamed as well.
If you import rules, you also need to adjust the paths, e.g.
category/vf/security.xml
➡️ category/visualforce/security.xml
Apex
OperationWithHighCostInLoop
finds Schema class methods called in a loop, which is a
potential performance issue.UnusedMethod
finds unused methods in your code.Java
UnnecessaryBoxing
reports boxing and unboxing conversions that may be made implicit.UseExplicitTypes
reports usages of var
keyword, which was introduced with Java 10.Kotlin
FunctionNameTooShort
finds functions with a too short name.OverrideBothEqualsAndHashcode
finds classes with only
either equals
or hashCode
overridden, but not both. This leads to unexpected behavior once instances
of such classes are used in collections (Lists, HashMaps, ...).Swift
ForceCast
flags all force casts, making sure you are
defensively considering all types. Having the application crash shouldn't be an option.ForceTry
flags all force tries, making sure you are
defensively handling exceptions. Having the application crash shouldn't be an option.ProhibitedInterfaceBuilder
flags any usage of interface
builder. Interface builder files are prone to merge conflicts, and are impossible to code review, so larger
teams usually try to avoid it or reduce its usage.UnavailableFunction
flags any function throwing
a fatalError
not marked as @available(*, unavailable)
to ensure no calls are actually performed in
the codebase.XML
MissingEncoding
finds XML files without explicit encoding.The information about changed rules, removed rules and rulesets can be found in the Detailed Release Notes for PMD 7.
The API of PMD has been growing over the years and needed some cleanup. The goal is, to have a clear separation between a well-defined API and the implementation, which is internal. This should help us in future development.
Also, there are some improvement and changes in different areas. For the detailed description of the changes listed here, see Detailed Release Notes for PMD 7.
A detailed documentation of required changes are available in the Migration Guide for PMD 7.
See also Detailed Release Notes for PMD 7.
More than 300 issues have been fixed in PMD 7. See Detailed Release Notes for PMD 7 for the complete list of fixed issues.
Many thanks to the following contributors: @219sansim, @aaronhurst-google, @anastasiia-koba, @AndreyBozhko, @bergander, @ciufudean, @cyw3, @dague1, @Debamoy, @eklimo, @ethauvin, @JerritEic, @joaodinissf, @kenji21, @krdabrowski, @lbovet, @lsoncini, @LynnBroe, @marcindabrowski, @matifraga, @mohan-chinnappan-n, @mohui1999, @nawforce, @nirvikpatel, @nwcm, @oleksandr-shvets, @pguyot, @PimvanderLoos, @rcorfieldffdc, @sfdcsteve, @shai-bennathan, @tomidelucca, @tprouvot, @wener-tiobe.
See Detailed Release Notes for PMD 7 for the full list of PRs.
We're excited to bring you the next major version of PMD!
Since this is a big release, we provide here only a concise version of the release notes. We prepared a separate page with the full Detailed Release Notes for PMD 7.0.0.
PMD 7.0.0 is finally almost ready. In order to gather feedback, we are going to ship a couple of release candidates. These are officially available on GitHub and Maven Central and can be used as usual (e.g. as a dependency). We encourage you to try out the new features, but keep in mind that we may introduce API breaking changes between the release candidates. It should be stable enough if you don't use custom rules.
We have still some tasks planned for the next release candidates. You can see the progress in PMD 7 Tracking Issue #3898.
If you find any problem or difficulty while updating from PMD 6, please provide feedback via our issue tracker. That way we can improve the experience for all.
The new official logo of PMD:
For more information, see the Detailed Release Notes for PMD 7.
Contributors: Clément Fournier (@oowekyala), Andreas Dangel (@adangel), Juan Martín Sotuyo Dodero (@jsotuyod)
pmd
(pmd.bat
for Windows) to launch the different utilities:
pmd check
to run PMD rules and analyze a projectpmd cpd
to run CPD (copy paste detector)pmd designer
to run the PMD Rule Designerpmd check
For more information, see the Detailed Release Notes for PMD 7.
Contributors: Juan Martín Sotuyo Dodero (@jsotuyod)
For more information, see the Detailed Release Notes for PMD 7.
Contributors: Lucas Soncini (@lsoncini), Matías Fraga (@matifraga), Tomás De Lucca (@tomidelucca)
Note that this is just a concise listing of the highlight. For more information on the languages, see the Detailed Release Notes for PMD 7.
Contributors: Lucas Soncini (@lsoncini), Matías Fraga (@matifraga), Tomás De Lucca (@tomidelucca)
minimumLanguageVersion
and
maximumLanguageVersion
attributes.Apex
UnusedMethod
finds unused methods in your code.Java
UnnecessaryBoxing
reports boxing and unboxing conversions that may be made implicit.Kotlin
Swift
Java
UnnecessaryFullyQualifiedName
: the rule has two new properties,
to selectively disable reporting on static field and method qualifiers. The rule also has been improved
to be more precise.UselessParentheses
: the rule has two new properties which control how strict
the rule should be applied. With ignoreClarifying
(default: true) parentheses that are strictly speaking
not necessary are allowed, if they separate expressions of different precedence.
The other property ignoreBalancing
(default: true) is similar, in that it allows parentheses that help
reading and understanding the expressions.LooseCoupling
: the rule has a new property to allow some types to be coupled
to (allowedTypes
).EmptyCatchBlock
: CloneNotSupportedException
and InterruptedException
are not
special-cased anymore. Rename the exception parameter to ignored
to ignore them.DontImportSun
: sun.misc.Signal
is not special-cased anymore.UseDiamondOperator
: the property java7Compatibility
is removed. The rule now
handles Java 7 properly without a property.SingularField
: Properties checkInnerClasses
and disallowNotAssignment
are removed.
The rule is now more precise and will check these cases properly.UseUtilityClass
: The property ignoredAnnotations
has been removed.LawOfDemeter
: the rule has a new property trustRadius
. This defines the maximum degree
of trusted data. The default of 1 is the most restrictive.CommentContent
: The properties caseSensitive
and disallowedTerms
are removed. The
new property fobiddenRegex
can be used now to define the disallowed terms with a single regular
expression.Many rules, that were previously deprecated have been finally removed. See Detailed Release Notes for PMD 7 for the complete list.
The API of PMD has been growing over the years and needed some cleanup. The goal is, to have a clear separation between a well-defined API and the implementation, which is internal. This should help us in future development.
Also, there are some improvement and changes in different areas. For the detailed description of the changes listed here, see Detailed Release Notes for PMD 7.
See Detailed Release Notes for PMD 7.
isFindBoundary
should not be an attributeLanguage specific fixes:
@SuppressWarnings
with constants instead of literalsisOverridden
in ASTMethodDeclarationfoo.bar().size()
Throwable.addSuppressed(...)
new BigDecimal(Expression)
The PMD team is pleased to announce PMD 6.55.0.
This is a minor release.
This release is the last planned release of PMD 6. The first version 6.0.0 was released in December 2017. Over the course of more than 5 years we published almost every month a new minor version of PMD 6 with new features and improvements.
Already in November 2018 we started in parallel the development of the next major version 7.0.0, and we are now in the process of finalizing the scope of the major version. We want to release a couple of release candidates before publishing the final version 7.0.0.
We plan to release 7.0.0-rc1 soon. You can see the progress in PMD 7 Tracking Issue #3898.
This release of PMD brings support for Java 20. There are no new standard language features.
PMD supports JEP 433: Pattern Matching for switch (Fourth Preview) and JEP 432: Record Patterns (Second Preview) as preview language features.
In order to analyze a project with PMD that uses these language features,
you'll need to enable it via the environment variable PMD_JAVA_OPTS
and select the new language
version 20-preview
:
export PMD_JAVA_OPTS=--enable-preview
./run.sh pmd --use-version java-20-preview ...
Thanks to the contribution from Paul Guyot PMD now has CPD support for T-SQL (Transact-SQL).
Being based on a proper Antlr grammar, CPD can:
net.sourceforge.pmd.lang.java.ast.ASTGuardedPattern
has been removed.The PMD team is pleased to announce PMD 6.54.0.
This is a minor release.
Thanks to @mohan-chinnappan-n a new PMD report format has been added which features a data table with charting functions. It uses an XSLT stylesheet to convert PMD's XML format into HTML.
See the example report.
--relativize-paths-with
flag (or short -z
), which replaces --short-names
.
It serves the same purpose: Shortening the pathnames in the reports. However, with the new flag it's possible
to explicitly define one or more pathnames that should be used as the base when creating relative paths.
The old flag --short-names
is deprecated.ApexRootNode#getApexVersion
has been deprecated for removal. The version returned is
always Version.CURRENT
, as the apex compiler integration doesn't use additional information which Apex version
actually is used. Therefore, this method can't be used to determine the Apex version of the project
that is being analyzed.
CPDConfiguration#setEncoding
and
CPDConfiguration#getEncoding
. Use the methods
getSourceEncoding
and
setSourceEncoding
instead. Both are available
for CPDConfiguration
which extends AbstractConfiguration
.
BaseCLITest
and BaseCPDCLITest
have been deprecated for removal without
replacement. CLI tests should be done in pmd-core only (and in PMD7 in pmd-cli). Individual language modules
shouldn't need to test the CLI integration logic again. Instead, the individual language modules should test their
functionality as unit tests.
FileCollector#addZipFile
has been deprecated. It is replaced
by FileCollector#addZipFileWithContent
which directly adds the
content of the zip file for analysis.
PMDConfiguration#setReportShortNames
and
PMDConfiguration#isReportShortNames
have been deprecated for removal.
Use PMDConfiguration#addRelativizeRoot
instead.
CSVWriter
AbstractAntTestHelper
filterMatches
creates a new CPD report
with some matches removed with a given predicate based filter.The PMD team is pleased to announce PMD 6.53.0.
This is a minor release.
UnusedPrivateField
has a new property reportForAnnotations
.
This is a list of fully qualified names of the annotation types that should be reported anyway. If an unused field
has any of these annotations, then it is reported. If it has any other annotation, then it is still considered
to be used and is not reported.The Java rules ExcessiveClassLength
and ExcessiveMethodLength
have been deprecated. The rule NcssCount
can be used instead.
The deprecated rules will be removed with PMD 7.0.0.
The Java rule EmptyStatementNotInLoop
is deprecated.
Use the rule UnnecessarySemicolon
instead.
Note: Actually it was announced to be deprecated since 6.46.0 but the rule was not marked as deprecated yet.
This has been done now.
These classes / APIs have been deprecated and will be removed with PMD 7.0.0.
ExcessiveLengthRule
(Java)The PMD team is pleased to announce PMD 6.52.0.
This is a minor release.
InvalidJavaBean
identifies beans, that don't follow the JavaBeans API specification,
like beans with missing getters or setters.<rule ref="category/java/design.xml/InvalidJavaBean"/>
The Java rule BeanMembersShouldSerialize
has been renamed to
NonSerializableClass
. It has been revamped to only check for classes that are marked with
Serializable
and reports each field in it, that is not serializable.
The property prefix
has been deprecated, since in a serializable class all fields have to be
serializable regardless of the name.
The rule ClassNamingConventions
has a new property testClassPattern
, which is applied
to test classes. By default, test classes should end with the suffix "Test". Test classes are top-level classes, that
either inherit from JUnit 3 TestCase or have at least one method annotated with the Test annotations from
JUnit4/5 or TestNG.
The property ignoredAnnotations
of rule ImmutableField
has been deprecated and doesn't
have any effect anymore.
Since PMD 6.47.0, the rule only considers fields, that are initialized once and never changed. If the field is just
declared but never explicitly initialized, it won't be reported. That's the typical case when a framework sets
the field value by reflection. Therefore, the property is not needed anymore. If there is a special case where
this rule misidentifies fields as immutable, then the rule should be suppressed for these fields explicitly.
ignoredAnnotations
PMD now supports a new --use-version
flag, which receives a language-version pair (such as java-8
or apex-54
).
This supersedes the usage of -language
/ -l
and -version
/ -v
, allowing for multiple versions to be set in a single run.
PMD 7 will completely remove support for -language
and -version
in favor of this new flag.
Support for -V
is being deprecated in favor of --verbose
in preparation for PMD 7.
In PMD 7, -v
will enable verbose mode and -V
will show the PMD version for consistency with most Unix/Linux tools.
Support for -min
is being deprecated in favor of --minimum-priority
for consistency with most Unix/Linux tools, where -min
would be equivalent to -m -i -n
.
-d
or --dir
as an alias to --files
, in favor of consistency with PMD.
PMD 7 will remove support for --files
in favor of these new flags.Using run.sh cpdgui
will now warn about it being deprecated. Use run.sh cpd-gui
instead.
The old designer (run.sh designerold
) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer: run.sh designer
.
The old visual AST viewer (run.sh bgastviewer
) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer: run.sh designer
for a visual tool, or use run.sh ast-dump
for a text-based alternative.
The following core APIs have been marked as deprecated for removal in PMD 7:
PMD
and PMD.StatusCode
- PMD 7 will ship with a revamped CLI split from pmd-core. To programmatically launch analysis you can use PmdAnalysis
.PMDConfiguration#getAllInputPaths
- It is now superseded by PMDConfiguration#getInputPathList
PMDConfiguration#setInputPaths
- It is now superseded by PMDConfiguration#setInputPathList
PMDConfiguration#addInputPath
- It is now superseded by PMDConfiguration#addInputPath
PMDConfiguration#getInputFilePath
- It is now superseded by PMDConfiguration#getInputFile
PMDConfiguration#getIgnoreFilePath
- It is now superseded by PMDConfiguration#getIgnoreFile
PMDConfiguration#setInputFilePath
- It is now superseded by PMDConfiguration#setInputFilePath
PMDConfiguration#setIgnoreFilePath
- It is now superseded by PMDConfiguration#setIgnoreFilePath
PMDConfiguration#getInputUri
- It is now superseded by PMDConfiguration#getUri
PMDConfiguration#setInputUri
- It is now superseded by PMDConfiguration#setInputUri
PMDConfiguration#getReportFile
- It is now superseded by PMDConfiguration#getReportFilePath
PMDConfiguration#setReportFile
- It is now superseded by PMDConfiguration#setReportFile
PMDConfiguration#isStressTest
and PMDConfiguration#setStressTest
- Will be removed with no replacement.PMDConfiguration#isBenchmark
and PMDConfiguration#setBenchmark
- Will be removed with no replacement, the CLI will still support it.CPD
and CPD.StatusCode
- PMD 7 will ship with a revamped CLI split from pmd-core. An alterative to programatically launch CPD analysis will be added in due time.In order to reduce the dependency on Apex Jorje classes, the method DataType#fromBasicType
has been deprecated. The equivalent method fromTypeName
should be used instead.
The PMD team is pleased to announce PMD 6.51.0.
This is a minor release.
ApexUnitTestClassShouldHaveRunAs
ensures that unit tests
use System.runAs()
at least once. This makes the tests more robust, and independent from the user running it.<rule ref="category/apex/bestpractices.xml/ApexUnitTestClassShouldHaveRunAs"/>
The rule is part of the quickstart.xml ruleset.
TestClassWithoutTestCases
has a new property testClassPattern
. This is
used to detect empty test classes by name. Previously this rule could only detect empty JUnit3 test cases
properly. To switch back to the old behavior, this property can be set to an empty value which disables the
test class detection by pattern.No changes.