CloudSlang/score

View on GitHub

Showing 3,943 of 3,943 total issues

Method deleteFinishedSteps has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public void deleteFinishedSteps(Set<Long> stepIds) {
        if (stepIds == null || stepIds.size() == 0) {
            return;
        }

    Method getPythonExecutorStatus has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private PythonExecutorStatus getPythonExecutorStatus() {
            try {
                Pair<Integer, String> response = pythonExecutorCommunicationService.performNoAuthRequest(EXTERNAL_PYTHON_EXECUTOR_HEALTH_PATH, "GET", null);
                if (response.getLeft() == 200) {
                    if (pythonExecutorProcess.get() == null) {

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

        public PythonExecutionResult exec(String script, Map<String, Serializable> callArguments) {
            validateInterpreter();
            Writer errorWriter = new BoundedStringWriter(errorStreamLengthExceededSupplier);
            try {
                pythonInterpreter.setOut(SELECTED_SUPPLIER.get());

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

        @Override
        public boolean equals(Object o) {
            if (this == o)
                return true;
            if (o == null || getClass() != o.getClass())

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

        @SuppressWarnings("unused")
        // Scheduled in scoreWorkerSchedulerContext.xml
        public void interruptCanceledExecutions() {
            try {
                if (!newCancelBehaviour) { // For backward compatibility

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

        private List<Message> expandCompoundMessages(LinkedList<Message> value) {
            int compoundMessages = 0, compoundMessageSize = 0;
            for (Message crt : value) {
                if (crt instanceof CompoundMessage) {
                    compoundMessages++;

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

        public void retry(int maxRetries, long sleepBetweenRetries, RetryCallback callback){
            Validate.notNull(callback, "Callback is null");
    
            boolean infinity = (maxRetries == INFINITELY);
            for (int i=0; infinity || i<maxRetries-1; i++) {

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

        @Override
        public void init() {
            if (logger.isInfoEnabled()) logger.info("Registering Score namespace handler");
            for (Map.Entry<String, String> entry : parsers.entrySet()) {
                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 exec has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public PythonExecutionResult exec(String script, Map<String, Serializable> callArguments) {
            validateInterpreter();
            Writer errorWriter = new BoundedStringWriter(errorStreamLengthExceededSupplier);
            try {
                pythonInterpreter.setOut(SELECTED_SUPPLIER.get());

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

          static public ExecStatus find(int num) {
              ExecStatus result = null;
              switch (num) {
                  case 0:
                      result = RECOVERED;

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

            private Serializable processReturnResult(EvaluationResults results) throws JsonProcessingException {
                EvaluationResults.ReturnType returnType = results.getReturnType();
                if (returnType == null) {
                    throw new RuntimeException("Missing return type for return result.");
                }
        runtime-management/runtime-management-impl/src/main/java/io/cloudslang/runtime/impl/python/external/ExternalPythonExecutorScheduledExecutorTimeout.java on lines 318..334

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

        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

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

            private Serializable processReturnResult(EvaluationResults results) throws JsonProcessingException {
                EvaluationResults.ReturnType returnType = results.getReturnType();
                if (returnType == null) {
                    throw new RuntimeException("Missing return type for return result.");
                }
        runtime-management/runtime-management-impl/src/main/java/io/cloudslang/runtime/impl/python/executor/services/ExternalPythonExecutorServiceImpl.java on lines 134..150

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

        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

        /*
         * Copyright © 2014-2017 EntIT Software LLC, a Micro Focus company (L.P.)
         *
         * Licensed under the Apache License, Version 2.0 (the "License");
         * you may not use this file except in compliance with the License.
        engine/queue/score-queue-api/src/main/java/io/cloudslang/engine/queue/enums/AssignStrategy.java on lines 1..47

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

        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

        /*
         * Copyright © 2014-2017 EntIT Software LLC, a Micro Focus company (L.P.)
         *
         * Licensed under the Apache License, Version 2.0 (the "License");
         * you may not use this file except in compliance with the License.
        runtime-management/runtime-management-api/src/main/java/io/cloudslang/runtime/api/python/enums/PythonStrategy.java on lines 1..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 83.

        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

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

            private String generatePayloadForExec(String userScript, Map<String, Serializable> inputs) throws
                    JsonProcessingException {
                HashMap<String, String> parsedInputs = new HashMap<>();
                for (Entry<String, Serializable> entry : inputs.entrySet()) {
                    parsedInputs.put(entry.getKey(), entry.getValue().toString());
        runtime-management/runtime-management-impl/src/main/java/io/cloudslang/runtime/impl/python/external/ExternalPythonExecutorScheduledExecutorTimeout.java on lines 439..450

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

        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

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

            private String generatePayloadForExec(String userScript, Map<String, Serializable> inputs) throws
                    JsonProcessingException {
                HashMap<String, String> parsedInputs = new HashMap<>();
                for (Entry<String, Serializable> entry : inputs.entrySet()) {
                    parsedInputs.put(entry.getKey(), entry.getValue().toString());
        runtime-management/runtime-management-impl/src/main/java/io/cloudslang/runtime/impl/python/external/ExternalPythonExecutorCompletableFutureTimeout.java on lines 330..341

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

        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

        Method getPythonExecutorStatus has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private PythonExecutorStatus getPythonExecutorStatus() {
                try {
                    Pair<Integer, String> response = pythonExecutorCommunicationService.performNoAuthRequest(EXTERNAL_PYTHON_EXECUTOR_HEALTH_PATH, "GET", null);
                    if (response.getLeft() == 200) {
                        if (pythonExecutorProcess.get() == null) {

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

                  if (nextStepExecution.getPosition() == null) {
                      // Set current step to finished
                      executionMessage.setStatus(ExecStatus.FINISHED);
                      executionMessage.incMsgSeqId();
                      executionMessage.setPayload(null);
          worker/worker-manager/score-worker-manager-impl/src/main/java/io/cloudslang/worker/management/services/SimpleExecutionRunnable.java on lines 321..336
          worker/worker-manager/score-worker-manager-impl/src/main/java/io/cloudslang/worker/management/services/SimpleExecutionRunnable.java on lines 356..371

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

          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

          Method executeControlAction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public Object executeControlAction(ControlActionMetadata actionMetadata, ReadonlyStepActionDataAccessor accessor) {
                  Validate.notNull(actionMetadata, "Action metadata is null");
                  if (logger.isDebugEnabled()) {
                      logger.debug("Executing control action [" + actionMetadata.getClassName() + '.' + actionMetadata.getMethodName() + ']');

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

                    if (executionService.isSplitStep(nextStepExecution)) {
                        // Set current step to finished
                        executionMessage.setStatus(ExecStatus.FINISHED);
                        executionMessage.incMsgSeqId();
                        executionMessage.setPayload(null);
            worker/worker-manager/score-worker-manager-impl/src/main/java/io/cloudslang/worker/management/services/SimpleExecutionRunnable.java on lines 356..371
            worker/worker-manager/score-worker-manager-impl/src/main/java/io/cloudslang/worker/management/services/SimpleExecutionRunnable.java on lines 597..614

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

            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

            Severity
            Category
            Status
            Source
            Language