Skip to content

PMD - pull_request #973

PMD - pull_request

PMD - pull_request #973

Triggered via pull request November 14, 2025 15:13
Status Success
Total duration 28s
Artifacts 1

check-pmd.yml

on: pull_request
pmd_analyse
23s
pmd_analyse
Fit to window
Zoom out
Zoom in

Annotations

8 errors
Position literals first in String comparisons: powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/internal/LambdaMetricsAspectTest.java#L219
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
The final field standardOut could be made static: powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/internal/LambdaMetricsAspectTest.java#L44
If a final field is assigned to a compile-time constant, it could be made static, thus saving overhead in each object at runtime. FinalFieldCouldBeStatic (Priority: 1, Ruleset: Design) https://docs.pmd-code.org/snapshot/pmd_rules_java_design.html#finalfieldcouldbestatic
The final field standardOut could be made static: powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/MetricsFactoryTest.java#L43
If a final field is assigned to a compile-time constant, it could be made static, thus saving overhead in each object at runtime. FinalFieldCouldBeStatic (Priority: 1, Ruleset: Design) https://docs.pmd-code.org/snapshot/pmd_rules_java_design.html#finalfieldcouldbestatic
The final field standardOut could be made static: powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/MetricsBuilderTest.java#L38
If a final field is assigned to a compile-time constant, it could be made static, thus saving overhead in each object at runtime. FinalFieldCouldBeStatic (Priority: 1, Ruleset: Design) https://docs.pmd-code.org/snapshot/pmd_rules_java_design.html#finalfieldcouldbestatic
This class has only private constructors and may be final: powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/ConfigurationPrecedenceTest.java#L196
Reports classes that may be made final because they cannot be extended from outside their compilation unit anyway. This is because all their constructors are private, so a subclass could not call the super constructor. ClassWithOnlyPrivateConstructorsShouldBeFinal (Priority: 1, Ruleset: Design) https://docs.pmd-code.org/snapshot/pmd_rules_java_design.html#classwithonlyprivateconstructorsshouldbefinal
This class has only private constructors and may be final: powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/ConfigurationPrecedenceTest.java#L186
Reports classes that may be made final because they cannot be extended from outside their compilation unit anyway. This is because all their constructors are private, so a subclass could not call the super constructor. ClassWithOnlyPrivateConstructorsShouldBeFinal (Priority: 1, Ruleset: Design) https://docs.pmd-code.org/snapshot/pmd_rules_java_design.html#classwithonlyprivateconstructorsshouldbefinal
The final field standardOut could be made static: powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/ConfigurationPrecedenceTest.java#L47
If a final field is assigned to a compile-time constant, it could be made static, thus saving overhead in each object at runtime. FinalFieldCouldBeStatic (Priority: 1, Ruleset: Design) https://docs.pmd-code.org/snapshot/pmd_rules_java_design.html#finalfieldcouldbestatic
Avoid using implementation types like 'ConcurrentHashMap'; use the interface instead: powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/internal/RequestScopedMetricsProxy.java#L36
Excessive coupling to implementation types (e.g., `HashSet`) limits your ability to use alternate implementations in the future as requirements change. Whenever available, declare variables and parameters using a more general type (e.g, `Set`). This rule reports uses of concrete collection types. User-defined types that should be treated the same as interfaces can be configured with the property `allowedTypes`. LooseCoupling (Priority: 1, Ruleset: Best Practices) https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#loosecoupling

Artifacts

Produced during runtime
Name Size Digest
PMD Report
1.71 KB
sha256:835b4353a86bb9cf3e740d1c3dd8154b7f467c61b31fe23158940b2f5718963a