eggplants/getjump

View on GitHub
getjump/getjump.py

Summary

Maintainability
B
4 hrs
Test Coverage
C
74%

Function get has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def get(  # noqa: PLR0913
        self,
        url: str,
        save_path: str | Path = ".",
        *,
Severity: Minor
Found in getjump/getjump.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 has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def get(  # noqa: PLR0913
Severity: Major
Found in getjump/getjump.py - About 1 hr to fix

    Function login has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def login(
    Severity: Minor
    Found in getjump/getjump.py - About 35 mins to fix

      Function __save_images has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __save_images(
      Severity: Minor
      Found in getjump/getjump.py - About 35 mins to fix

        Function __get_image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def __get_image(self, image_src: str, div: int = 4, mul: int = 8) -> Image.Image:
                img = Image.open(BytesIO(requests.get(image_src, timeout=10).content))
                img_width, img_height = img.size
                fixed_width = int(float(img_width) / (div * mul)) * mul
                fixed_height = int(float(img_height) / (div * mul)) * mul
        Severity: Minor
        Found in getjump/getjump.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