PMD - pull_request #251
Annotations
10 errors
|
Ensure that resources like this ExecutorService object are closed after use:
powertools-batch/src/test/java/software/amazon/lambda/powertools/batch/DdbBatchProcessorTest.java#L229
Ensure that resources (like `java.sql.Connection`, `java.sql.Statement`, and `java.sql.ResultSet` objects
and any subtype of `java.lang.AutoCloseable`) are always closed after use.
Failing to do so might result in resource leaks.
Note: It suffices to configure the super type, e.g. `java.lang.AutoCloseable`, so that this rule automatically triggers
on any subtype (e.g. `java.io.FileInputStream`). Additionally specifying `java.sql.Connection` helps in detecting
the types, if the type resolution / auxclasspath is not correctly setup.
Note: Since PMD 6.16.0 the default value for the property `types` contains `java.lang.AutoCloseable` and detects
now cases where the standard `java.io.*Stream` classes are involved. In order to restore the old behaviour,
just remove "AutoCloseable" from the types.
CloseResource (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/snapshot/pmd_rules_java_errorprone.html#closeresource
|
|
Ensure that resources like this ExecutorService object are closed after use:
powertools-batch/src/test/java/software/amazon/lambda/powertools/batch/DdbBatchProcessorTest.java#L216
Ensure that resources (like `java.sql.Connection`, `java.sql.Statement`, and `java.sql.ResultSet` objects
and any subtype of `java.lang.AutoCloseable`) are always closed after use.
Failing to do so might result in resource leaks.
Note: It suffices to configure the super type, e.g. `java.lang.AutoCloseable`, so that this rule automatically triggers
on any subtype (e.g. `java.io.FileInputStream`). Additionally specifying `java.sql.Connection` helps in detecting
the types, if the type resolution / auxclasspath is not correctly setup.
Note: Since PMD 6.16.0 the default value for the property `types` contains `java.lang.AutoCloseable` and detects
now cases where the standard `java.io.*Stream` classes are involved. In order to restore the old behaviour,
just remove "AutoCloseable" from the types.
CloseResource (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/snapshot/pmd_rules_java_errorprone.html#closeresource
|
|
Position literals first in String comparisons:
powertools-batch/src/test/java/software/amazon/lambda/powertools/batch/DdbBatchProcessorTest.java#L195
Position literals first in all String comparisons, if the second argument is null then NullPointerExceptions
can be avoided, they will just return false. Note that switching literal positions for compareTo and
compareToIgnoreCase may change the result, see examples.
Note that compile-time constant strings are treated like literals. This is because they are inlined into
the class file, are necessarily non-null, and therefore cannot cause an NPE at runtime.
LiteralsFirstInComparisons (Priority: 1, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#literalsfirstincomparisons
|
|
Position literals first in String comparisons:
powertools-batch/src/test/java/software/amazon/lambda/powertools/batch/DdbBatchProcessorTest.java#L169
Position literals first in all String comparisons, if the second argument is null then NullPointerExceptions
can be avoided, they will just return false. Note that switching literal positions for compareTo and
compareToIgnoreCase may change the result, see examples.
Note that compile-time constant strings are treated like literals. This is because they are inlined into
the class file, are necessarily non-null, and therefore cannot cause an NPE at runtime.
LiteralsFirstInComparisons (Priority: 1, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#literalsfirstincomparisons
|
|
Position literals first in String comparisons:
powertools-batch/src/test/java/software/amazon/lambda/powertools/batch/DdbBatchProcessorTest.java#L83
Position literals first in all String comparisons, if the second argument is null then NullPointerExceptions
can be avoided, they will just return false. Note that switching literal positions for compareTo and
compareToIgnoreCase may change the result, see examples.
Note that compile-time constant strings are treated like literals. This is because they are inlined into
the class file, are necessarily non-null, and therefore cannot cause an NPE at runtime.
LiteralsFirstInComparisons (Priority: 1, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#literalsfirstincomparisons
|
|
Avoid unused method parameters such as 'context'.:
powertools-batch/src/test/java/software/amazon/lambda/powertools/batch/DdbBatchProcessorTest.java#L73
Reports parameters of methods and constructors that are not referenced them in the method body.
Parameters whose name starts with `ignored` or `unused` are filtered out.
Removing unused formal parameters from public methods could cause a ripple effect through the code base.
Hence, by default, this rule only considers private methods. To include non-private methods, set the
`checkAll` property to `true`.
UnusedFormalParameter (Priority: 1, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#unusedformalparameter
|
|
Avoid unused method parameters such as 'context'.:
powertools-batch/src/test/java/software/amazon/lambda/powertools/batch/DdbBatchProcessorTest.java#L61
Reports parameters of methods and constructors that are not referenced them in the method body.
Parameters whose name starts with `ignored` or `unused` are filtered out.
Removing unused formal parameters from public methods could cause a ripple effect through the code base.
Hence, by default, this rule only considers private methods. To include non-private methods, set the
`checkAll` property to `true`.
UnusedFormalParameter (Priority: 1, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#unusedformalparameter
|
|
Avoid unused method parameters such as 'record'.:
powertools-batch/src/test/java/software/amazon/lambda/powertools/batch/DdbBatchProcessorTest.java#L61
Reports parameters of methods and constructors that are not referenced them in the method body.
Parameters whose name starts with `ignored` or `unused` are filtered out.
Removing unused formal parameters from public methods could cause a ripple effect through the code base.
Hence, by default, this rule only considers private methods. To include non-private methods, set the
`checkAll` property to `true`.
UnusedFormalParameter (Priority: 1, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#unusedformalparameter
|
|
Position literals first in String comparisons:
powertools-batch/src/test/java/software/amazon/lambda/powertools/batch/DdbBatchProcessorTest.java#L56
Position literals first in all String comparisons, if the second argument is null then NullPointerExceptions
can be avoided, they will just return false. Note that switching literal positions for compareTo and
compareToIgnoreCase may change the result, see examples.
Note that compile-time constant strings are treated like literals. This is because they are inlined into
the class file, are necessarily non-null, and therefore cannot cause an NPE at runtime.
LiteralsFirstInComparisons (Priority: 1, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#literalsfirstincomparisons
|
|
Avoid unused method parameters such as 'context'.:
powertools-batch/src/test/java/software/amazon/lambda/powertools/batch/DdbBatchProcessorTest.java#L55
Reports parameters of methods and constructors that are not referenced them in the method body.
Parameters whose name starts with `ignored` or `unused` are filtered out.
Removing unused formal parameters from public methods could cause a ripple effect through the code base.
Hence, by default, this rule only considers private methods. To include non-private methods, set the
`checkAll` property to `true`.
UnusedFormalParameter (Priority: 1, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#unusedformalparameter
|
Artifacts
Produced during runtime
| Name | Size | Digest | |
|---|---|---|---|
|
PMD Report
Expired
|
2.4 KB |
sha256:defc56728d731655fc1633c4c620f7f42bac5c73fb6cd8b0344a9f3922d98e5e
|
|