dropwizard/dropwizard

View on GitHub

Showing 869 of 869 total issues

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

    @Nested
    class DateParameterTests {
        @Test
        void validDateParameter() {
            final String date = APP.client().target("http://localhost:" + APP.getLocalPort() + "/hello-world/date")
dropwizard-example/src/test/java/com/example/helloworld/IntegrationTest.java on lines 63..91

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

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

    @Nested
    class DateParameterTests {
        @Test
        void validDateParameter() {
            final String date = APP.client().target("http://localhost:" + APP.getLocalPort() + "/hello-world/date")
dropwizard-example/src/test/java/com/example/helloworld/DockerIntegrationTest.java on lines 76..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 142.

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

Duration has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

public class Duration implements Comparable<Duration>, Serializable {
    private static final long serialVersionUID = 1445611723318059801L;

    private static final Pattern DURATION_PATTERN = Pattern.compile("(\\d+)\\s*(\\S+)");
    private static final Map<String, TimeUnit> SUFFIXES;
Severity: Minor
Found in dropwizard-util/src/main/java/io/dropwizard/util/Duration.java - About 2 hrs to fix

    JsonProcessingExceptionMapperTest has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class JsonProcessingExceptionMapperTest extends AbstractJerseyTest {
    
        abstract boolean showDetails();
    
        @Override

      Method shouldRecordNumberOfHealthyAndUnhealthyHealthChecks has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Test
          void shouldRecordNumberOfHealthyAndUnhealthyHealthChecks() {
              // given
              final Schedule schedule = new Schedule();
              final List<HealthCheckConfiguration> configs = new ArrayList<>();

        File TlsSocketAppenderFactory.java has 251 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        package io.dropwizard.logging;
        
        import ch.qos.logback.core.spi.DeferredProcessingAware;
        import com.fasterxml.jackson.annotation.JsonProperty;
        import com.fasterxml.jackson.annotation.JsonTypeName;

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

          package io.dropwizard.validation;
          
          import io.dropwizard.util.Duration;
          
          import javax.validation.ConstraintValidator;
          dropwizard-validation/src/main/java/io/dropwizard/validation/MaxDurationValidator.java on lines 1..41

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

          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.Duration;
          
          import javax.validation.ConstraintValidator;
          dropwizard-validation/src/main/java/io/dropwizard/validation/MinDurationValidator.java on lines 1..41

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

          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 buildAppender has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected FileAppender<E> buildAppender(LoggerContext context) {
                  if (archive) {
                      final RollingFileAppender<E> appender = new RollingFileAppender<>();
                      appender.setContext(context);
                      appender.setFile(currentLogFilename);

            Method startIfRequired has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private void startIfRequired() throws Exception {
                    if (jettyServer != null) {
                        return;
                    }
            
            

              Method doPost has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  protected void doPost(HttpServletRequest req,
                                        HttpServletResponse resp) throws ServletException, IOException {
                      final String pathInfo = req.getPathInfo();
                      final Task task = pathInfo != null ? tasks.get(pathInfo) : null;

              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

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

                  @Test
                  public void test2() throws Exception {
                      dropwizardAppRule.before();
                      assertThat(System.getProperty("app-rule-reset.message")).isEqualTo("A new way to say Hooray!");
                      assertThat(System.getProperty("app-rule-reset.extra")).isNull();
              dropwizard-testing/src/test/java/io/dropwizard/testing/junit5/DropwizardAppExtensionResetConfigOverrideTest.java on lines 20..36

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

              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 test2() throws Exception {
                      dropwizardAppExtension.before();
                      assertThat(System.getProperty("app-rule-reset.message")).isEqualTo("A new way to say Hooray!");
                      assertThat(System.getProperty("app-rule-reset.extra")).isNull();
              dropwizard-testing/src/test/java/io/dropwizard/testing/junit/DropwizardAppRuleResetConfigOverrideTest.java on lines 20..36

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

              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 3 locations. Consider refactoring.
              Open

                  @Test
                  void testPrintHelp() throws Exception {
                      final ByteArrayOutputStream out = new ByteArrayOutputStream();
                      MigrationTestSupport.createSubparser(locksCommand).printHelp(new PrintWriter(new OutputStreamWriter(out, UTF_8), true));
                      assertThat(out.toString(UTF_8.name())).isEqualTo(String.format(
              dropwizard-migrations/src/test/java/io/dropwizard/migrations/DbCalculateChecksumCommandTest.java on lines 38..62
              dropwizard-migrations/src/test/java/io/dropwizard/migrations/DbTestCommandTest.java on lines 30..54

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

              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 3 locations. Consider refactoring.
              Open

                  @Test
                  void testPrintHelp() throws Exception {
                      final ByteArrayOutputStream baos = new ByteArrayOutputStream();
                      MigrationTestSupport.createSubparser(dbTestCommand).printHelp(new PrintWriter(new OutputStreamWriter(baos, UTF_8), true));
                      assertThat(baos.toString(UTF_8.name())).isEqualTo(String.format(
              dropwizard-migrations/src/test/java/io/dropwizard/migrations/DbCalculateChecksumCommandTest.java on lines 38..62
              dropwizard-migrations/src/test/java/io/dropwizard/migrations/DbLocksCommandTest.java on lines 61..85

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

              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 3 locations. Consider refactoring.
              Open

                  @Test
                  void testHelpPage() throws Exception {
                      final ByteArrayOutputStream out = new ByteArrayOutputStream();
                      MigrationTestSupport.createSubparser(migrateCommand).printHelp(new PrintWriter(new OutputStreamWriter(out, UTF_8), true));
                      assertThat(out.toString(UTF_8.name())).isEqualTo(String.format(
              dropwizard-migrations/src/test/java/io/dropwizard/migrations/DbLocksCommandTest.java on lines 61..85
              dropwizard-migrations/src/test/java/io/dropwizard/migrations/DbTestCommandTest.java on lines 30..54

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

              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 testLogAccessJsonToConsole has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @Test
                  void testLogAccessJsonToConsole() throws Exception {
                      ConsoleAppenderFactory<IAccessEvent> consoleAppenderFactory = getAppenderFactory("yaml/json-access-log-default.yml");
                      // Use sys.err, because there are some other log configuration messages in std.out
                      consoleAppenderFactory.setTarget(ConsoleAppenderFactory.ConsoleStream.STDERR);

                Method expectObjectFormat has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Override
                    public JsonObjectFormatVisitor expectObjectFormat(JavaType type) throws JsonMappingException {
                        // store the pointer to the own instance
                        final ConfigurationMetadata thiss = this;
                
                

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

                      @Test
                      void shouldScheduleCheckForNotAlreadyScheduledHealthyDependency() {
                          final String name = "test";
                          final Schedule schedule = new Schedule();
                  
                  
                  dropwizard-health/src/test/java/io/dropwizard/health/HealthCheckSchedulerTest.java on lines 53..72

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

                  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 shouldScheduleCheckForNotAlreadyScheduledUnhealthyDependency() {
                          final String name = "test";
                          final Schedule schedule = new Schedule();
                  
                  
                  dropwizard-health/src/test/java/io/dropwizard/health/HealthCheckSchedulerTest.java on lines 34..51

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language