Re: [pmd-devel] [ANNOUNCE] PMD 6.35.0 released
A source code analyzer
Brought to you by:
adangel,
juansotuyo
|
From: LINUS F. <lin...@gm...> - 2021-05-29 09:00:51
|
A minor release? Three new rules. Fundu, baba!!! On Sat, 29 May 2021, 11:39 Andreas Dangel, <and...@pm...> wrote: > > - Downloads: > https://github.com/pmd/pmd/releases/tag/pmd_releases%2F6.35.0 > - Documentation: https://pmd.github.io/pmd-6.35.0/ > > 29-May-2021 - 6.35.0 > > The PMD team is pleased to announce PMD 6.35.0. > > This is a minor release. > Table Of Contents > > - New and noteworthy > <https://sourceforge.net/p/pmd/news/2021/05/pmd-6350-29-may-2021-released/#new-and-noteworthy> > - Javascript module now requires at least Java 8 > <https://sourceforge.net/p/pmd/news/2021/05/pmd-6350-29-may-2021-released/#javascript-module-now-requires-at-least-java-8> > - New rules > <https://sourceforge.net/p/pmd/news/2021/05/pmd-6350-29-may-2021-released/#new-rules> > - Modified rules > <https://sourceforge.net/p/pmd/news/2021/05/pmd-6350-29-may-2021-released/#modified-rules> > - Deprecated rules > <https://sourceforge.net/p/pmd/news/2021/05/pmd-6350-29-may-2021-released/#deprecated-rules> > - Fixed Issues > <https://sourceforge.net/p/pmd/news/2021/05/pmd-6350-29-may-2021-released/#fixed-issues> > - API Changes > <https://sourceforge.net/p/pmd/news/2021/05/pmd-6350-29-may-2021-released/#api-changes> > - Deprecated API > <https://sourceforge.net/p/pmd/news/2021/05/pmd-6350-29-may-2021-released/#deprecated-api> > - External Contributions > <https://sourceforge.net/p/pmd/news/2021/05/pmd-6350-29-may-2021-released/#external-contributions> > - Stats > <https://sourceforge.net/p/pmd/news/2021/05/pmd-6350-29-may-2021-released/#stats> > > New and noteworthy Javascript module now requires at least Java 8 > > The latest version of Rhino <https://github.com/mozilla/rhino>, the > implementation of JavaScript we use > for parsing JavaScript code, requires at least Java 8. Therefore we > decided to upgrade the pmd-javascript > module to Java 8 as well. This means that from now on, a Java 8 or later > runtime is required in order > to analyze JavaScript code. Note that PMD core still only requires Java 7. > New rules > > This release ships with 3 new Java rules. > > - JUnit5TestShouldBePackagePrivate > <https://pmd.github.io/pmd-6.35.0/pmd_rules_java_bestpractices.html#junit5testshouldbepackageprivate> > enforces the convention that JUnit 5 tests should have minimal > visibility. > You can try out this rule like so: > > <rule ref="category/java/bestpractices.xml/JUnit5TestShouldBePackagePrivate" /> > > > - CognitiveComplexity > <https://pmd.github.io/pmd-6.35.0/pmd_rules_java_design.html#cognitivecomplexity> > uses the cognitive complexity > metric to find overly complex code. This metric improves on the > similar cyclomatic complexity > in several ways, for instance, it incentivizes using clearly readable > shorthands and idioms. > See the rule documentation for more details. You can try out this rule > like so: > > <rule ref="category/java/design.xml/CognitiveComplexity" /> > > > - MutableStaticState > <https://pmd.github.io/pmd-6.35.0/pmd_rules_java_design.html#mutablestaticstate> > finds non-private static fields > that are not final. These fields break encapsulation since these > fields can be modified from anywhere > within the program. You can try out this rule like so: > > <rule ref="category/java/design.xml/MutableStaticState" /> > > Modified rules > > - The Java rule CompareObjectsWithEquals > <https://pmd.github.io/pmd-6.35.0/pmd_rules_java_errorprone.html#compareobjectswithequals> > has now a new property > typesThatCompareByReference. With that property, you can configure > types, that should be whitelisted > for comparison by reference. By default, java.lang.Enum and > java.lang.Class are allowed, but > you could add custom types here. > Additionally comparisons against constants are allowed now. This makes > the rule less noisy when two constants > are compared. Constants are identified by looking for an all-caps > identifier. > > Deprecated rules > > - > > The java rule DefaultPackage > <https://pmd.github.io/pmd-6.35.0/pmd_rules_java_codestyle.html#defaultpackage> > has been deprecated in favor of > CommentDefaultAccessModifier > <https://pmd.github.io/pmd-6.35.0/pmd_rules_java_codestyle.html#commentdefaultaccessmodifier> > . > > The rule "DefaultPackage" assumes that any usage of package-access is > accidental, > and by doing so, prohibits using a really fundamental and useful > feature of the language. > > To satisfy the rule, you have to make the member public even if it > doesn't need to, or make it protected, > which muddies your intent even more if you don't intend the class to > be extended, and may be at odds with > other rules like AvoidProtectedFieldInFinalClass > <https://pmd.github.io/pmd-6.35.0/pmd_rules_java_codestyle.html#avoidprotectedfieldinfinalclass> > . > > The rule CommentDefaultAccessModifier > <https://pmd.github.io/pmd-6.35.0/pmd_rules_java_codestyle.html#commentdefaultaccessmodifier> > should be used instead. > It flags the same thing, but has an escape hatch. > - > > The Java rule CloneThrowsCloneNotSupportedException > <https://pmd.github.io/pmd-6.35.0/pmd_rules_java_errorprone.html#clonethrowsclonenotsupportedexception> > has been deprecated without > replacement. > > The rule has no real value as CloneNotSupportedException is a > checked exception and therefore you need to deal with it while > implementing the clone() method. You either > need to declare the exception or catch it. If you catch it, then > subclasses can't throw it themselves explicitly. > However, Object.clone() will still throw this exception if the > Cloneable interface is not implemented. > > Note, this rule has also been removed from the Quickstart Ruleset ( > rulesets/java/quickstart.xml). > > Fixed Issues > > - apex > - #3183 <https://github.com/pmd/pmd/issues/3183>: [apex] > ApexUnitTestMethodShouldHaveIsTestAnnotation false positive with helper > method > - #3243 <https://github.com/pmd/pmd/pull/3243>: [apex] Correct > findBoundary when traversing AST > - core > - #2639 <https://github.com/pmd/pmd/issues/2639>: [core] PMD CLI > output file is not created if directory or directories in path don't exist > - #3196 <https://github.com/pmd/pmd/issues/3196>: [core] Deprecate > ThreadSafeReportListener > - doc > - #3230 <https://github.com/pmd/pmd/issues/3230>: [doc] Remove > "Edit me" button for language index pages > - dist > - #2466 <https://github.com/pmd/pmd/issues/2466>: [dist] > Distribution archive doesn't include all batch scripts > - java > - #3269 <https://github.com/pmd/pmd/pull/3269>: [java] Fix NPE in > MethodTypeResolution > - java-bestpractices > - #1175 <https://github.com/pmd/pmd/issues/1175>: [java] > UnusedPrivateMethod FP with Junit 5 @MethodSource > - #2219 <https://github.com/pmd/pmd/issues/2219>: [java] Document > Reasons to Avoid Reassigning Parameters > - #2737 <https://github.com/pmd/pmd/issues/2737>: [java] Fix > misleading rule message on rule SwitchStmtsShouldHaveDefault with > non-exhaustive enum switch > - #3236 <https://github.com/pmd/pmd/issues/3236>: [java] > LiteralsFirstInComparisons should consider constant fields (cont'd) > - #3239 <https://github.com/pmd/pmd/issues/3239>: [java] PMD could > enforce non-public methods for Junit5 / Jupiter test methods > - #3254 <https://github.com/pmd/pmd/issues/3254>: [java] > AvoidReassigningParameters reports violations on wrong line numbers > - java-codestyle > - #2655 <https://github.com/pmd/pmd/issues/2655>: [java] > UnnecessaryImport false positive for on-demand imports > - #3206 <https://github.com/pmd/pmd/issues/3206>: [java] Deprecate > rule DefaultPackage > - #3262 <https://github.com/pmd/pmd/pull/3262>: [java] > FieldDeclarationsShouldBeAtStartOfClass: false negative with anon classes > - #3265 <https://github.com/pmd/pmd/pull/3265>: [java] > MethodArgumentCouldBeFinal: false negatives with interfaces and inner > classes > - #3266 <https://github.com/pmd/pmd/pull/3266>: [java] > LocalVariableCouldBeFinal: false negatives with interfaces, anon classes > - #3274 <https://github.com/pmd/pmd/pull/3274>: [java] > OnlyOneReturn: false negative with anonymous class > - #3275 <https://github.com/pmd/pmd/pull/3275>: [java] > UnnecessaryLocalBeforeReturn: false negatives with lambda and anon class > - java-design > - #2780 <https://github.com/pmd/pmd/issues/2780>: [java] DataClass > example from documentation results in false-negative > - #2987 <https://github.com/pmd/pmd/issues/2987>: [java] New Rule: > Public and protected static fields must be final > - #2329 <https://github.com/pmd/pmd/issues/2329>: [java] Cognitive > complexity rule for Java > - java-errorprone > - #3110 <https://github.com/pmd/pmd/issues/3110>: [java] Enhance > CompareObjectsWithEquals with list of exceptions > - #3112 <https://github.com/pmd/pmd/issues/3112>: [java] Deprecate > rule CloneThrowsCloneNotSupportedException > - #3205 <https://github.com/pmd/pmd/issues/3205>: [java] Make > CompareObjectWithEquals allow comparing against constants > - #3248 <https://github.com/pmd/pmd/issues/3248>: [java] > Documentation is wrong for SingletonClassReturningNewInstance rule > - #3249 <https://github.com/pmd/pmd/pull/3249>: [java] > AvoidFieldNameMatchingTypeName: False negative with interfaces > - #3268 <https://github.com/pmd/pmd/pull/3268>: [java] > ConstructorCallsOverridableMethod: IndexOutOfBoundsException with > annotations > - java-performance > - #1438 <https://github.com/pmd/pmd/issues/1438>: [java] > InsufficientStringBufferDeclaration false positive for initial calculated > StringBuilder size > - javascript > - #699 <https://github.com/pmd/pmd/issues/699>: [javascript] Update > Rhino library to 1.7.13 > - #2081 <https://github.com/pmd/pmd/issues/2081>: [javascript] > Failing with OutOfMemoryError parsing a Javascript file > > API Changes Deprecated API > > - PMD#doPMD > <https://docs.pmd-code.org/apidocs/pmd-core/6.35.0/net/sourceforge/pmd/PMD.html#doPMD(net.sourceforge.pmd.PMDConfiguration)> > is deprecated. > Use PMD#runPMD > <https://docs.pmd-code.org/apidocs/pmd-core/6.35.0/net/sourceforge/pmd/PMD.html#runPMD(net.sourceforge.pmd.PMDConfiguration)> > instead. > - PMD#run > <https://docs.pmd-code.org/apidocs/pmd-core/6.35.0/net/sourceforge/pmd/PMD.html#run(java.lang.String[])> > is deprecated. > Use PMD#runPMD > <https://docs.pmd-code.org/apidocs/pmd-core/6.35.0/net/sourceforge/pmd/PMD.html#runPMD(java.lang.String...)> > instead. > - ThreadSafeReportListener > <https://docs.pmd-code.org/apidocs/pmd-core/6.35.0/net/sourceforge/pmd/ThreadSafeReportListener.html#> > and the methods to use them in Report > <https://docs.pmd-code.org/apidocs/pmd-core/6.35.0/net/sourceforge/pmd/Report.html#> > (addListener > <https://docs.pmd-code.org/apidocs/pmd-core/6.35.0/net/sourceforge/pmd/Report.html#addListener(net.sourceforge.pmd.ThreadSafeReportListener)> > , > getListeners > <https://docs.pmd-code.org/apidocs/pmd-core/6.35.0/net/sourceforge/pmd/Report.html#getListeners()>, > addListeners > <https://docs.pmd-code.org/apidocs/pmd-core/6.35.0/net/sourceforge/pmd/Report.html#addListeners(java.util.List)> > ) > are deprecated. This functionality will be replaced by another TBD > mechanism in PMD 7. > > External Contributions > > - #3272 <https://github.com/pmd/pmd/pull/3272>: [apex] correction for > ApexUnitTestMethodShouldHaveIsTestAnnotation false positives - William > Brockhus <https://github.com/YodaDaCoda> > - #3246 <https://github.com/pmd/pmd/pull/3246>: [java] New Rule: > MutableStaticState - Vsevolod Zholobov <https://github.com/vszholobov> > - #3247 <https://github.com/pmd/pmd/pull/3247>: [java] New rule: > JUnit5TestShouldBePackagePrivate - Arnaud Jeansen > <https://github.com/ajeans> > - #3293 <https://github.com/pmd/pmd/pull/3293>: [java] Cognitive > Complexity Metric - Denis Borovikov <https://github.com/borovikovd> > - pmd.github.io#12 <https://github.com/pmd/pmd.github.io/pull/12>: > Update quickstart.html - Igor Lyadov <https://github.com/devigo> > > Stats > > - 143 commits > - 53 closed tickets & PRs > - Days since last release: 34 > > > _______________________________________________ > Pmd-devel mailing list > Pmd...@li... > https://lists.sourceforge.net/lists/listinfo/pmd-devel > |