dropwizard/dropwizard

View on GitHub

Showing 869 of 869 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    @Test
    void isComparable() {
        // both zero
        assertThat(Size.bytes(0)).isEqualByComparingTo(Size.bytes(0));
        assertThat(Size.bytes(0)).isEqualByComparingTo(Size.kilobytes(0));
dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 265..602

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 5353.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    @Test
    void isComparable() {
        // both zero
        assertThat(DataSize.bytes(0)).isEqualByComparingTo(DataSize.bytes(0));
        assertThat(DataSize.bytes(0)).isEqualByComparingTo(DataSize.kilobytes(0));
dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 175..512

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 5353.

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

Further Reading

File ConstraintViolationExceptionMapperTest.java has 1100 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package io.dropwizard.jersey.validation;

import io.dropwizard.jersey.AbstractJerseyTest;
import io.dropwizard.jersey.DropwizardResourceConfig;
import io.dropwizard.jersey.jackson.JacksonMessageBodyProviderTest.Example;

    Method isComparable has 539 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Test
        void isComparable() throws Exception {
            // both zero
            assertThat(Duration.nanoseconds(0)).isEqualByComparingTo(Duration.nanoseconds(0));
            assertThat(Duration.nanoseconds(0)).isEqualByComparingTo(Duration.microseconds(0));
    Severity: Major
    Found in dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java - About 2 days to fix

      ConstraintViolationExceptionMapperTest has 118 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class ConstraintViolationExceptionMapperTest extends AbstractJerseyTest {
          private static final Locale DEFAULT_LOCALE = Locale.getDefault();
      
          @Override
          protected Application configure() {

        File DurationTest.java has 761 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        package io.dropwizard.util;
        
        import com.fasterxml.jackson.databind.ObjectMapper;
        import org.junit.jupiter.api.Test;
        
        
        Severity: Major
        Found in dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java - About 1 day to fix

          DataSourceFactory has 84 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public class DataSourceFactory implements PooledDataSourceFactory {
          
              private static final String DEFAULT_VALIDATION_QUERY = "/* Health Check */ SELECT 1";
          
              @SuppressWarnings("UnusedDeclaration")
          Severity: Major
          Found in dropwizard-db/src/main/java/io/dropwizard/db/DataSourceFactory.java - About 1 day to fix

            File HttpClientBuilderTest.java has 635 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            package io.dropwizard.client;
            
            import com.codahale.metrics.MetricRegistry;
            import com.codahale.metrics.httpclient.HttpClientMetricNameStrategies;
            import com.codahale.metrics.httpclient.InstrumentedHttpClientConnectionManager;

              Method isComparable has 275 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @Test
                  void isComparable() {
                      // both zero
                      assertThat(DataSize.bytes(0)).isEqualByComparingTo(DataSize.bytes(0));
                      assertThat(DataSize.bytes(0)).isEqualByComparingTo(DataSize.kilobytes(0));
              Severity: Major
              Found in dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java - About 1 day to fix

                Method isComparable has 275 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Test
                    void isComparable() {
                        // both zero
                        assertThat(Size.bytes(0)).isEqualByComparingTo(Size.bytes(0));
                        assertThat(Size.bytes(0)).isEqualByComparingTo(Size.kilobytes(0));
                Severity: Major
                Found in dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java - About 1 day to fix

                  File DataSizeTest.java has 590 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  package io.dropwizard.util;
                  
                  import com.fasterxml.jackson.databind.ObjectMapper;
                  import org.junit.jupiter.api.Test;
                  
                  
                  Severity: Major
                  Found in dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java - About 1 day to fix

                    HttpsConnectorFactory has 62 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    @JsonTypeName("https")
                    public class HttpsConnectorFactory extends HttpConnectorFactory {
                        private static final Logger LOGGER = LoggerFactory.getLogger(HttpsConnectorFactory.class);
                        private static final AtomicBoolean LOGGED = new AtomicBoolean(false);
                    
                    

                      HttpClientBuilderTest has 61 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class HttpClientBuilderTest {
                          static class CustomRequestExecutor extends HttpRequestExecutor {
                          }
                      
                          static class CustomBuilder extends HttpClientBuilder {

                        HttpConnectorFactory has 59 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        @JsonTypeName("http")
                        public class HttpConnectorFactory implements ConnectorFactory {
                            public static ConnectorFactory application() {
                                final HttpConnectorFactory factory = new HttpConnectorFactory();
                                factory.port = 8080;

                          AbstractServerFactory has 57 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          public abstract class AbstractServerFactory implements ServerFactory {
                              private static final Logger LOGGER = LoggerFactory.getLogger(ServerFactory.class);
                          
                              @Valid
                              @Nullable

                            File SizeTest.java has 502 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            package io.dropwizard.util;
                            
                            import com.fasterxml.jackson.databind.ObjectMapper;
                            import org.junit.jupiter.api.Test;
                            
                            
                            Severity: Major
                            Found in dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java - About 1 day to fix

                              File DataSourceFactory.java has 501 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              package io.dropwizard.db;
                              
                              import com.codahale.metrics.MetricRegistry;
                              import com.fasterxml.jackson.annotation.JsonIgnore;
                              import com.fasterxml.jackson.annotation.JsonProperty;
                              Severity: Major
                              Found in dropwizard-db/src/main/java/io/dropwizard/db/DataSourceFactory.java - About 1 day to fix

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                package io.dropwizard.jersey.guava;
                                
                                import com.google.common.base.Optional;
                                import io.dropwizard.jersey.AbstractJerseyTest;
                                import io.dropwizard.jersey.DropwizardResourceConfig;
                                dropwizard-jersey/src/test/java/io/dropwizard/jersey/optional/OptionalFormParamResourceTest.java on lines 1..120

                                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 488.

                                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

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                package io.dropwizard.jersey.optional;
                                
                                import io.dropwizard.jersey.AbstractJerseyTest;
                                import io.dropwizard.jersey.DropwizardResourceConfig;
                                import io.dropwizard.jersey.MyMessage;
                                dropwizard-jersey/src/test/java/io/dropwizard/jersey/guava/OptionalFormParamResourceTest.java on lines 1..120

                                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 488.

                                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

                                Further Reading

                                File HttpsConnectorFactory.java has 493 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                package io.dropwizard.jetty;
                                
                                import com.codahale.metrics.MetricRegistry;
                                import com.codahale.metrics.jetty9.InstrumentedConnectionFactory;
                                import com.fasterxml.jackson.annotation.JsonProperty;
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language