forked from phoedos/pmd
Fixups from PR review
- release notes: API Changes - fix javadoc since tags - improve messages in ant task for deprecated skipLexicalErrors
This commit is contained in:
@ -402,7 +402,7 @@ Andy Glover wrote an Ant task for CPD; here's how to use it:
|
||||
If not specified, CPD uses the system default encoding."
|
||||
%}
|
||||
{% include custom/cli_option_row.html options="failOnError"
|
||||
description="Whether to fail the build if any errors occur while processing the files. Since PMD 7.2.0."
|
||||
description="Whether to fail the build if any errors occurred while processing the files. Since PMD 7.2.0."
|
||||
default="true"
|
||||
%}
|
||||
{% include custom/cli_option_row.html options="format"
|
||||
|
@ -65,7 +65,7 @@ The examples below won't repeat this taskdef element, as this is always required
|
||||
</tr>
|
||||
<tr>
|
||||
<td>failOnError</td>
|
||||
<td>Whether or not to fail the build if any processing errors occur while analyzing files.</td>
|
||||
<td>Whether or not to fail the build if any recoverable errors occurred while analyzing files.</td>
|
||||
<td>No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -65,19 +65,27 @@ Since this release, PMD will also expose any getter returning a collection of an
|
||||
a build with errors will now fail and with that parameter, the previous behavior can be restored.
|
||||
This parameter is available for both PMD and CPD.
|
||||
|
||||
* The CLI parameter `--skip-lexical-errors` is deprecated. Use the new parameter `--[no-]--fail-on-error` instead.
|
||||
* The CLI parameter `--skip-lexical-errors` is deprecated. By default, lexical errors are skipped but the
|
||||
build is failed. Use the new parameter `--[no-]fail-on-error` instead to control whether to fail the build or not.
|
||||
|
||||
##### Ant
|
||||
|
||||
* CPDTask has a new parameter `failOnError`. In controls, whether to fail the build if any recoverable errors occurred.
|
||||
* CPDTask has a new parameter `failOnError`. It controls, whether to fail the build if any recoverable error occurred.
|
||||
By default, the build will fail. CPD will still create a report with all detected duplications, but the report might
|
||||
be incomplete.
|
||||
* The parameter `skipLexicalError` in CPDTask is deprecated. Use the new parameter `failOnError` instead.
|
||||
* The parameter `skipLexicalError` in CPDTask is deprecated and ignored. Lexical errors are now always skipped.
|
||||
Use the new parameter `failOnError` instead to control whether to fail the build or not.
|
||||
|
||||
#### Deprecated API
|
||||
|
||||
* pmd-ant
|
||||
* {% jdoc !!ant::ant.CPDTask#setSkipLexicalErrors(boolean) %}: Use {% jdoc ant::ant.CPDTask#setFailOnError(boolean) %}
|
||||
instead to control, whether to ignore errors or fail the build.
|
||||
* pmd-core
|
||||
* {% jdoc !!core::cpd.CPDConfiguration#isSkipLexicalErrors() %} and {% jdoc core::cpd.CPDConfiguration#setSkipLexicalErrors(boolean) %}:
|
||||
Use {%jdoc core::AbstractConfiguration#setFailOnError(boolean) %} to control whether to ignore errors or fail the build.
|
||||
* pmd-java
|
||||
* {% jdoc !!java::lang.java.ast.ASTResource#getStableName() %} and the corresponding attribute `@StableName`
|
||||
* {% jdoc !!java::lang.java.ast.ASTResource#getStableName() %} and the corresponding attribute `@StableName`.
|
||||
|
||||
### ✨ External Contributions
|
||||
|
||||
|
@ -103,8 +103,9 @@ public class CPDTask extends Task {
|
||||
config.setSkipDuplicates(skipDuplicateFiles);
|
||||
|
||||
if (skipLexicalErrors) {
|
||||
log("skipLexicalErrors is deprecated and ignored. Lexical errors are now by default skipped. Use failOnError=\"false\" to not fail the build.", Project.MSG_WARN);
|
||||
failOnError = false;
|
||||
log("skipLexicalErrors is deprecated since 7.2.0 and the property is ignored. "
|
||||
+ "Lexical errors are now skipped by default and the build is failed. "
|
||||
+ "Use failOnError=\"false\" to not fail the build.", Project.MSG_WARN);
|
||||
}
|
||||
|
||||
// implicitly enable skipLexicalErrors, so that we can fail the build at the end. A report is created in any case.
|
||||
@ -129,10 +130,11 @@ public class CPDTask extends Task {
|
||||
|
||||
int errors = config.getReporter().numErrors();
|
||||
if (errors > 0) {
|
||||
String message = String.format("There were %d recovered errors during analysis.", errors);
|
||||
if (failOnError) {
|
||||
throw new BuildException("There were " + errors + " recovered errors during analysis. Ignore these with failOnError=\"true\".");
|
||||
throw new BuildException(message + " Ignore these with failOnError=\"true\".");
|
||||
} else {
|
||||
log("There were " + errors + " recovered errors during analysis. Not failing build, because failOnError=\"false\".", Project.MSG_WARN);
|
||||
log(message + " Not failing build, because failOnError=\"false\".", Project.MSG_WARN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ public abstract class AbstractConfiguration {
|
||||
* @return failOnViolation
|
||||
*
|
||||
* @see #isFailOnError()
|
||||
* @since 7.2.0
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public boolean isFailOnViolation() {
|
||||
return failOnViolation;
|
||||
@ -422,7 +422,7 @@ public abstract class AbstractConfiguration {
|
||||
* @return failOnError
|
||||
*
|
||||
* @see #isFailOnViolation()
|
||||
* @since 6.0.0
|
||||
* @since 7.2.0
|
||||
*/
|
||||
public boolean isFailOnError() {
|
||||
return failOnError;
|
||||
|
Reference in New Issue
Block a user