localstack/localstack

View on GitHub
localstack-core/localstack/services/sqs/models.py

Summary

Maintainability
F
3 days
Test Coverage

File models.py has 999 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import hashlib
import heapq
import inspect
import json
import logging
Severity: Major
Found in localstack-core/localstack/services/sqs/models.py - About 2 days to fix

    Function get_queue_attributes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_queue_attributes(self, attribute_names: AttributeNameList = None) -> dict[str, str]:
            if not attribute_names:
                return {}
    
            if QueueAttributeName.All in attribute_names:
    Severity: Minor
    Found in localstack-core/localstack/services/sqs/models.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, name: str, region: str, account_id: str, attributes=None, tags=None) -> None:
    Severity: Minor
    Found in localstack-core/localstack/services/sqs/models.py - About 45 mins to fix

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

          def put(
      Severity: Minor
      Found in localstack-core/localstack/services/sqs/models.py - About 45 mins to fix

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

            def put(
        Severity: Minor
        Found in localstack-core/localstack/services/sqs/models.py - About 45 mins to fix

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

              def __init__(self, name: str, region: str, account_id: str, attributes=None, tags=None) -> None:
          Severity: Minor
          Found in localstack-core/localstack/services/sqs/models.py - About 45 mins to fix

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

                def put(
            Severity: Minor
            Found in localstack-core/localstack/services/sqs/models.py - About 45 mins to fix

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

                  def __init__(
              Severity: Minor
              Found in localstack-core/localstack/services/sqs/models.py - About 35 mins to fix

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

                    def __init__(self, name: str, region: str, account_id: str, attributes=None, tags=None) -> None:
                Severity: Minor
                Found in localstack-core/localstack/services/sqs/models.py - About 35 mins to fix

                  Function url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def url(self, context: RequestContext) -> str:
                          """Return queue URL which depending on the endpoint strategy returns e.g.:
                          * (standard) http://sqs.eu-west-1.localhost.localstack.cloud:4566/000000000000/myqueue
                          * (domain) http://eu-west-1.queue.localhost.localstack.cloud:4566/000000000000/myqueue
                          * (path) http://localhost.localstack.cloud:4566/queue/eu-central-1/000000000000/myqueue
                  Severity: Minor
                  Found in localstack-core/localstack/services/sqs/models.py - About 35 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

                  There are no issues that match your filters.

                  Category
                  Status