localstack/localstack

View on GitHub
localstack/cli/localstack.py

Summary

Maintainability
D
2 days
Test Coverage

File localstack.py has 709 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json
import logging
import os
import sys
import traceback
Severity: Major
Found in localstack/cli/localstack.py - About 1 day to fix

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

        def invoke(self, ctx: click.Context):
            try:
                return super(LocalStackCliGroup, self).invoke(ctx)
            except click.exceptions.Exit:
                # raise Exit exceptions unmodified (e.g., raised on --help)
    Severity: Minor
    Found in localstack/cli/localstack.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 format_commands has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def format_commands(self, ctx: click.Context, formatter: click.HelpFormatter) -> None:
            """Extra format methods for multi methods that adds all the commands after the options. It also
            groups commands into command categories."""
            categories = {"Commands": [], "Advanced": [], "Deprecated": []}
    
    
    Severity: Minor
    Found in localstack/cli/localstack.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 cmd_start has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def cmd_start(
    Severity: Major
    Found in localstack/cli/localstack.py - About 1 hr to fix

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

      def _print_docker_status(format_: str) -> None:
          from localstack.utils import docker_utils
          from localstack.utils.bootstrap import get_docker_image_details, get_server_version
          from localstack.utils.container_networking import get_main_container_ip, get_main_container_name
      
      
      Severity: Minor
      Found in localstack/cli/localstack.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

      Function cmd_config_show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def cmd_config_show(format_: str) -> None:
          """
          Print the current LocalStack config values.
      
          This command prints the LocalStack configuration values from your environment.
      Severity: Minor
      Found in localstack/cli/localstack.py - About 25 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