30 April 2022
The PMD team is pleased to announce PMD 6.45.0.
This is a minor release.
Help shape the future of PMD by telling us how you use it.
Our little survey is still open in case you didn’t participate yet. Please participate in our survey at https://forms.gle/4d8r1a1RDzfixHDc7.
Thank you!
This version of PMD ships a new language module to support analyzing of HTML. Support for HTML is experimental and might change without notice. The language implementation is not complete yet and the AST doesn’t look well for text nodes and comment nodes and might be changed in the future. You can write your own rules, but we don’t guarantee that the rules work with the next (minor) version of PMD without adjustments.
Please give us feedback about how practical this new language is in discussions. Please report missing features or bugs as new issues.
AvoidInlineStyles
finds elements which use a style attribute.
In order to help maintaining a webpage it is considered good practice to separate content and styles. Instead
of inline styles one should use CSS files and classes. <rule ref="category/html/bestpractices.xml/AvoidInlineStyles" />
UnnecessaryTypeAttribute
finds “link” and “script” elements which
still have a “type” attribute. This is not necessary anymore since modern browsers automatically use CSS and
JavaScript. <rule ref="category/html/bestpractices.xml/UnnecessaryTypeAttribute" />
UseAltAttributeForImages
finds “img” elements without an “alt”
attribute. An alternate text should always be provided in order to help screen readers. <rule ref="category/html/bestpractices.xml/UseAltAttributeForImages" />
UnusedPrivateField
has a new property ignoredFieldNames
.
The default ignores serialization-specific fields (eg serialVersionUID
).
The property can be used to ignore more fields based on their name.
Note that the rule used to ignore fields named IDENT
, but doesn’t anymore (add this value to the property to restore the old behaviour).Report#filterViolations
creates a new report with
some violations removed with a given predicate based filter.Report#union
can combine two reports into a single new Report.net.sourceforge.pmd.util.Predicate
will be replaced in PMD7 with the standard Predicate interface from java8.pmd-html
is entirely experimental right now. Anything in the package
net.sourceforge.pmd.lang.html
should be used cautiously.