dropwizard/dropwizard

View on GitHub

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())
              Severity: Minor
              Found in dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java - About 3 hrs to fix

                SizeUnitTest has 26 methods (exceeds 20 allowed). Consider refactoring.
                Open

                @SuppressWarnings("deprecation")
                class SizeUnitTest {
                    // BYTES
                    @Test
                    void oneByteInBytes() {
                Severity: Minor
                Found in dropwizard-util/src/test/java/io/dropwizard/util/SizeUnitTest.java - About 3 hrs to fix

                  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;
                    
                    

                    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();
                    dropwizard-client/src/test/java/io/dropwizard/client/JerseyClientIntegrationTest.java on lines 166..193

                    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

                    Further Reading

                    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();
                    dropwizard-client/src/test/java/io/dropwizard/client/JerseyClientIntegrationTest.java on lines 138..164

                    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

                    Further Reading

                    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);
                      Severity: Minor
                      Found in dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java - About 2 hrs to fix

                        FakeSecureRequestContext has 25 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                            static class FakeSecureRequestContext implements ContainerRequestContext {
                        
                                private SecurityContext securityContext;
                        
                                FakeSecureRequestContext() {
                        Severity: Minor
                        Found in dropwizard-auth/src/test/java/io/dropwizard/auth/AuthFilterTest.java - About 2 hrs to fix

                          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);
                              dropwizard-servlets/src/test/java/io/dropwizard/servlets/tasks/TaskServletTest.java on lines 312..335

                              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

                              Further Reading

                              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);
                              dropwizard-servlets/src/test/java/io/dropwizard/servlets/tasks/TaskServletTest.java on lines 337..360

                              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

                              Further Reading

                              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());

                              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