File DropwizardResourceConfig.java
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
package io.dropwizard.jersey;
import com.codahale.metrics.Clock;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.jersey2.InstrumentedResourceMethodApplicationListener;
Method register
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
@Override
public ResourceConfig register(final Object component) {
final Object object = requireNonNull(component);
Class<?> clazz = object.getClass();
// If a class gets passed through as an object, cast to Class and register directly
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method logMethodLines
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private List<EndpointLogLine> logMethodLines(Resource resource, String contextPath) {
final List<EndpointLogLine> methodLines = new ArrayList<>();
for (ResourceMethod method : resource.getAllMethods()) {
if ("OPTIONS".equalsIgnoreCase(method.getHttpMethod())) {
continue;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method logMethodLines
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private List<EndpointLogLine> logMethodLines(Resource resource, String contextPath) {
final List<EndpointLogLine> methodLines = new ArrayList<>();
for (ResourceMethod method : resource.getAllMethods()) {
if ("OPTIONS".equalsIgnoreCase(method.getHttpMethod())) {
continue;
Method getEndpointsInfo
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
String getEndpointsInfo() {
final StringBuilder msg = new StringBuilder(1024);
final Set<EndpointLogLine> endpointLogLines = new TreeSet<>(new EndpointComparator());
final String contextPath = config.getContextPath();
final String normalizedContextPath = contextPath.isEmpty() || contextPath.equals("/") ? "" :
Method getEndpointsInfo
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
String getEndpointsInfo() {
final StringBuilder msg = new StringBuilder(1024);
final Set<EndpointLogLine> endpointLogLines = new TreeSet<>(new EndpointComparator());
final String contextPath = config.getContextPath();
final String normalizedContextPath = contextPath.isEmpty() || contextPath.equals("/") ? "" :
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method mergePaths
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static String mergePaths(@NotNull String context, String subPath) {
if (subPath == null || subPath.isEmpty()) {
return cleanUpPath(context);
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"