dropwizard-client/src/main/java/io/dropwizard/client/HttpClientBuilder.java
File HttpClientBuilder.java
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
package io.dropwizard.client;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.httpclient.HttpClientMetricNameStrategies;
import com.codahale.metrics.httpclient.HttpClientMetricNameStrategy;
Method createClient
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected ConfiguredCloseableHttpClient createClient(
final org.apache.http.impl.client.HttpClientBuilder builder,
final InstrumentedHttpClientConnectionManager manager,
final String name) {
final String cookiePolicy = configuration.isCookiesEnabled() ? CookieSpecs.DEFAULT : CookieSpecs.IGNORE_COOKIES;
HttpClientBuilder
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class HttpClientBuilder {
@SuppressWarnings("UnnecessaryLambda")
private static final HttpRequestRetryHandler NO_RETRIES = (exception, executionCount, context) -> false;
private final MetricRegistry metricRegistry;
Method createClient
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
protected ConfiguredCloseableHttpClient createClient(
final org.apache.http.impl.client.HttpClientBuilder builder,
final InstrumentedHttpClientConnectionManager manager,
final String name) {
final String cookiePolicy = configuration.isCookiesEnabled() ? CookieSpecs.DEFAULT : CookieSpecs.IGNORE_COOKIES;
- 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"