Showing 869 of 869 total issues
HttpClientConfiguration
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
public class HttpClientConfiguration {
@NotNull
private Duration timeout = Duration.milliseconds(500);
@NotNull
BaseConfigurationFactoryTest
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
public abstract class BaseConfigurationFactoryTest {
private static final String NEWLINE = System.lineSeparator();
@SuppressWarnings("UnusedDeclaration")
File TaskServletTest.java
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
package io.dropwizard.servlets.tasks;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.annotation.ExceptionMetered;
import com.codahale.metrics.annotation.Metered;
Method createClient
has 80 lines of code (exceeds 25 allowed). Consider refactoring. 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
public class HttpClientBuilder {
@SuppressWarnings("UnnecessaryLambda")
private static final HttpRequestRetryHandler NO_RETRIES = (exception, executionCount, context) -> false;
private final MetricRegistry metricRegistry;
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;
SizeTest
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
@SuppressWarnings("deprecation")
class SizeTest {
@Test
void convertsToTerabytes() {
assertThat(Size.terabytes(2).toTerabytes())
SizeUnitTest
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
@SuppressWarnings("deprecation")
class SizeUnitTest {
// BYTES
@Test
void oneByteInBytes() {
JerseyClientBuilder
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
public class JerseyClientBuilder {
private final List<Object> singletons = new ArrayList<>();
private final List<Class<?>> providers = new ArrayList<>();
private final Map<String, Object> properties = new LinkedHashMap<>();
Method expectObjectFormat
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
@Override
public JsonObjectFormatVisitor expectObjectFormat(JavaType type) throws JsonMappingException {
// store the pointer to the own instance
final ConfigurationMetadata thiss = this;
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
@Test
void testChunkedPostWithoutGzip() throws Exception {
httpServer.createContext("/register", httpExchange -> {
try {
Headers requestHeaders = httpExchange.getRequestHeaders();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 185.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
@Test
void testRetryHandler() throws Exception {
httpServer.createContext("/register", httpExchange -> {
try {
Headers requestHeaders = httpExchange.getRequestHeaders();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 185.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method addOverride
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected void addOverride(JsonNode root, String name, String value) {
JsonNode node = root;
final List<String> parts = Arrays.stream(ESCAPED_DOT_SPLIT_PATTERN.split(name))
.map(String::trim)
.map(key -> ESCAPED_DOT_PATTERN.matcher(key).replaceAll("."))
DurationTest
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class DurationTest {
@Test
void convertsDays() throws Exception {
assertThat(Duration.days(2).toDays())
.isEqualTo(2);
FakeSecureRequestContext
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
static class FakeSecureRequestContext implements ContainerRequestContext {
private SecurityContext securityContext;
FakeSecureRequestContext() {
GzipHandlerFactory
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
public class GzipHandlerFactory {
private boolean enabled = true;
@NotNull
DropwizardResourceConfigTest
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class DropwizardResourceConfigTest {
private DropwizardResourceConfig rc = DropwizardResourceConfig.forTesting();
private AbstractJerseyTest jerseyTest = new AbstractJerseyTest() {
@Override
protected Application configure() {
Similar blocks of code found in 2 locations. Consider refactoring. Open
@Test
void testDoNotPrintStackTrackWhenDisabled() throws Exception {
final TaskConfiguration taskConfiguration = new TaskConfiguration();
taskConfiguration.setPrintStackTraceOnError(false);
final TaskServlet servlet = new TaskServlet(metricRegistry, taskConfiguration);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 179.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
@Test
void testPrintStackTrackWhenEnabled() throws Exception {
final TaskConfiguration taskConfiguration = new TaskConfiguration();
taskConfiguration.setPrintStackTraceOnError(true);
final TaskServlet servlet = new TaskServlet(metricRegistry, taskConfiguration);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 179.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method doGet
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void doGet(HttpServletRequest req,
HttpServletResponse resp) throws ServletException, IOException {
try {
final StringBuilder builder = new StringBuilder(req.getServletPath());
- 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"