dropwizard/dropwizard

View on GitHub

Showing 869 of 869 total issues

File AssetServletTest.java has 449 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package io.dropwizard.servlets.assets;

import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpTester;
import org.eclipse.jetty.http.HttpVersion;

    File AbstractServerFactory.java has 444 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package io.dropwizard.server;
    
    import com.codahale.metrics.MetricRegistry;
    import com.codahale.metrics.health.HealthCheckRegistry;
    import com.codahale.metrics.jetty9.InstrumentedHandler;

      ValidatingResource has 47 methods (exceeds 20 allowed). Consider refactoring.
      Open

      @Path("/valid/")
      @Produces(MediaType.APPLICATION_JSON)
      @Consumes(MediaType.APPLICATION_JSON)
      public class ValidatingResource {
      
      

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

        package io.dropwizard.validation;
        
        import io.dropwizard.util.Size;
        import io.dropwizard.util.SizeUnit;
        import org.junit.jupiter.api.Test;
        dropwizard-validation/src/test/java/io/dropwizard/validation/DataSizeValidatorTest.java on lines 1..94

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

        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.validation;
        
        import io.dropwizard.util.DataSize;
        import io.dropwizard.util.DataSizeUnit;
        import org.junit.jupiter.api.Test;
        dropwizard-validation/src/test/java/io/dropwizard/validation/SizeValidatorTest.java on lines 1..90

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

        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 4 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/guava/OptionalCookieParamResourceTest.java on lines 1..104
        dropwizard-jersey/src/test/java/io/dropwizard/jersey/optional/OptionalCookieParamResourceTest.java on lines 1..104
        dropwizard-jersey/src/test/java/io/dropwizard/jersey/optional/OptionalHeaderParamResourceTest.java on lines 1..104

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

        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 4 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/OptionalCookieParamResourceTest.java on lines 1..104
        dropwizard-jersey/src/test/java/io/dropwizard/jersey/guava/OptionalHeaderParamResourceTest.java on lines 1..104
        dropwizard-jersey/src/test/java/io/dropwizard/jersey/optional/OptionalCookieParamResourceTest.java on lines 1..104

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

        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 4 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/OptionalCookieParamResourceTest.java on lines 1..104
        dropwizard-jersey/src/test/java/io/dropwizard/jersey/guava/OptionalHeaderParamResourceTest.java on lines 1..104
        dropwizard-jersey/src/test/java/io/dropwizard/jersey/optional/OptionalHeaderParamResourceTest.java on lines 1..104

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

        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 4 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/guava/OptionalHeaderParamResourceTest.java on lines 1..104
        dropwizard-jersey/src/test/java/io/dropwizard/jersey/optional/OptionalCookieParamResourceTest.java on lines 1..104
        dropwizard-jersey/src/test/java/io/dropwizard/jersey/optional/OptionalHeaderParamResourceTest.java on lines 1..104

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

        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 org.junit.jupiter.api.Test;
        dropwizard-jersey/src/test/java/io/dropwizard/jersey/optional/OptionalDoubleMessageBodyWriterTest.java on lines 1..122

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

        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 org.junit.jupiter.api.Test;
        dropwizard-jersey/src/test/java/io/dropwizard/jersey/optional/OptionalIntMessageBodyWriterTest.java on lines 1..124

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

        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

        Method addOverride has a Cognitive Complexity of 39 (exceeds 5 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("."))

        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 getTypeParameter has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

            public static <T> Class<T> getTypeParameter(Class<?> klass, Class<? super T> bound) {
                Type t = requireNonNull(klass);
                while (t instanceof Class<?>) {
                    t = ((Class<?>) t).getGenericSuperclass();
                }
        Severity: Minor
        Found in dropwizard-util/src/main/java/io/dropwizard/util/Generics.java - About 5 hrs to fix

        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

        File HttpsConnectorFactoryTest.java has 393 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 io.dropwizard.configuration.ResourceConfigurationSourceProvider;

          File HttpConnectorFactory.java has 377 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;

            TlsSocketAppenderFactory has 38 methods (exceeds 20 allowed). Consider refactoring.
            Open

            @JsonTypeName("tls")
            public class TlsSocketAppenderFactory<E extends DeferredProcessingAware> extends TcpSocketAppenderFactory<E> {
            
                @Nullable
                private String keyStorePath;

              File DropwizardResourceConfigTest.java has 374 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              package io.dropwizard.jersey;
              
              import io.dropwizard.jersey.dummy.DummyResource;
              import org.glassfish.jersey.internal.inject.AbstractBinder;
              import org.glassfish.jersey.server.model.Resource;

                Method parameters has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    static Stream<Arguments> parameters() {
                        return Stream.of(
                                // bytes
                                arguments(DataSizeUnit.BYTES, DataSizeUnit.BYTES, new Converter(DataSizeUnit.BYTES::toBytes), 1L),
                                arguments(DataSizeUnit.BYTES, DataSizeUnit.KILOBYTES, new Converter(DataSizeUnit.BYTES::toKilobytes), 0L),

                  File JerseyClientIntegrationTest.java has 362 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  package io.dropwizard.client;
                  
                  import com.codahale.metrics.MetricRegistry;
                  import com.fasterxml.jackson.annotation.JsonProperty;
                  import com.fasterxml.jackson.databind.ObjectMapper;

                    Method configureSslContextFactory has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected SslContextFactory configureSslContextFactory(SslContextFactory factory) {
                            if (keyStorePath != null) {
                                factory.setKeyStorePath(keyStorePath);
                            }
                    
                    

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language