forked from phoedos/pmd
Merge branch 'master' into pmd/7.0.x
This commit is contained in:
commit
73e5a68978
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -46,7 +46,7 @@ jobs:
|
||||
run: |
|
||||
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
|
||||
echo "MAVEN_OPTS=-Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3 -DautoReleaseAfterClose=true -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV
|
||||
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/17/scripts" >> $GITHUB_ENV
|
||||
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/18/scripts" >> $GITHUB_ENV
|
||||
- name: Check Environment
|
||||
shell: bash
|
||||
run: |
|
||||
|
2
.github/workflows/git-repo-sync.yml
vendored
2
.github/workflows/git-repo-sync.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
|
||||
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/17/scripts" >> $GITHUB_ENV
|
||||
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/18/scripts" >> $GITHUB_ENV
|
||||
- name: Sync
|
||||
run: .ci/git-repo-sync.sh
|
||||
shell: bash
|
||||
|
2
.github/workflows/troubleshooting.yml
vendored
2
.github/workflows/troubleshooting.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
||||
run: |
|
||||
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
|
||||
echo "MAVEN_OPTS=-Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3 -DstagingProgressTimeoutMinutes=30" >> $GITHUB_ENV
|
||||
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/17/scripts" >> $GITHUB_ENV
|
||||
echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/18/scripts" >> $GITHUB_ENV
|
||||
- name: Check Environment
|
||||
shell: bash
|
||||
run: |
|
||||
|
@ -2,7 +2,7 @@ repository: pmd/pmd
|
||||
|
||||
pmd:
|
||||
version: 7.0.0-SNAPSHOT
|
||||
previous_version: 6.45.0
|
||||
previous_version: 6.46.0
|
||||
date: ??-?????-2022
|
||||
release_type: major
|
||||
|
||||
|
@ -246,6 +246,39 @@ the breaking API changes will be performed in 7.0.0.
|
||||
an API is tagged as `@Deprecated` or not in the latest minor release. During the development of 7.0.0,
|
||||
we may decide to remove some APIs that were not tagged as deprecated, though we'll try to avoid it." %}
|
||||
|
||||
#### 6.46.0
|
||||
|
||||
##### Deprecated ruleset references
|
||||
|
||||
Ruleset references with the following formats are now deprecated and will produce a warning
|
||||
when used on the CLI or in a ruleset XML file:
|
||||
- `<lang-name>-<ruleset-name>`, eg `java-basic`, which resolves to `rulesets/java/basic.xml`
|
||||
- the internal release number, eg `600`, which resolves to `rulesets/releases/600.xml`
|
||||
|
||||
Use the explicit forms of these references to be compatible with PMD 7.
|
||||
|
||||
##### Deprecated API
|
||||
|
||||
- {% jdoc core::RuleSetReferenceId#toString() %} is now deprecated. The format of this
|
||||
method will remain the same until PMD 7. The deprecation is intended to steer users
|
||||
away from relying on this format, as it may be changed in PMD 7.
|
||||
- {% jdoc core::PMDConfiguration#getInputPaths() %} and
|
||||
{% jdoc core::PMDConfiguration#setInputPaths(java.lang.String) %} are now deprecated.
|
||||
A new set of methods have been added, which use lists and do not rely on comma splitting.
|
||||
|
||||
##### Internal API
|
||||
|
||||
Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0.
|
||||
You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning.
|
||||
|
||||
- {% jdoc core::cpd.CPDCommandLineInterface %} has been internalized. In order to execute CPD either
|
||||
{% jdoc !!core::cpd.CPD#run(java.lang.String...) %} or {% jdoc !!core::cpd.CPD#main(java.lang.String[]) %}
|
||||
should be used.
|
||||
- Several members of {% jdoc test::cli.BaseCPDCLITest %} have been deprecated with replacements.
|
||||
- The methods {% jdoc !!core::ant.Formatter#start(java.lang.String) %},
|
||||
{% jdoc !!core::ant.Formatter#end(net.sourceforge.pmd.Report) %}, {% jdoc !!core::ant.Formatter#getRenderer() %},
|
||||
and {% jdoc !!core::ant.Formatter#isNoOutputSupplied() %} have been internalized.
|
||||
|
||||
#### 6.45.0
|
||||
|
||||
##### Experimental APIs
|
||||
@ -1468,18 +1501,18 @@ large projects, with many duplications, it was causing `OutOfMemoryError`s (see
|
||||
* The Java rules NcssConstructorCount (java-design), NcssMethodCount (java-design), and NcssTypeCount (java-design) have been
|
||||
deprecated. They will be replaced by the new rule {% rule java/design/NcssCount %} in the category `design`.
|
||||
|
||||
* The Java rule `LooseCoupling` in ruleset `java-typeresolution` is deprecated. Use the rule with the same name from category `bestpractices` instead.
|
||||
* The Java rule `LooseCoupling` in ruleset `java-typeresolution` is deprecated. Use the rule with the same name from category `bestpractices` instead.
|
||||
|
||||
* The Java rule `CloneMethodMustImplementCloneable` in ruleset `java-typeresolution` is deprecated. Use the rule with the same name from category `errorprone` instead.
|
||||
* The Java rule `CloneMethodMustImplementCloneable` in ruleset `java-typeresolution` is deprecated. Use the rule with the same name from category `errorprone` instead.
|
||||
|
||||
* The Java rule `UnusedImports` in ruleset `java-typeresolution` is deprecated. Use the rule with
|
||||
* The Java rule `UnusedImports` in ruleset `java-typeresolution` is deprecated. Use the rule with
|
||||
the same name from category `bestpractices` instead.
|
||||
|
||||
* The Java rule `SignatureDeclareThrowsException` in ruleset `java-typeresolution` is deprecated. Use the rule with the same name from category `design` instead.
|
||||
* The Java rule `SignatureDeclareThrowsException` in ruleset `java-typeresolution` is deprecated. Use the rule with the same name from category `design` instead.
|
||||
|
||||
* The Java rule `EmptyStaticInitializer` in ruleset `java-empty` is deprecated. Use the rule {% rule java/errorprone/EmptyInitializer %}, which covers both static and non-static empty initializers.`
|
||||
* The Java rule `EmptyStaticInitializer` in ruleset `java-empty` is deprecated. Use the rule {% rule java/errorprone/EmptyInitializer %}, which covers both static and non-static empty initializers.`
|
||||
|
||||
* The Java rules `GuardDebugLogging` (ruleset `java-logging-jakarta-commons`) and `GuardLogStatementJavaUtil`
|
||||
* The Java rules `GuardDebugLogging` (ruleset `java-logging-jakarta-commons`) and `GuardLogStatementJavaUtil`
|
||||
(ruleset `java-logging-java`) have been deprecated. Use the rule {% rule java/bestpractices/GuardLogStatement %}, which covers all cases regardless of the logging framework.
|
||||
|
||||
* The Java rule "java/multithreading/UnsynchronizedStaticDateFormatter" has been deprecated and
|
||||
@ -1490,20 +1523,20 @@ large projects, with many duplications, it was causing `OutOfMemoryError`s (see
|
||||
and [`PositionLiteralsFirstInCaseInsensitiveComparisons`](https://pmd.github.io/pmd-6.29.0/pmd_rules_java_bestpractices.html#positionliteralsfirstincaseinsensitivecomparisons) (ruleset `java-bestpractices`)
|
||||
have been deprecated in favor of the new rule {% rule "java/bestpractices/LiteralsFirstInComparisons" %}.
|
||||
|
||||
* The Java rule [`AvoidFinalLocalVariable`](https://pmd.github.io/pmd-6.16.0/pmd_rules_java_codestyle.html#avoidfinallocalvariable) (`java-codestyle`) has been deprecated
|
||||
* The Java rule [`AvoidFinalLocalVariable`](https://pmd.github.io/pmd-6.16.0/pmd_rules_java_codestyle.html#avoidfinallocalvariable) (`java-codestyle`) has been deprecated
|
||||
and will be removed with PMD 7.0.0. The rule is controversial and also contradicts other existing
|
||||
rules such as [`LocalVariableCouldBeFinal`](https://pmd.github.io/pmd-6.16.0/pmd_rules_java_codestyle.html#localvariablecouldbefinal). If the goal is to avoid defining
|
||||
constants in a scope smaller than the class, then the rule [`AvoidDuplicateLiterals`](https://pmd.github.io/pmd-6.16.0/pmd_rules_java_errorprone.html#avoidduplicateliterals)
|
||||
should be used instead.
|
||||
|
||||
* The Apex rule [`VariableNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#variablenamingconventions) (`apex-codestyle`) has been deprecated and
|
||||
* The Apex rule [`VariableNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#variablenamingconventions) (`apex-codestyle`) has been deprecated and
|
||||
will be removed with PMD 7.0.0. The rule is replaced by the more general rules
|
||||
[`FieldNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#fieldnamingconventions),
|
||||
[`FormalParameterNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#formalparameternamingconventions),
|
||||
[`LocalVariableNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#localvariablenamingconventions), and
|
||||
[`PropertyNamingConventions`](https://pmd.github.io/pmd-6.15.0/pmd_rules_apex_codestyle.html#propertynamingconventions).
|
||||
|
||||
* The Java rule [`LoggerIsNotStaticFinal`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_errorprone.html#loggerisnotstaticfinal) (`java-errorprone`) has been deprecated
|
||||
* The Java rule [`LoggerIsNotStaticFinal`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_errorprone.html#loggerisnotstaticfinal) (`java-errorprone`) has been deprecated
|
||||
and will be removed with PMD 7.0.0. The rule is replaced by [`ProperLogger`](https://pmd.github.io/pmd-6.15.0/pmd_rules_java_errorprone.html#properlogger).
|
||||
|
||||
* The Java rule [`DataflowAnomalyAnalysis`](https://pmd.github.io/pmd-6.27.0/pmd_rules_java_errorprone.html#dataflowanomalyanalysis) (`java-errorprone`)
|
||||
@ -1516,7 +1549,7 @@ large projects, with many duplications, it was causing `OutOfMemoryError`s (see
|
||||
* The Java rule `CloneThrowsCloneNotSupportedException` (java-errorprone) has been deprecated without
|
||||
replacement.
|
||||
|
||||
* The following Java rules are deprecated and removed from the quickstart ruleset,
|
||||
* The following Java rules are deprecated and removed from the quickstart ruleset,
|
||||
as the new rule {% rule java/bestpractices/SimplifiableTestAssertion %} merges
|
||||
their functionality:
|
||||
* `UseAssertEqualsInsteadOfAssertTrue` (java-bestpractices)
|
||||
@ -1529,7 +1562,7 @@ large projects, with many duplications, it was causing `OutOfMemoryError`s (see
|
||||
the quickstart ruleset, as the new rule {% rule java/errorprone/ReturnEmptyCollectionRatherThanNull %}
|
||||
supersedes it.
|
||||
|
||||
* The following Java rules are deprecated and removed from the quickstart ruleset,
|
||||
* The following Java rules are deprecated and removed from the quickstart ruleset,
|
||||
as the new rule {% rule java/bestpractices/PrimitiveWrapperInstantiation %} merges
|
||||
their functionality:
|
||||
* java/performance/BooleanInstantiation
|
||||
@ -1543,3 +1576,17 @@ large projects, with many duplications, it was causing `OutOfMemoryError`s (see
|
||||
as it finds only contrived cases of creating a primitive wrapper and unboxing it explicitly
|
||||
in the same expression. In PMD 7 this and more cases will be covered by a
|
||||
new rule `UnnecessaryBoxing`.
|
||||
|
||||
* Since 6.46.0: The following Java rules are deprecated and removed from the quickstart ruleset, as the new rule
|
||||
{% rule java/codestyle/EmptyControlStatement %} merges their functionality:
|
||||
* {% rule java/errorprone/EmptyFinallyBlock %}
|
||||
* {% rule java/errorprone/EmptyIfStmt %}
|
||||
* {% rule java/errorprone/EmptyInitializer %}
|
||||
* {% rule java/errorprone/EmptyStatementBlock %}
|
||||
* {% rule java/errorprone/EmptySwitchStatements %}
|
||||
* {% rule java/errorprone/EmptySynchronizedBlock %}
|
||||
* {% rule java/errorprone/EmptyTryBlock %}
|
||||
* {% rule java/errorprone/EmptyWhileStmt %}
|
||||
|
||||
* Since 6.46.0: The Java rule {% rule java/errorprone/EmptyStatementNotInLoop %} is deprecated and removed from the quickstart
|
||||
ruleset. Use the new rule {% rule java/codestyle/UnnecessarySemicolon %} instead.
|
||||
|
@ -19,142 +19,11 @@ This is a {{ site.pmd.release_type }} release.
|
||||
|
||||
### New and noteworthy
|
||||
|
||||
#### CLI improvements
|
||||
|
||||
The PMD CLI now allows repeating the `--dir` (`-d`) and `--rulesets` (`-R`) options,
|
||||
as well as providing several space-separated arguments to either of them. For instance:
|
||||
```shell
|
||||
pmd -d src/main/java src/test/java -R rset1.xml -R rset2.xml
|
||||
```
|
||||
This also allows globs to be used on the CLI if your shell supports shell expansion.
|
||||
For instance, the above can be written
|
||||
```shell
|
||||
pmd -d src/*/java -R rset*.xml
|
||||
```
|
||||
Please use theses new forms instead of using comma-separated lists as argument to these options.
|
||||
|
||||
#### C# Improvements
|
||||
|
||||
When executing CPD on C# sources, the option `--ignore-annotations` is now supported as well.
|
||||
It ignores C# attributes when detecting duplicated code. This option can also be enabled via
|
||||
the CPD GUI. See [#3974](https://github.com/pmd/pmd/pull/3974) for details.
|
||||
|
||||
#### New Rules
|
||||
|
||||
This release ships with 2 new Java rules.
|
||||
|
||||
* {% rule java/codestyle/EmptyControlStatement %} reports many instances of empty things, e.g. control statements whose
|
||||
body is empty, as well as empty initializers.
|
||||
|
||||
EmptyControlStatement also works for empty `for` and `do` loops, while there were previously
|
||||
no corresponding rules.
|
||||
|
||||
This new rule replaces the rules EmptyFinallyBlock, EmptyIfStmt, EmptyInitializer, EmptyStatementBlock,
|
||||
EmptySwitchStatements, EmptySynchronizedBlock, EmptyTryBlock, and EmptyWhileStmt.
|
||||
|
||||
```xml
|
||||
<rule ref="category/java/codestyle.xml/EmptyControlStatement"/>
|
||||
```
|
||||
|
||||
The rule is part of the quickstart.xml ruleset.
|
||||
|
||||
* {%rule java/codestyle/UnnecessarySemicolon %} reports semicolons that are unnecessary (so called "empty statements"
|
||||
and "empty declarations").
|
||||
|
||||
This new rule replaces the rule EmptyStatementNotInLoop.
|
||||
|
||||
```xml
|
||||
<rule ref="category/java/codestyle.xml/UnnecessarySemicolon"/>
|
||||
```
|
||||
|
||||
The rule is part of the quickstart.xml ruleset.
|
||||
|
||||
#### Deprecated Rules
|
||||
|
||||
* The following Java rules are deprecated and removed from the quickstart ruleset, as the new rule
|
||||
{% rule java/codestyle/EmptyControlStatement %} merges their functionality:
|
||||
* {% rule java/errorprone/EmptyFinallyBlock %}
|
||||
* {% rule java/errorprone/EmptyIfStmt %}
|
||||
* {% rule java/errorprone/EmptyInitializer %}
|
||||
* {% rule java/errorprone/EmptyStatementBlock %}
|
||||
* {% rule java/errorprone/EmptySwitchStatements %}
|
||||
* {% rule java/errorprone/EmptySynchronizedBlock %}
|
||||
* {% rule java/errorprone/EmptyTryBlock %}
|
||||
* {% rule java/errorprone/EmptyWhileStmt %}
|
||||
* The Java rule {% rule java/errorprone/EmptyStatementNotInLoop %} is deprecated and removed from the quickstart
|
||||
ruleset. Use the new rule {% rule java/codestyle/UnnecessarySemicolon %} instead.
|
||||
|
||||
### Fixed Issues
|
||||
|
||||
* cli
|
||||
* [#1445](https://github.com/pmd/pmd/issues/1445): \[core] Allow CLI to take globs as parameters
|
||||
* core
|
||||
* [#2352](https://github.com/pmd/pmd/issues/2352): \[core] Deprecate \<lang\>-\<ruleset\> hyphen notation for ruleset references
|
||||
* [#3787](https://github.com/pmd/pmd/issues/3787): \[core] Internalize some methods in Ant Formatter
|
||||
* [#3835](https://github.com/pmd/pmd/issues/3835): \[core] Deprecate system properties of CPDCommandLineInterface
|
||||
* [#3942](https://github.com/pmd/pmd/issues/3942): \[core] common-io path traversal vulnerability (CVE-2021-29425)
|
||||
* cs (c#)
|
||||
* [#3974](https://github.com/pmd/pmd/pull/3974): \[cs] Add option to ignore C# attributes (annotations)
|
||||
* go
|
||||
* [#2752](https://github.com/pmd/pmd/issues/2752): \[go] Error parsing unicode values
|
||||
* html
|
||||
* [#3955](https://github.com/pmd/pmd/pull/3955): \[html] Improvements for handling text and comment nodes
|
||||
* [#3978](https://github.com/pmd/pmd/pull/3978): \[html] Add additional file extensions htm, xhtml, xht, shtml
|
||||
* java
|
||||
* [#3423](https://github.com/pmd/pmd/issues/3423): \[java] Error processing identifiers with Unicode
|
||||
* java-bestpractices
|
||||
* [#3954](https://github.com/pmd/pmd/issues/3954): \[java] NPE in UseCollectionIsEmptyRule when .size() is called in a record
|
||||
* java-design
|
||||
* [#3874](https://github.com/pmd/pmd/issues/3874): \[java] ImmutableField reports fields annotated with @Autowired (Spring) and @Mock (Mockito)
|
||||
* java-errorprone
|
||||
* [#3096](https://github.com/pmd/pmd/issues/3096): \[java] EmptyStatementNotInLoop FP in 6.30.0 with IfStatement
|
||||
* java-performance
|
||||
* [#3379](https://github.com/pmd/pmd/issues/3379): \[java] UseArraysAsList must ignore primitive arrays
|
||||
* [#3965](https://github.com/pmd/pmd/issues/3965): \[java] UseArraysAsList false positive with non-trivial loops
|
||||
* javascript
|
||||
* [#2605](https://github.com/pmd/pmd/issues/2605): \[js] Support unicode characters
|
||||
* [#3948](https://github.com/pmd/pmd/issues/3948): \[js] Invalid operator error for method property in object literal
|
||||
* python
|
||||
* [#2604](https://github.com/pmd/pmd/issues/2604): \[python] Support unicode identifiers
|
||||
|
||||
### API Changes
|
||||
|
||||
#### Deprecated ruleset references
|
||||
|
||||
Ruleset references with the following formats are now deprecated and will produce a warning
|
||||
when used on the CLI or in a ruleset XML file:
|
||||
- `<lang-name>-<ruleset-name>`, eg `java-basic`, which resolves to `rulesets/java/basic.xml`
|
||||
- the internal release number, eg `600`, which resolves to `rulesets/releases/600.xml`
|
||||
|
||||
Use the explicit forms of these references to be compatible with PMD 7.
|
||||
|
||||
#### Deprecated API
|
||||
|
||||
- {% jdoc core::RuleSetReferenceId#toString() %} is now deprecated. The format of this
|
||||
method will remain the same until PMD 7. The deprecation is intended to steer users
|
||||
away from relying on this format, as it may be changed in PMD 7.
|
||||
- {% jdoc core::PMDConfiguration#getInputPaths() %} and
|
||||
{% jdoc core::PMDConfiguration#setInputPaths(java.lang.String) %} are now deprecated.
|
||||
A new set of methods have been added, which use lists and do not rely on comma splitting.
|
||||
|
||||
#### Internal API
|
||||
|
||||
Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0.
|
||||
You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning.
|
||||
|
||||
- {% jdoc core::cpd.CPDCommandLineInterface %} has been internalized. In order to execute CPD either
|
||||
{% jdoc !!core::cpd.CPD#run(java.lang.String...) %} or {% jdoc !!core::cpd.CPD#main(java.lang.String[]) %}
|
||||
should be used.
|
||||
- Several members of {% jdoc test::cli.BaseCPDCLITest %} have been deprecated with replacements.
|
||||
- The methods {% jdoc !!core::ant.Formatter#start(java.lang.String) %},
|
||||
{% jdoc !!core::ant.Formatter#end(net.sourceforge.pmd.Report) %}, {% jdoc !!core::ant.Formatter#getRenderer() %},
|
||||
and {% jdoc !!core::ant.Formatter#isNoOutputSupplied() %} have been internalized.
|
||||
|
||||
### External Contributions
|
||||
|
||||
* [#3961](https://github.com/pmd/pmd/pull/3961): \[java] Fix #3954 - NPE in UseCollectionIsEmptyRule with record - [@flyhard](https://github.com/flyhard)
|
||||
* [#3964](https://github.com/pmd/pmd/pull/3964): \[java] Fix #3874 - ImmutableField: fix mockito/spring false positives - [@lukelukes](https://github.com/lukelukes)
|
||||
* [#3974](https://github.com/pmd/pmd/pull/3974): \[cs] Add option to ignore C# attributes (annotations) - [@maikelsteneker](https://github.com/maikelsteneker)
|
||||
|
||||
{% endtocmaker %}
|
||||
|
||||
|
@ -5,6 +5,171 @@ permalink: pmd_release_notes_old.html
|
||||
|
||||
Previous versions of PMD can be downloaded here: https://github.com/pmd/pmd/releases
|
||||
|
||||
## 28-May-2022 - 6.46.0
|
||||
|
||||
The PMD team is pleased to announce PMD 6.46.0.
|
||||
|
||||
This is a minor release.
|
||||
|
||||
### Table Of Contents
|
||||
|
||||
* [New and noteworthy](#new-and-noteworthy)
|
||||
* [CLI improvements](#cli-improvements)
|
||||
* [C# Improvements](#c#-improvements)
|
||||
* [New Rules](#new-rules)
|
||||
* [Deprecated Rules](#deprecated-rules)
|
||||
* [Fixed Issues](#fixed-issues)
|
||||
* [API Changes](#api-changes)
|
||||
* [Deprecated ruleset references](#deprecated-ruleset-references)
|
||||
* [Deprecated API](#deprecated-api)
|
||||
* [Internal API](#internal-api)
|
||||
* [External Contributions](#external-contributions)
|
||||
* [Stats](#stats)
|
||||
|
||||
### New and noteworthy
|
||||
|
||||
#### CLI improvements
|
||||
|
||||
The PMD CLI now allows repeating the `--dir` (`-d`) and `--rulesets` (`-R`) options,
|
||||
as well as providing several space-separated arguments to either of them. For instance:
|
||||
```shell
|
||||
pmd -d src/main/java src/test/java -R rset1.xml -R rset2.xml
|
||||
```
|
||||
This also allows globs to be used on the CLI if your shell supports shell expansion.
|
||||
For instance, the above can be written
|
||||
```shell
|
||||
pmd -d src/*/java -R rset*.xml
|
||||
```
|
||||
Please use theses new forms instead of using comma-separated lists as argument to these options.
|
||||
|
||||
#### C# Improvements
|
||||
|
||||
When executing CPD on C# sources, the option `--ignore-annotations` is now supported as well.
|
||||
It ignores C# attributes when detecting duplicated code. This option can also be enabled via
|
||||
the CPD GUI. See [#3974](https://github.com/pmd/pmd/pull/3974) for details.
|
||||
|
||||
#### New Rules
|
||||
|
||||
This release ships with 2 new Java rules.
|
||||
|
||||
* [`EmptyControlStatement`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_codestyle.html#emptycontrolstatement) reports many instances of empty things, e.g. control statements whose
|
||||
body is empty, as well as empty initializers.
|
||||
|
||||
EmptyControlStatement also works for empty `for` and `do` loops, while there were previously
|
||||
no corresponding rules.
|
||||
|
||||
This new rule replaces the rules EmptyFinallyBlock, EmptyIfStmt, EmptyInitializer, EmptyStatementBlock,
|
||||
EmptySwitchStatements, EmptySynchronizedBlock, EmptyTryBlock, and EmptyWhileStmt.
|
||||
|
||||
```xml
|
||||
<rule ref="category/java/codestyle.xml/EmptyControlStatement"/>
|
||||
```
|
||||
|
||||
The rule is part of the quickstart.xml ruleset.
|
||||
|
||||
* [`UnnecessarySemicolon`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_codestyle.html#unnecessarysemicolon) reports semicolons that are unnecessary (so called "empty statements"
|
||||
and "empty declarations").
|
||||
|
||||
This new rule replaces the rule EmptyStatementNotInLoop.
|
||||
|
||||
```xml
|
||||
<rule ref="category/java/codestyle.xml/UnnecessarySemicolon"/>
|
||||
```
|
||||
|
||||
The rule is part of the quickstart.xml ruleset.
|
||||
|
||||
#### Deprecated Rules
|
||||
|
||||
* The following Java rules are deprecated and removed from the quickstart ruleset, as the new rule
|
||||
[`EmptyControlStatement`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_codestyle.html#emptycontrolstatement) merges their functionality:
|
||||
* [`EmptyFinallyBlock`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_errorprone.html#emptyfinallyblock)
|
||||
* [`EmptyIfStmt`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_errorprone.html#emptyifstmt)
|
||||
* [`EmptyInitializer`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_errorprone.html#emptyinitializer)
|
||||
* [`EmptyStatementBlock`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_errorprone.html#emptystatementblock)
|
||||
* [`EmptySwitchStatements`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_errorprone.html#emptyswitchstatements)
|
||||
* [`EmptySynchronizedBlock`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_errorprone.html#emptysynchronizedblock)
|
||||
* [`EmptyTryBlock`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_errorprone.html#emptytryblock)
|
||||
* [`EmptyWhileStmt`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_errorprone.html#emptywhilestmt)
|
||||
* The Java rule [`EmptyStatementNotInLoop`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_errorprone.html#emptystatementnotinloop) is deprecated and removed from the quickstart
|
||||
ruleset. Use the new rule [`UnnecessarySemicolon`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_codestyle.html#unnecessarysemicolon) instead.
|
||||
|
||||
### Fixed Issues
|
||||
|
||||
* cli
|
||||
* [#1445](https://github.com/pmd/pmd/issues/1445): \[core] Allow CLI to take globs as parameters
|
||||
* core
|
||||
* [#2352](https://github.com/pmd/pmd/issues/2352): \[core] Deprecate \<lang\>-\<ruleset\> hyphen notation for ruleset references
|
||||
* [#3787](https://github.com/pmd/pmd/issues/3787): \[core] Internalize some methods in Ant Formatter
|
||||
* [#3835](https://github.com/pmd/pmd/issues/3835): \[core] Deprecate system properties of CPDCommandLineInterface
|
||||
* [#3942](https://github.com/pmd/pmd/issues/3942): \[core] common-io path traversal vulnerability (CVE-2021-29425)
|
||||
* cs (c#)
|
||||
* [#3974](https://github.com/pmd/pmd/pull/3974): \[cs] Add option to ignore C# attributes (annotations)
|
||||
* go
|
||||
* [#2752](https://github.com/pmd/pmd/issues/2752): \[go] Error parsing unicode values
|
||||
* html
|
||||
* [#3955](https://github.com/pmd/pmd/pull/3955): \[html] Improvements for handling text and comment nodes
|
||||
* [#3978](https://github.com/pmd/pmd/pull/3978): \[html] Add additional file extensions htm, xhtml, xht, shtml
|
||||
* java
|
||||
* [#3423](https://github.com/pmd/pmd/issues/3423): \[java] Error processing identifiers with Unicode
|
||||
* java-bestpractices
|
||||
* [#3954](https://github.com/pmd/pmd/issues/3954): \[java] NPE in UseCollectionIsEmptyRule when .size() is called in a record
|
||||
* java-design
|
||||
* [#3874](https://github.com/pmd/pmd/issues/3874): \[java] ImmutableField reports fields annotated with @Autowired (Spring) and @Mock (Mockito)
|
||||
* java-errorprone
|
||||
* [#3096](https://github.com/pmd/pmd/issues/3096): \[java] EmptyStatementNotInLoop FP in 6.30.0 with IfStatement
|
||||
* java-performance
|
||||
* [#3379](https://github.com/pmd/pmd/issues/3379): \[java] UseArraysAsList must ignore primitive arrays
|
||||
* [#3965](https://github.com/pmd/pmd/issues/3965): \[java] UseArraysAsList false positive with non-trivial loops
|
||||
* javascript
|
||||
* [#2605](https://github.com/pmd/pmd/issues/2605): \[js] Support unicode characters
|
||||
* [#3948](https://github.com/pmd/pmd/issues/3948): \[js] Invalid operator error for method property in object literal
|
||||
* python
|
||||
* [#2604](https://github.com/pmd/pmd/issues/2604): \[python] Support unicode identifiers
|
||||
|
||||
### API Changes
|
||||
|
||||
#### Deprecated ruleset references
|
||||
|
||||
Ruleset references with the following formats are now deprecated and will produce a warning
|
||||
when used on the CLI or in a ruleset XML file:
|
||||
- `<lang-name>-<ruleset-name>`, eg `java-basic`, which resolves to `rulesets/java/basic.xml`
|
||||
- the internal release number, eg `600`, which resolves to `rulesets/releases/600.xml`
|
||||
|
||||
Use the explicit forms of these references to be compatible with PMD 7.
|
||||
|
||||
#### Deprecated API
|
||||
|
||||
- <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.46.0/net/sourceforge/pmd/RuleSetReferenceId.html#toString()"><code>toString</code></a> is now deprecated. The format of this
|
||||
method will remain the same until PMD 7. The deprecation is intended to steer users
|
||||
away from relying on this format, as it may be changed in PMD 7.
|
||||
- <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.46.0/net/sourceforge/pmd/PMDConfiguration.html#getInputPaths()"><code>getInputPaths</code></a> and
|
||||
<a href="https://docs.pmd-code.org/apidocs/pmd-core/6.46.0/net/sourceforge/pmd/PMDConfiguration.html#setInputPaths(java.lang.String)"><code>setInputPaths</code></a> are now deprecated.
|
||||
A new set of methods have been added, which use lists and do not rely on comma splitting.
|
||||
|
||||
#### Internal API
|
||||
|
||||
Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0.
|
||||
You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning.
|
||||
|
||||
- <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.46.0/net/sourceforge/pmd/cpd/CPDCommandLineInterface.html#"><code>CPDCommandLineInterface</code></a> has been internalized. In order to execute CPD either
|
||||
<a href="https://docs.pmd-code.org/apidocs/pmd-core/6.46.0/net/sourceforge/pmd/cpd/CPD.html#run(java.lang.String...)"><code>CPD#run</code></a> or <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.46.0/net/sourceforge/pmd/cpd/CPD.html#main(java.lang.String[])"><code>CPD#main</code></a>
|
||||
should be used.
|
||||
- Several members of <a href="https://docs.pmd-code.org/apidocs/pmd-test/6.46.0/net/sourceforge/pmd/cli/BaseCPDCLITest.html#"><code>BaseCPDCLITest</code></a> have been deprecated with replacements.
|
||||
- The methods <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.46.0/net/sourceforge/pmd/ant/Formatter.html#start(java.lang.String)"><code>Formatter#start</code></a>,
|
||||
<a href="https://docs.pmd-code.org/apidocs/pmd-core/6.46.0/net/sourceforge/pmd/ant/Formatter.html#end(net.sourceforge.pmd.Report)"><code>Formatter#end</code></a>, <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.46.0/net/sourceforge/pmd/ant/Formatter.html#getRenderer()"><code>Formatter#getRenderer</code></a>,
|
||||
and <a href="https://docs.pmd-code.org/apidocs/pmd-core/6.46.0/net/sourceforge/pmd/ant/Formatter.html#isNoOutputSupplied()"><code>Formatter#isNoOutputSupplied</code></a> have been internalized.
|
||||
|
||||
### External Contributions
|
||||
|
||||
* [#3961](https://github.com/pmd/pmd/pull/3961): \[java] Fix #3954 - NPE in UseCollectionIsEmptyRule with record - [@flyhard](https://github.com/flyhard)
|
||||
* [#3964](https://github.com/pmd/pmd/pull/3964): \[java] Fix #3874 - ImmutableField: fix mockito/spring false positives - [@lukelukes](https://github.com/lukelukes)
|
||||
* [#3974](https://github.com/pmd/pmd/pull/3974): \[cs] Add option to ignore C# attributes (annotations) - [@maikelsteneker](https://github.com/maikelsteneker)
|
||||
|
||||
### Stats
|
||||
* 92 commits
|
||||
* 30 closed tickets & PRs
|
||||
* Days since last release: 28
|
||||
|
||||
## 30-April-2022 - 6.45.0
|
||||
|
||||
The PMD team is pleased to announce PMD 6.45.0.
|
||||
|
12
pom.xml
12
pom.xml
@ -76,7 +76,7 @@
|
||||
</issueManagement>
|
||||
|
||||
<properties>
|
||||
<project.build.outputTimestamp>2022-04-30T07:38:24Z</project.build.outputTimestamp>
|
||||
<project.build.outputTimestamp>2022-05-28T09:04:31Z</project.build.outputTimestamp>
|
||||
|
||||
<java.version>8</java.version>
|
||||
|
||||
@ -107,7 +107,7 @@
|
||||
|
||||
<argLine>-Xmx512m -Dfile.encoding=${project.build.sourceEncoding}</argLine>
|
||||
|
||||
<pmd.build-tools.version>18-SNAPSHOT</pmd.build-tools.version>
|
||||
<pmd.build-tools.version>18</pmd.build-tools.version>
|
||||
|
||||
<pmd-designer.version>6.37.0</pmd-designer.version>
|
||||
<javacc.jar>${settings.localRepository}/net/java/dev/javacc/javacc/${javacc.version}/javacc-${javacc.version}.jar</javacc.jar>
|
||||
@ -419,22 +419,22 @@
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-core</artifactId>
|
||||
<version>6.45.0</version> <!-- pmd.dogfood.version -->
|
||||
<version>6.46.0</version> <!-- pmd.dogfood.version -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-java</artifactId>
|
||||
<version>6.45.0</version> <!-- pmd.dogfood.version -->
|
||||
<version>6.46.0</version> <!-- pmd.dogfood.version -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-jsp</artifactId>
|
||||
<version>6.45.0</version> <!-- pmd.dogfood.version -->
|
||||
<version>6.46.0</version> <!-- pmd.dogfood.version -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-javascript</artifactId>
|
||||
<version>6.45.0</version> <!-- pmd.dogfood.version -->
|
||||
<version>6.46.0</version> <!-- pmd.dogfood.version -->
|
||||
</dependency>
|
||||
<!-- This contains the dogfood ruleset -->
|
||||
<dependency>
|
||||
|
Loading…
x
Reference in New Issue
Block a user