SylvainDe/ComicBookMaker

View on GitHub
comic_abstract.py

Summary

Maintainability
D
1 day
Test Coverage

File comic_abstract.py has 354 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/bin/python3
# vim: set expandtab tabstop=4 shiftwidth=4 :
"""Module to define logic common to all comics."""

import json
Severity: Minor
Found in comic_abstract.py - About 4 hrs to fix

    Function check_everything_is_ok has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_everything_is_ok(cls):
            """Perform tests on the database to check that everything is ok."""
            cls.log("start")
            print(cls.name, ": about to check")
            comics = cls.get_comics()  # cls._load_db()
    Severity: Minor
    Found in comic_abstract.py - About 3 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

    GenericComic has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class GenericComic(object):
        """Generic class to handle the logic common to all comics
    
        Attributes :
            name        Name of the comic (for logging, CLI and default output dir)
    Severity: Minor
    Found in comic_abstract.py - About 2 hrs to fix

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

          def try_to_get_missing_resources(cls):
              """Download images that might not have been downloaded properly in
              the first place."""
              cls.log("start")
              print(cls.name, ": about to try to get missing resources")
      Severity: Minor
      Found in comic_abstract.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def update(cls, saving_freq=100):
              """Update the database : get the latest comics and save in the DB.
      
              This is a wrapper around get_next_comic() providing the following
              generic features :
      Severity: Minor
      Found in comic_abstract.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