File bootstrap.py
has 1011 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import annotations
import copy
import functools
import logging
Function port_cli_params
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def port_cli_params(params: Iterable[str] = None):
"""
Configures port variables from additional CLI input through the ``-p`` options.
:param params: a list of port assignments, e.g.,: ``("4000-5000", "8080:80")``
- Read upRead up
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 validate_localstack_config
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def validate_localstack_config(name: str):
# TODO: separate functionality from CLI output
# (use exceptions to communicate errors, and return list of warnings)
from subprocess import CalledProcessError
- Read upRead up
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
ContainerConfigurators
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class ContainerConfigurators:
"""
A set of useful container configurators that are typical for starting the localstack container.
"""
Function gateway_listen
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def gateway_listen(
port: Union[int, Iterable[int], HostAndPort, Iterable[HostAndPort]],
):
"""
Uses the given ports to configure GATEWAY_LISTEN. For instance, ``gateway_listen([4566, 443])`` would
- Read upRead up
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 validate_localstack_config
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_localstack_config(name: str):
# TODO: separate functionality from CLI output
# (use exceptions to communicate errors, and return list of warnings)
from subprocess import CalledProcessError
Function wait_container_is_ready
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def wait_container_is_ready(timeout: Optional[float] = None):
"""Blocks until the localstack main container is running and the ready marker has been printed."""
container_name = config.MAIN_CONTAINER_NAME
started = time.time()
- Read upRead up
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 env_cli_params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def env_cli_params(params: Iterable[str] = None):
"""
Configures environment variables from additional CLI input through the ``-e`` options.
:param params: a list of environment variable declarations, e.g.,: ``("foo=bar", "baz=ed")``
- Read upRead up
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 shutdown
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def shutdown(self, timeout: int = 10, remove: bool = True):
with self._mutex:
if self._shutdown:
return
self._shutdown = True
- Read upRead up
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 resolve_apis
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def resolve_apis(services: Iterable[str]) -> Set[str]:
"""
Resolves recursively for the given collection of services (e.g., ["serverless", "cognito"]) the list of actual
API services that need to be included (e.g., {'dynamodb', 'cloudformation', 'logs', 'kinesis', 'sts',
'cognito-identity', 's3', 'dynamodbstreams', 'apigateway', 'cloudwatch', 'lambda', 'cognito-idp', 'iam'}).
- Read upRead up
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 start
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def start(self, attach: bool = False) -> RunningContainer:
# FIXME: this is pretty awkward, but additional_flags in the LocalstackContainer API was
# always a list of ["-e FOO=BAR", ...], whereas in the DockerClient it is expected to be
# a string. so we need to re-assemble it here. the better way would be to not use
# additional_flags here all together. it is still used in ext in
- Read upRead up
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"