silentbalanceyh/vertx-zero

View on GitHub
vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.java

Summary

Maintainability
C
1 day
Test Coverage

Method toParameter has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    static Object toParameter(final RoutingContext context, final Class<?> type) {
        Object returnValue = null;
        if (is(type, XHeader.class)) {
            /*
             * XHeader for
Severity: Minor
Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.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 toParameter has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    static Object toParameter(final Envelop envelop, final Class<?> type,
                              final Mission mission, final Refer underway) {
        if (Envelop.class == type) {
            /*
             * Envelop
Severity: Minor
Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.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 toParameter has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static Object toParameter(final RoutingContext context, final Class<?> type) {
        Object returnValue = null;
        if (is(type, XHeader.class)) {
            /*
             * XHeader for
Severity: Minor
Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.java - About 1 hr to fix

    Method toParameter has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static Object toParameter(final Envelop envelop, final Class<?> type,
                                  final Mission mission, final Refer underway) {
            if (Envelop.class == type) {
                /*
                 * Envelop
    Severity: Minor
    Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.java - About 1 hr to fix

      Method toParameter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          static Object toParameter(final Envelop envelop, final Class<?> type) {
              final Object returnValue;
              final RoutingContext context = envelop.context();
              if (is(type, XHeader.class)) {
                  /*
      Severity: Minor
      Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.java - About 45 mins 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 null;
      Severity: Major
      Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return envelop.session();
        Severity: Major
        Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.java - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return envelop.headers();
          Severity: Major
          Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return envelop;
            Severity: Major
            Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return commercial;
              Severity: Major
              Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.java - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return envelop.user();
                Severity: Major
                Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.java - About 30 mins to fix

                  Method toHandler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      static <T> Handler<AsyncResult<T>> toHandler(
                          final Message<Envelop> message
                      ) {
                          return handler -> {
                              if (handler.succeeded()) {
                  Severity: Minor
                  Found in vertx-gaia/vertx-up/src/main/java/io/vertx/up/unity/Web.java - About 25 mins 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

                  There are no issues that match your filters.

                  Category
                  Status