Dev/connection impl #71
Annotations
10 errors and 10 warnings
|
Return an empty collection rather than null.:
src/main/java/uk/gov/hmcts/cp/utils/Utils.java#L33
For any method that returns an collection (such as an array, Collection or Map), it is better to return
an empty one rather than a null reference. This removes the need for null checking all results and avoids
inadvertent NullPointerExceptions.
See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null
ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/snapshot/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
|
|
The constant name 'log' doesn't match '[A-Z][A-Z_0-9]*':
src/main/java/uk/gov/hmcts/cp/utils/Utils.java#L20
Configurable naming conventions for field declarations. This rule reports variable declarations
which do not match the regex that applies to their specific kind ---e.g. constants (static final),
enum constant, final field. Each regex can be configured through properties.
By default this rule uses the standard Java naming convention (Camel case), and uses the ALL_UPPER
convention for constants and enum constants.
FieldNamingConventions (Priority: 1, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#fieldnamingconventions
|
|
Dereferencing the qualifier of this expression will throw a NullPointerException:
src/main/java/uk/gov/hmcts/cp/services/CaseUrnMapperService.java#L56
The null check is broken since it will throw a NullPointerException itself.
It is likely that you used || instead of && or vice versa.
BrokenNullCheck (Priority: 2, Ruleset: Error Prone)
https://docs.pmd-code.org/snapshot/pmd_rules_java_errorprone.html#brokennullcheck
|
|
Return an empty collection rather than null.:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L101
For any method that returns an collection (such as an array, Collection or Map), it is better to return
an empty one rather than a null reference. This removes the need for null checking all results and avoids
inadvertent NullPointerExceptions.
See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null
ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/snapshot/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
|
|
Logger calls should be surrounded by log level guards.:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L99
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Logger calls should be surrounded by log level guards.:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L96
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Return an empty collection rather than null.:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L92
For any method that returns an collection (such as an array, Collection or Map), it is better to return
an empty one rather than a null reference. This removes the need for null checking all results and avoids
inadvertent NullPointerExceptions.
See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null
ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/snapshot/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
|
|
Logger calls should be surrounded by log level guards.:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L91
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Logger calls should be surrounded by log level guards.:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L66
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Annotate this interface with @FunctionalInterface or with @SuppressWarnings("PMD.ImplicitFunctionalInterface") to clarify your intent.:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClient.java#L6
Reports functional interfaces that were not explicitly declared as such with
the annotation `@FunctionalInterface`. If an interface is accidentally a functional
interface, then it should bear a `@SuppressWarnings("PMD.ImplicitFunctionalInterface")`
annotation to make this clear.
ImplicitFunctionalInterface (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#implicitfunctionalinterface
|
|
A method should have only one exit point, and that should be the last statement in the method:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L97
A method should have only one exit point, and that should be the last statement in the method.
OnlyOneReturn (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#onlyonereturn
|
|
Local variable 'hearingResult' could be declared final:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L95
A local variable assigned only once can be declared final.
LocalVariableCouldBeFinal (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#localvariablecouldbefinal
|
|
A method should have only one exit point, and that should be the last statement in the method:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L92
A method should have only one exit point, and that should be the last statement in the method.
OnlyOneReturn (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#onlyonereturn
|
|
Local variable 'request' could be declared final:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L81
A local variable assigned only once can be declared final.
LocalVariableCouldBeFinal (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#localvariablecouldbefinal
|
|
The initializer for variable 'response' is never used (overwritten on line 88):
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L78
Reports assignments to variables that are never used before the variable is overwritten,
or goes out of scope. Unused assignments are those for which
1. The variable is never read after the assignment, or
2. The assigned value is always overwritten by other assignments before the next read of
the variable.
The rule tracks assignements to fields of `this`, and static fields of the current class.
This may cause some false positives in timing-sensitive concurrent code, which the rule cannot detect.
The rule may be suppressed with the standard `@SuppressWarnings("unused")` tag.
The rule subsumes {% rule "UnusedLocalVariable" %}, and {% rule "UnusedFormalParameter" %}.
Those violations are filtered
out by default, in case you already have enabled those rules, but may be enabled with the property
`reportUnusedVariables`. Variables whose name starts with `ignored` or `unused` are filtered out, as
is standard practice for exceptions.
Limitations:
* The rule currently cannot know which method calls throw exceptions, or which exceptions they throw.
In the body of a try block, every method or constructor call is assumed to throw. This may cause false-negatives.
The only other language construct that is assumed to throw is the `throw` statement, in particular,
things like `assert` statements, or NullPointerExceptions on dereference are ignored.
* The rule cannot resolve assignments across constructors, when they're called with the special
`this(...)` syntax. This may cause false-negatives.
Both of those limitations may be partly relaxed in PMD 7.
UnusedAssignment (Priority: 3, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#unusedassignment
|
|
Parameter 'caseId' is not assigned and could be declared final:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L77
Reports method and constructor parameters that can be made final because they are never reassigned within the body of the method.
This rule ignores unused parameters so as not to overlap with the rule {% rule java/bestpractices/UnusedFormalParameter %}.
It will also ignore the parameters of abstract methods.
MethodArgumentCouldBeFinal (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#methodargumentcouldbefinal
|
|
Local variable 'hearingList' could be declared final:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L65
A local variable assigned only once can be declared final.
LocalVariableCouldBeFinal (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#localvariablecouldbefinal
|
|
Parameter 'cjscppuid' is not assigned and could be declared final:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L50
Reports method and constructor parameters that can be made final because they are never reassigned within the body of the method.
This rule ignores unused parameters so as not to overlap with the rule {% rule java/bestpractices/UnusedFormalParameter %}.
It will also ignore the parameters of abstract methods.
MethodArgumentCouldBeFinal (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#methodargumentcouldbefinal
|
|
Parameter 'courtScheduleClientUrl' is not assigned and could be declared final:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L49
Reports method and constructor parameters that can be made final because they are never reassigned within the body of the method.
This rule ignores unused parameters so as not to overlap with the rule {% rule java/bestpractices/UnusedFormalParameter %}.
It will also ignore the parameters of abstract methods.
MethodArgumentCouldBeFinal (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#methodargumentcouldbefinal
|
|
Parameter 'httpClient' is not assigned and could be declared final:
src/main/java/uk/gov/hmcts/cp/repositories/CourtScheduleClientImpl.java#L48
Reports method and constructor parameters that can be made final because they are never reassigned within the body of the method.
This rule ignores unused parameters so as not to overlap with the rule {% rule java/bestpractices/UnusedFormalParameter %}.
It will also ignore the parameters of abstract methods.
MethodArgumentCouldBeFinal (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#methodargumentcouldbefinal
|
Artifacts
Produced during runtime
| Name | Size | Digest | |
|---|---|---|---|
|
PMD Report
Expired
|
5.82 KB |
sha256:716a9a0eeaebdec9a207db7925e724111504d3993b1f8ec7b281147a83be2c38
|
|