localstack/localstack

View on GitHub
localstack-core/localstack/utils/http.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function download has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def download(
    url: str,
    path: str,
    verify_ssl: bool = True,
    timeout: float = None,
Severity: Minor
Found in localstack-core/localstack/utils/http.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 __getattr__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __getattr__(self, name):
        method = requests.__dict__.get(name.lower())
        if not method:
            return method

Severity: Minor
Found in localstack-core/localstack/utils/http.py - About 55 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 download has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def download(
Severity: Minor
Found in localstack-core/localstack/utils/http.py - About 35 mins to fix

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

    def download_github_artifact(url: str, target_file: str, timeout: int = None):
        """Download file from main URL or fallback URL (to avoid firewall errors if github.com is blocked).
        Optionally allows to define a timeout in seconds."""
    
        def do_download(
    Severity: Minor
    Found in localstack-core/localstack/utils/http.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 parse_request_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_request_data(method: str, path: str, data=None, headers=None) -> Dict:
        """Extract request data either from query string as well as request body (e.g., for POST)."""
        result = {}
        headers = headers or {}
        content_type = headers.get("Content-Type", "")
    Severity: Minor
    Found in localstack-core/localstack/utils/http.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