scottwernervt/cloudstorage

View on GitHub
src/cloudstorage/helpers.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function parse_content_disposition has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def parse_content_disposition(data: str) -> Tuple[Optional[str], Dict]:
    """Parse Content-Disposition header.

    Example: ::

Severity: Minor
Found in src/cloudstorage/helpers.py - About 4 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 file_checksum has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def file_checksum(
    filename: FileLike, hash_type: str = "md5", block_size: int = 4096
) -> HASH:
    """Returns checksum for file.

Severity: Minor
Found in src/cloudstorage/helpers.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 file_content_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def file_content_type(filename: FileLike) -> Optional[str]:
    """Guess content type for file path or file like object.

    :param filename: File path or file like object.
    :type filename: str or file
Severity: Minor
Found in src/cloudstorage/helpers.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 validate_file_or_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def validate_file_or_path(filename: FileLike) -> Optional[str]:
    """Return filename from file path or from file like object.

    Source: `rackspace/pyrax/object_storage.py <https://github.com/pycontribs/
    pyrax/blob/master/pyrax/object_storage.py>`_
Severity: Minor
Found in src/cloudstorage/helpers.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