localstack/localstack

View on GitHub
localstack-core/localstack/services/cloudformation/provider.py

Summary

Maintainability
F
4 days
Test Coverage

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

import copy
import json
import logging
import re
from collections import defaultdict
Severity: Major
Found in localstack-core/localstack/services/cloudformation/provider.py - About 2 days to fix

    Function create_change_set has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_change_set(
            self, context: RequestContext, request: CreateChangeSetInput
        ) -> CreateChangeSetOutput:
            state = get_cloudformation_store(context.account_id, context.region)
    
    
    Severity: Minor
    Found in localstack-core/localstack/services/cloudformation/provider.py - About 2 hrs 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 create_stack has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def create_stack(self, context: RequestContext, request: CreateStackInput) -> CreateStackOutput:
            # TODO: test what happens when both TemplateUrl and Body are specified
            state = get_cloudformation_store(context.account_id, context.region)
    
            stack_name = request.get("StackName")
    Severity: Minor
    Found in localstack-core/localstack/services/cloudformation/provider.py - About 1 hr to fix

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

          def execute_change_set(
      Severity: Major
      Found in localstack-core/localstack/services/cloudformation/provider.py - About 1 hr to fix

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

            def create_stack(self, context: RequestContext, request: CreateStackInput) -> CreateStackOutput:
                # TODO: test what happens when both TemplateUrl and Body are specified
                state = get_cloudformation_store(context.account_id, context.region)
        
                stack_name = request.get("StackName")
        Severity: Minor
        Found in localstack-core/localstack/services/cloudformation/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 describe_stacks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def describe_stacks(
                self,
                context: RequestContext,
                stack_name: StackName = None,
                next_token: NextToken = None,
        Severity: Minor
        Found in localstack-core/localstack/services/cloudformation/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_stack has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_stack(
                self,
                context: RequestContext,
                request: UpdateStackInput,
            ) -> UpdateStackOutput:
        Severity: Minor
        Found in localstack-core/localstack/services/cloudformation/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 delete_stack has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def delete_stack(
        Severity: Major
        Found in localstack-core/localstack/services/cloudformation/provider.py - About 50 mins to fix

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

              def describe_change_set(
          Severity: Major
          Found in localstack-core/localstack/services/cloudformation/provider.py - About 50 mins to fix

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

                def get_template(
                    self,
                    context: RequestContext,
                    stack_name: StackName = None,
                    change_set_name: ChangeSetNameOrId = None,
            Severity: Minor
            Found in localstack-core/localstack/services/cloudformation/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 describe_stack_set_operation has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def describe_stack_set_operation(
            Severity: Minor
            Found in localstack-core/localstack/services/cloudformation/provider.py - About 45 mins to fix

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

                  def describe_stack_resources(
              Severity: Minor
              Found in localstack-core/localstack/services/cloudformation/provider.py - About 45 mins to fix

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

                    def describe_stack_resource(
                Severity: Minor
                Found in localstack-core/localstack/services/cloudformation/provider.py - About 35 mins to fix

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

                      def describe_stack_events(
                  Severity: Minor
                  Found in localstack-core/localstack/services/cloudformation/provider.py - About 35 mins to fix

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

                        def delete_change_set(
                    Severity: Minor
                    Found in localstack-core/localstack/services/cloudformation/provider.py - About 35 mins to fix

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

                          def list_stack_resources(
                      Severity: Minor
                      Found in localstack-core/localstack/services/cloudformation/provider.py - About 35 mins to fix

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

                            def delete_stack_set(
                        Severity: Minor
                        Found in localstack-core/localstack/services/cloudformation/provider.py - About 35 mins to fix

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

                              def get_template(
                          Severity: Minor
                          Found in localstack-core/localstack/services/cloudformation/provider.py - About 35 mins to fix

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

                                def list_change_sets(
                            Severity: Minor
                            Found in localstack-core/localstack/services/cloudformation/provider.py - About 35 mins to fix

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

                                  def list_imports(
                              Severity: Minor
                              Found in localstack-core/localstack/services/cloudformation/provider.py - About 35 mins to fix

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

                                    def describe_stack_set(
                                Severity: Minor
                                Found in localstack-core/localstack/services/cloudformation/provider.py - About 35 mins to fix

                                  There are no issues that match your filters.

                                  Category
                                  Status