silentbalanceyh/vertx-zero

View on GitHub
vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java

Summary

Maintainability
D
2 days
Test Coverage

Method aiExecute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    @SuppressWarnings("unchecked")
    private static Object aiExecute(final Class<?> sourceType, final Class<?> targetType, final Object input,
                                    final Function<Object, Object> addonFn) {

        if (Instant.class == targetType) {
Severity: Minor
Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 2 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

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

    private static Class<?> aiUnit(final Class<?> type) {
        if (Long.class == type || long.class == type) {
            /*
             * - java.lang.Long
             * - java.lang.long
Severity: Minor
Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.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

Method aiExecute has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @SuppressWarnings("unchecked")
    private static Object aiExecute(final Class<?> sourceType, final Class<?> targetType, final Object input,
                                    final Function<Object, Object> addonFn) {

        if (Instant.class == targetType) {
Severity: Minor
Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 1 hr to fix

    Method aiValue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private static Object aiValue(final Object input, final Class<?> type,
                                      final Function<Class<?>, Class<?>> targetFn,
                                      final BiFunction<Class<?>, Class<?>, Object> executor) {
            if (Objects.isNull(input)) {
                /*
    Severity: Minor
    Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.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

    Avoid too many return statements within this method.
    Open

                return Long.class;
    Severity: Major
    Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return V.vBoolean().to(input, sourceType);
      Severity: Major
      Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return null;
        Severity: Major
        Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return Integer.class;
          Severity: Major
          Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return V.vInteger().to(input, sourceType);
            Severity: Major
            Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return Boolean.class;
              Severity: Major
              Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return V.vFloat().to(input, sourceType);
                Severity: Major
                Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return Ut.toDate(date);
                  Severity: Major
                  Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return Ut.toDateTime(date);
                    Severity: Major
                    Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return Short.class;
                      Severity: Major
                      Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return V.vShort().to(input, sourceType);
                        Severity: Major
                        Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return Double.class;
                          Severity: Major
                          Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return V.vLong().to(input, sourceType);
                            Severity: Major
                            Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return V.vDouble().to(input, sourceType);
                              Severity: Major
                              Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                return Ut.toTime(date);
                                Severity: Major
                                Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return V.vInstant().to(input, sourceType);
                                  Severity: Major
                                  Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java - About 30 mins to fix

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

                                        static JsonObject aiOut(final JsonObject out, final BMapping mapping, final boolean keepNil) {
                                            if (Objects.isNull(mapping)) {
                                                /*
                                                 * No mapping
                                                 */
                                    vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java on lines 271..298

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

                                    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 JsonObject aiIn(final JsonObject in, final BMapping mapping, final boolean keepNil) {
                                            if (Objects.isNull(mapping)) {
                                                /*
                                                 * No mapping
                                                 */
                                    vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java on lines 300..323

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

                                    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

                                        @SuppressWarnings("all")
                                        static Object aiJValue(final Object input, final Class<?> type) {
                                            return aiValue(input, type, Value::aiJType, (sourceType, targetType) -> aiExecute(sourceType, targetType, input,
                                                (source) -> {
                                                    /*
                                    vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java on lines 96..112

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

                                    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

                                        @SuppressWarnings("all")
                                        static Object aiValue(final Object input, final Class<?> type) {
                                            return aiValue(input, type, Value::aiType, (sourceType, targetType) -> aiExecute(sourceType, targetType, input,
                                                (source) -> {
                                                    /*
                                    vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java on lines 75..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 73.

                                    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

                                            } else if (JsonArray.class == targetType) {
                                                /*
                                                 * Strict:     -       JsonArray
                                                 */
                                                return Ut.toJArray(input);
                                    Severity: Minor
                                    Found in vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Value.java and 1 other location - About 45 mins to fix
                                    vertx-gaia/vertx-co/src/main/jib/io/vertx/up/uca/serialization/Java8DataTimeSaber.java on lines 39..45

                                    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

                                    There are no issues that match your filters.

                                    Category
                                    Status