CloudSlang/cs-actions

View on GitHub
cs-http-client/src/main/java/io/cloudslang/content/httpclient/actions/HttpClientAction.java

Summary

Maintainability
F
3 days
Test Coverage

Method execute has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
Open

    @Action(name = "Http Client",
            outputs = {
                    @Output(EXCEPTION),
                    @Output(STATUS_CODE),
                    @Output(FINAL_LOCATION),

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 execute has 49 arguments (exceeds 4 allowed). Consider refactoring.
Open

            @Param(value = HttpClientInputs.URL, required = true) String url,
            @Param(HttpClientInputs.TLS_VERSION) String tlsVersion,
            @Param(HttpClientInputs.ALLOWED_CYPHERS) String allowedCyphers,
            @Param(HttpClientInputs.AUTH_TYPE) String authType,
            @Param(HttpClientInputs.PREEMPTIVE_AUTH) String preemptiveAuth,

    Method execute has 134 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Action(name = "Http Client",
                outputs = {
                        @Output(EXCEPTION),
                        @Output(STATUS_CODE),
                        @Output(FINAL_LOCATION),

      Avoid deeply nested control flow statements.
      Open

                                      if (protocol.toUpperCase().equals(TLSv13.toUpperCase()))
                                          tls13 = protocol;

        Avoid deeply nested control flow statements.
        Open

                                        if (protocol.toUpperCase().equals(TLSv12.toUpperCase()))
                                            tls12 = protocol;

          Avoid too many return statements within this method.
          Open

                      return exceptionResult(e.getMessage(), e);

            Avoid too many return statements within this method.
            Open

                                return exceptionResult(e.getMessage(), e);

              Avoid too many return statements within this method.
              Open

                                      return new HttpClientService().execute(httpClientInputs);

                Avoid too many return statements within this method.
                Open

                                            return new HttpClientService().execute(httpClientInputs);

                  Avoid too many return statements within this method.
                  Open

                                      return new HttpClientService().execute(httpClientInputs);

                    Avoid too many return statements within this method.
                    Open

                                return new HttpClientService().execute(httpClientInputs);

                      Avoid too many return statements within this method.
                      Open

                                          return new HttpClientService().execute(httpClientInputs);

                        Avoid too many return statements within this method.
                        Open

                                                        return exceptionResult(ex.getMessage(), exe);

                          Avoid too many return statements within this method.
                          Open

                                                  return exceptionResult(ex.getMessage(), ex);

                            Avoid too many return statements within this method.
                            Open

                                                            return new HttpClientService().execute(httpClientInputs);

                              There are no issues that match your filters.

                              Category
                              Status