silentbalanceyh/vertx-zero

View on GitHub
vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java

Summary

Maintainability
F
3 days
Test Coverage

Method parse has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    static Date parse(final String literal) {
        if (Objects.isNull(literal)) {
            return null;
        } else {
            String target = literal;
Severity: Minor
Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java - About 4 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 TPeriod.java has 344 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package io.horizon.util;

import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
Severity: Minor
Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java - About 4 hrs to fix

    TPeriod has 32 methods (exceeds 20 allowed). Consider refactoring.
    Open

    final class TPeriod {
        private static final List<DateTimeFormatter> DATES = new ArrayList<>() {
            {
                this.add(Iso.DATE);
                this.add(Iso.BASIC_DATE);
    Severity: Minor
    Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java - About 4 hrs to fix

      Method parse has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          static Date parse(final String literal) {
              if (Objects.isNull(literal)) {
                  return null;
              } else {
                  String target = literal;
      Severity: Minor
      Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java - About 1 hr to fix

        Method parseFull has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            static Date parseFull(final String literal) {
                if (Objects.isNull(literal)) {
                    return null;
                } else {
                    // Datetime parsing
        Severity: Minor
        Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java - About 1 hr 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

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

            private interface Iso {
        
                /**
                 * '2011-12-03'
                 */
        vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/ZERO.java on lines 157..255

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

        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

            private interface Storage {
                /**
                 * Date Time patterns
                 */
                ConcurrentMap<Integer, String> PATTERNS_MAP = new ConcurrentHashMap<Integer, String>() {
        vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/ZERO.java on lines 67..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 98.

        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

                        } else if (15 > pattern.length()) {
                            final LocalTime time = parseEach(target, formatter, LocalTime::parse);
                            if (Objects.isNull(time)) {
                                converted = null;
                            } else {
        vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java on lines 270..279
        vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java on lines 254..262

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

        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

                        } else {
                            final LocalDateTime datetime = parseEach(target, formatter, LocalDateTime::parse);
                            // final LocalDateTime datetime = LocalDateTime.parse(target, formatter);
                            if (Objects.isNull(datetime)) {
                                converted = null;
        vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java on lines 262..270
        vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java on lines 254..262

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

        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

                        if (10 == pattern.length()) {
                            final LocalDate date = parseEach(target, formatter, LocalDate::parse); // LocalDate.parse(target, formatter);
                            if (Objects.isNull(date)) {
                                converted = null;
                            } else {
        vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java on lines 270..279
        vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java on lines 262..270

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

        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

            static void itDay(final LocalDate from, final LocalDate end,
                              final Consumer<Date> consumer) {
                LocalDate beginDay = from;
                do {
                    consumer.accept(parse(beginDay));
        Severity: Minor
        Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java and 1 other location - About 45 mins to fix
        vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java on lines 340..347

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

        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

            static void itWeek(final LocalDate from, final LocalDate end,
                               final Consumer<Date> consumer) {
                LocalDate beginDay = from;
                do {
                    consumer.accept(parse(beginDay));
        Severity: Minor
        Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java and 1 other location - About 45 mins to fix
        vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java on lines 331..338

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

        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

            private static final List<DateTimeFormatter> TIMES = new ArrayList<>() {
                {
                    this.add(Iso.TIME);
                    this.add(Iso.LOCAL_TIME);
                    this.add(Iso.OFFSET_TIME);
        Severity: Minor
        Found in vertx-gaia/vertx-ams/src/main/java/io/horizon/util/TPeriod.java and 1 other location - About 40 mins to fix
        vertx-pin/zero-atom/src/main/modeler/io/modello/dynamic/modular/file/excel/ExModello.java on lines 89..96

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

        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

        There are no issues that match your filters.

        Category
        Status