CloudSlang/cs-actions

View on GitHub

Showing 3,994 of 4,023 total issues

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

    @NotNull
    public static String createVMBody(NutanixCreateVMInputs nutanixCreateVMInputs, String delimiter) {
        String requestBody = EMPTY;
        final List<String> hostUUIDsList = new ArrayList<>();
        ObjectMapper createVMMapper = new ObjectMapper();

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 addVerifySchedulerTime has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    @NotNull
    private static List<String> addVerifySchedulerTime(@NotNull List<String> exceptions, @NotNull final String input) {
        String[] timeFormat = input.split(COLON);
        if (timeFormat.length != 3) {
            exceptions.add(String.format(EXCEPTION_SCHEDULER_TIME, Constants.SchedulerTimeConstants.SCHEDULER_TIME));

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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    @Action(name = LIST_VMS_OPERATION_NAME,
            description = LIST_VMS_OPERATION_DESC,
            outputs = {
                    @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC),
                    @Output(value = EXCEPTION, description = EXCEPTION_DESC),

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

    private String createDeleteShellRequestBody(String doc, String url, String shellId, String maxEnvelopeSize, String winrmLocale, String operationTimeout) throws RuntimeException {

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

        public OperatingSystemDetails processOutput(OperatingSystemDetails operatingSystemDetails, Map<String, String> execute, String detectOption) {
            String resultString  = execute.get(RETURN_RESULT);
            operatingSystemDetails.addCommandOutput(detectOption, singletonList(resultString));
    
            String lineSeparator = contains(resultString, WINDOWS_LINE_SEPARATOR) ? WINDOWS_LINE_SEPARATOR

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

        public Map<String, String> execute(@Param(value = PASSWORD_LENGTH, description = PASSWORD_LENGTH_DESC) String passwordLength,
                                           @Param(value = NUMBER_OF_LOWER_CASE_CHARACTERS, description = NUMBER_OF_LOWER_CASE_CHARACTERS_DESC) String numberOfLowerCaseCharacters,
                                           @Param(value = NUMBER_OF_UPPER_CASE_CHARACTERS, description = NUMBER_OF_UPPER_CASE_CHARACTERS_DESC) String numberOfUpperCaseCharacters,
                                           @Param(value = NUMBER_OF_NUMERICAL_CHARACTERS, description = NUMBER_OF_NUMERICAL_CHARACTERS_DESC) String numberOfNumericalCharacters,
                                           @Param(value = NUMBER_OF_SPECIAL_CHARACTERS, description = NUMBER_OF_SPECIAL_CHARACTERS_DESC) String numberOfSpecialCharacters,

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

          private Map<String, String> receiveCommandResult(HttpClientService csHttpClient, HttpClientInputs httpClientInputs,
                                                           String shellId, String commandId, WSManRequestInputs wsManRequestInputs) throws Exception {
              String documentStr = ResourceLoader.loadAsString(RECEIVE_REQUEST_XML);
              documentStr = createReceiveRequestBody(documentStr, httpClientInputs.getUrl(), shellId, commandId, String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout()));
              Map<String, String> receiveResult;

      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 addVerifySchedulerTime has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          @NotNull
          private static List<String> addVerifySchedulerTime(@NotNull List<String> exceptions, @NotNull final String input) {
              String[] timeFormat = input.split(COLON);
              if (timeFormat.length != 3) {
                  exceptions.add(String.format(EXCEPTION_SCHEDULER_TIME, SchedulerTimeConstants.SCHEDULER_TIME));

      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 copyTo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public void copyTo(ICopier destination, String sourcePath, String destPath) throws Exception {
              //if either the source or the destination protocols are local, useTemp is false, i.e. we do not use a temp file
              //boolean useTemp = CopierFactory.copiers.local.name().equals(destination.getImplementation().getProtocolName())?false:CopierFactory.copiers.local.name().equals(this.getProtocolName())?false:true;
      
              if (!CopierFactory.copiers.local.name().equals(destination.getImplementation().getProtocolName())) {

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

          public static void setCredentials(ICopier copier, String host, String portString, String username, String password,
                                            String privateKeyFile) {

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

            public static void setCredentials(ICopier copier, String host, String portString, String username, String password,
                                              String privateKeyFile) {
                int port = -1;
                if (portString != null && !portString.isEmpty())
                    port = Integer.parseInt(portString);

        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 copyAll has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static void copyAll(InputStream in, OutputStream out, boolean closeInput, boolean closeOutput) throws IOException {
                try {
                    if (in.available() > 2147483645) {
                        IOUtils.copyLarge(in, out);
                    } else {
        Severity: Minor
        Found in cs-rft/src/main/java/io/cloudslang/content/rft/remote_copy/IOUtil.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

        Method connect has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public void connect(String username, String password, String host, int port, int connectionTimeout, int executionTimeout)

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

              protected void establishPrivateKeyFile(KeyFile keyFile, JSch jsch, Session session, boolean usesSrcPrivateKeyFile) throws JSchException {
                  if (keyFile == null) {
                      if (usesSrcPrivateKeyFile){
                          session.setPassword(remoteSecureCopyInputs.getSrcPassword());
                      }
          Severity: Minor
          Found in cs-rft/src/main/java/io/cloudslang/content/rft/services/SCPCopier.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

          Method verifyStorageInputs has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static List<String> verifyStorageInputs(@Nullable final String accountName, @Nullable final String key, @Nullable final String containerName, @Nullable final String proxyPort, @Nullable final String blobName, @Nullable final String timeout) {

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

                @Action(name = INSTANCE_ACTION_OPERATION_NAME,
                        description = INSTANCE_ACTION_OPERATION_DESC,
                        outputs = {
                                @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC),
                                @Output(value = EXCEPTION, description = EXCEPTION_DESC),

            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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                @Action(name = LIST_INSTANCES_OPERATION_NAME,
                        description = LIST_INSTANCES_OPERATION_DESC,
                        outputs = {
                                @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC),
                                @Output(value = EXCEPTION, description = EXCEPTION_DESC),

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

                public static void setConnectionParameters(HttpClientInputs httpClientInputs,
                                                           @NotNull final String connectTimeout,
                                                           @NotNull final String socketTimeout,
                                                           @NotNull final String keepAlive,
                                                           @NotNull final String connectionsMaxPerRoot,

              Method getQueryParams has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static String getQueryParams(@NotNull final String availabilityDomain, @NotNull final String compartmentId, @NotNull final String instanceId, @NotNull final String page, @NotNull final String limit, @NotNull final String vnicId) {

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

                    public static CookieStore buildCookieStore(SerializableSessionObject cookieStoreSessionObject, String useCookies) {
                        if (Boolean.parseBoolean(useCookies) && cookieStoreSessionObject != null) {
                            BasicCookieStore cookieStore;
                            if (cookieStoreSessionObject.getValue() == null) {
                                cookieStore = new BasicCookieStore();

                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

                Severity
                Category
                Status
                Source
                Language