fabiocaccamo/python-imageutil

View on GitHub

Showing 3 of 3 total issues

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

def get_image(src: ImageIn, copy: bool = True) -> ImageOut:
    """
    Gets the image.

    :param src: The source for an image object.
Severity: Minor
Found in imageutil/args.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 get_color has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def get_color(value: ColorIn | None = None, opacity: float | None = None) -> ColorOut:
    """
    Gets the color.

    :param color: The color
Severity: Minor
Found in imageutil/args.py - About 45 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 get_anchor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_anchor(name: AnchorIn) -> AnchorOut:
    """
    Gets the anchor converting anchor position name string
    to a tuple (x, y) where each value is a float between 0.0 and 1.0.

Severity: Minor
Found in imageutil/args.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

Severity
Category
Status
Source
Language