localstack/localstack

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

Summary

Maintainability
F
1 wk
Test Coverage

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

import copy
import json
import logging
import os
import random
Severity: Major
Found in localstack/services/dynamodb/provider.py - About 4 days to fix

    Function update_table has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_table(
            self, context: RequestContext, update_table_input: UpdateTableInput
        ) -> UpdateTableOutput:
            table_name = update_table_input["TableName"]
            global_table_region = self.get_global_table_region(context, table_name)
    Severity: Minor
    Found in localstack/services/dynamodb/provider.py - About 3 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 delete_expired_items has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def delete_expired_items() -> int:
        """
        This utility function iterates over all stores, looks for tables with TTL enabled,
        scan such tables and delete expired items.
        """
    Severity: Minor
    Found in localstack/services/dynamodb/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 describe_table has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def describe_table(
            self, context: RequestContext, table_name: TableName, **kwargs
        ) -> DescribeTableOutput:
            global_table_region = self.get_global_table_region(context, table_name)
    
    
    Severity: Minor
    Found in localstack/services/dynamodb/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 create_table has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_table(
            self,
            context: RequestContext,
            create_table_input: CreateTableInput,
        ) -> CreateTableOutput:
    Severity: Minor
    Found in localstack/services/dynamodb/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 prepare_transact_write_item_records has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        def batch_get_item(
                    Severity: Minor
                    Found in localstack/services/dynamodb/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/dynamodb/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/dynamodb/provider.py - About 35 mins to fix

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

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

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

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

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

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

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

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

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

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

                                    There are no issues that match your filters.

                                    Category
                                    Status