File config.py
has 978 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import os
import platform
import socket
import subprocess
Function in_docker
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def in_docker():
"""
Returns True if running in a docker container, else False
Ref. https://docs.docker.com/config/containers/runmetrics/#control-groups
"""
- 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 __init__
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function append
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def append(self, value: HostAndPort):
# no exact duplicates
if value in self:
return
- 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 parse
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse(
cls,
input: str,
default_host: str,
default_port: int,
- 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 load_environment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_environment(profiles: str = None, env=os.environ) -> List[str]:
"""Loads the environment variables from ~/.localstack/{profile}.env, for each profile listed in the profiles.
:param env: environment to load profile to. Defaults to `os.environ`
:param profiles: a comma separated list of profiles to load (defaults to "default")
:returns str: the list of the actually loaded profiles (might be the fallback)
- 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 mkdirs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def mkdirs(self):
for folder in [
self.static_libs,
self.var_libs,
self.cache,
- 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
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return True
Function populate_edge_configuration
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def populate_edge_configuration(
environment: Mapping[str, str],
) -> Tuple[HostAndPort, UniqueHostAndPortList]:
"""Populate the LocalStack edge configuration from environment variables."""
localstack_host_raw = environment.get("LOCALSTACK_HOST")
- 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"