localstack/localstack

View on GitHub
localstack/services/stepfunctions/provider.py

Summary

Maintainability
F
4 days
Test Coverage

File provider.py has 816 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import copy
import datetime
import json
import logging
import re
Severity: Major
Found in localstack/services/stepfunctions/provider.py - About 1 day to fix

    StepFunctionsProvider has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class StepFunctionsProvider(StepfunctionsApi, ServiceLifecycleHook):
        _TEST_STATE_MAX_TIMEOUT_SECONDS: Final[int] = 300  # 5 minutes.
    
        @staticmethod
        def get_store(context: RequestContext) -> SFNStore:
    Severity: Minor
    Found in localstack/services/stepfunctions/provider.py - About 3 hrs to fix

      Function update_state_machine has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def update_state_machine(
      Severity: Major
      Found in localstack/services/stepfunctions/provider.py - About 1 hr to fix

        Function update_state_machine has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_state_machine(
                self,
                context: RequestContext,
                state_machine_arn: Arn,
                definition: Definition = None,
        Severity: Minor
        Found in localstack/services/stepfunctions/provider.py - 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

        Function list_executions has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def list_executions(
        Severity: Major
        Found in localstack/services/stepfunctions/provider.py - About 1 hr to fix

          Function test_state has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def test_state(
          Severity: Major
          Found in localstack/services/stepfunctions/provider.py - About 1 hr to fix

            Function create_state_machine has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def create_state_machine(
                    self, context: RequestContext, request: CreateStateMachineInput, **kwargs
                ) -> CreateStateMachineOutput:
                    if not request.get("publish", False) and request.get("versionDescription"):
                        raise ValidationException("Version description can only be set when publish is true")
            Severity: Minor
            Found in localstack/services/stepfunctions/provider.py - About 55 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

            Function send_task_failure has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def send_task_failure(
                    self,
                    context: RequestContext,
                    task_token: TaskToken,
                    error: SensitiveError = None,
            Severity: Minor
            Found in localstack/services/stepfunctions/provider.py - About 55 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

            Function send_task_heartbeat has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def send_task_heartbeat(
                    self, context: RequestContext, task_token: TaskToken, **kwargs
                ) -> SendTaskHeartbeatOutput:
                    running_executions: list[Execution] = self._get_executions(context, ExecutionStatus.RUNNING)
                    for execution in running_executions:
            Severity: Minor
            Found in localstack/services/stepfunctions/provider.py - About 55 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

            Function send_task_success has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def send_task_success(
                    self, context: RequestContext, task_token: TaskToken, output: SensitiveData, **kwargs
                ) -> SendTaskSuccessOutput:
                    outcome = CallbackOutcomeSuccess(callback_id=task_token, output=output)
                    running_executions: list[Execution] = self._get_executions(context, ExecutionStatus.RUNNING)
            Severity: Minor
            Found in localstack/services/stepfunctions/provider.py - About 55 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

            Function update_map_run has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def update_map_run(
            Severity: Major
            Found in localstack/services/stepfunctions/provider.py - About 50 mins to fix

              Function get_execution_history has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def get_execution_history(
              Severity: Major
              Found in localstack/services/stepfunctions/provider.py - About 50 mins to fix

                Function start_execution has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def start_execution(
                Severity: Minor
                Found in localstack/services/stepfunctions/provider.py - About 45 mins to fix

                  Function start_execution has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def start_execution(
                          self,
                          context: RequestContext,
                          state_machine_arn: Arn,
                          name: Name = None,
                  Severity: Minor
                  Found in localstack/services/stepfunctions/provider.py - 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

                  Function list_map_runs has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def list_map_runs(
                  Severity: Minor
                  Found in localstack/services/stepfunctions/provider.py - About 45 mins to fix

                    Function list_state_machine_versions has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def list_state_machine_versions(
                    Severity: Minor
                    Found in localstack/services/stepfunctions/provider.py - About 35 mins to fix

                      Function publish_state_machine_version has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def publish_state_machine_version(
                      Severity: Minor
                      Found in localstack/services/stepfunctions/provider.py - About 35 mins to fix

                        Function tag_resource has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def tag_resource(
                        Severity: Minor
                        Found in localstack/services/stepfunctions/provider.py - About 35 mins to fix

                          Function get_activity_task has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def get_activity_task(
                          Severity: Minor
                          Found in localstack/services/stepfunctions/provider.py - About 35 mins to fix

                            Function send_task_failure has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def send_task_failure(
                            Severity: Minor
                            Found in localstack/services/stepfunctions/provider.py - About 35 mins to fix

                              Function stop_execution has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def stop_execution(
                              Severity: Minor
                              Found in localstack/services/stepfunctions/provider.py - About 35 mins to fix

                                Function list_activities has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def list_activities(
                                Severity: Minor
                                Found in localstack/services/stepfunctions/provider.py - About 35 mins to fix

                                  Function untag_resource has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      def untag_resource(
                                  Severity: Minor
                                  Found in localstack/services/stepfunctions/provider.py - About 35 mins to fix

                                    Function create_activity has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        def create_activity(
                                    Severity: Minor
                                    Found in localstack/services/stepfunctions/provider.py - About 35 mins to fix

                                      There are no issues that match your filters.

                                      Category
                                      Status