CloudSlang/cs-actions

View on GitHub

Showing 3,993 of 4,022 total issues

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

    public static void removeSftpSession(GlobalSessionObject<Map<String, SFTPConnection>> sessionParam, String sessionId) {
        if (sessionParam != null) {
            SessionResource<Map<String, SFTPConnection>> resource = sessionParam.getResource();
            if (resource != null) {
                Map<String, SFTPConnection> tempMap = resource.get();
Severity: Minor
Found in cs-rft/src/main/java/io/cloudslang/content/rft/utils/CacheUtils.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

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

    @NotNull
    public static String updateVMBody(NutanixUpdateVMInputs nutanixUpdateVMInputs, String delimiter)
            throws JsonProcessingException {
        String requestBody = EMPTY;
        final List<String> hostUUIDsList = new ArrayList<>();

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

    public static KeyFile getKeyFile(String privateKeyFile, String privateKeyPassPhrase) {
        KeyFile keyFile = null;
        if (privateKeyFile != null && !privateKeyFile.isEmpty()) {
            if (privateKeyPassPhrase != null && !privateKeyPassPhrase.isEmpty()) {
                keyFile = new KeyFile(privateKeyFile, privateKeyPassPhrase);

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

    private static Channel getSftpChannel(SessionResource<Map<String, SFTPConnection>> resource, String sessionId) {
        if (resource != null) {
            Object obj = resource.get();
            if (obj != null) {
                SFTPConnection connection = (SFTPConnection) ((Map) obj).get(sessionId);
Severity: Minor
Found in cs-rft/src/main/java/io/cloudslang/content/rft/utils/CacheUtils.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

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

    @NotNull
    public static Map<String, String> getTaskFailureResults(@NotNull String inputName, @NotNull Integer statusCode,
                                                            @NotNull String taskStatus, @NotNull String returnMessage,
                                                            @NotNull String throwable) {
        Map<String, String> results = new HashMap();

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

    private static Session getSftpSession(SessionResource<Map<String, SFTPConnection>> resource, String sessionId) {
        if (resource != null) {
            Object obj = resource.get();
            if (obj != null) {
                SFTPConnection connection = (SFTPConnection) ((Map) obj).get(sessionId);
Severity: Minor
Found in cs-rft/src/main/java/io/cloudslang/content/rft/utils/CacheUtils.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

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

    private String getResourceId(String response, String resourceResponseAction, String resourceIdXpath, String resourceIdExceptionMessage) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException {
        if (WSManUtils.isSpecificResponseAction(response, resourceResponseAction)) {
            String shellId = XMLUtils.parseXml(response, resourceIdXpath);
            if (StringUtils.isNotBlank(shellId)) {
                return shellId;

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

    public static boolean setCharacterSet(ICopier copier, String characterSetName) {
        if (copiers.valueOf(copier.getProtocolName()) == copiers.sftp) {
            if (!StringUtils.isNull(characterSetName)) {
                if (!Charset.isSupported(characterSetName)) {
                    return false;

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

    private int checkAck(InputStream in) throws IOException {
        int b = in.read();
        // b may be 0 for success,
        //          1 for error,
        //          2 for fatal error,
Severity: Minor
Found in cs-rft/src/main/java/io/cloudslang/content/rft/services/SCPCopier.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

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

    @NotNull
    public static String getQueryParams(@NotNull final String topQuery,
                                        @NotNull final String selectQuery,
                                        @NotNull String oDataQuery) {
        final StringBuilder oDataQueryParam = new StringBuilder()

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

    @NotNull
    public static Map<String, String> getOperationResults(@NotNull final Map<String, String> result,
                                                          final String successMessage,
                                                          final String failureMessage) {
        final Map<String, String> results;

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

    public static <T> T runWithTimeout(Callable<T> callable, long timeout, TimeUnit timeUnit) throws Exception {
        final ExecutorService executor = Executors.newSingleThreadExecutor();
        final Future<T> future = executor.submit(callable);
        executor.shutdown(); // This does not cancel the already-scheduled task.
        try {

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

        public Map<String, String> signRequest(URI uri, String method, String requestBody) {
            Map<String, String> myheaders = new HashMap<>();
            Map<String, String> headers = new HashMap<>();
            String date = DATE_FORMAT.format(new Date());
            headers.put(DATE, date);

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

    @NotNull
    public static Map<String, String> getOperationResults(@NotNull final Map<String, String> result,
                                                          final String successMessage,
                                                          final String failureMessage) {
        final Map<String, String> results;

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

    private static String updateInstanceRequestBody(@NotNull final OCIUpdateInstanceInputs ociUpdateInstanceInputs) {
        String requestBody = EMPTY;
        ObjectMapper updateInstanceMapper = new ObjectMapper();
        UpdateInstanceRequestBody updateInstanceRequestBody = new UpdateInstanceRequestBody();
        UpdateInstanceRequestBody.AgentConfig agentConfig = updateInstanceRequestBody.new AgentConfig();

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

    @NotNull
    public static String getDnsNameFromArrayNode(@NotNull final JsonNode node) {
        if (node.isArray()) {
            for (final JsonNode attribute : node) {
                if (attribute.get(NAME).asText().equalsIgnoreCase(DNS_NAME)) {

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

    @NotNull
    public static String getValueFromDataArray(@NotNull final JsonNode dataArray, @NotNull final String keyName) {
        if (dataArray.isArray()) {
            for (final JsonNode nodeElement : dataArray) {
                if (nodeElement.get(KEY).asText(EMPTY).equalsIgnoreCase(keyName)) {

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

    @Action(name = "Get Value from Object",
            outputs = {
                    @Output(OutputNames.RETURN_RESULT),
                    @Output(OutputNames.RETURN_CODE),
                    @Output(OutputNames.EXCEPTION)

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

    @Action(name = NAME,
            outputs = {
                    @Output(value = RETURN_RESULT, description = RETURN_RESULT_DESC),
                    @Output(value = RETURN_CODE, description = RETURN_CODE_DESC),
                    @Output(value = ENTITY_ID, description = ENTITY_ID_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 build has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public @NotNull MergeArraysInput build() throws Exception {
            MergeArraysInput input = new MergeArraysInput();

            if (StringUtils.isNotBlank(this.array1)) {
                try {

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