webcomics/dosage

View on GitHub

Showing 83 of 197 total issues

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

    def fileout(self, filename, encoding=None):
        """Write content to given filename. Checks for zero-sized files.
        If encoding is given writes to a codec.open() file."""
        def getfp(filename, encoding):
            """Get open file object."""
Severity: Minor
Found in dosagelib/comic.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

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

def display_comic_help(scraperobj):
    """Print help for a comic."""
    orig_context = out.context
    out.context = scraperobj.name
    try:
Severity: Minor
Found in dosagelib/cmd.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

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

    def starter(self):
        # Retrieve archive links and select valid range
        archivePage = self.getPage(self.url)
        archiveStrips = self.match(archivePage, '//div[@id="archivepage"]//a')
        valid = False
Severity: Minor
Found in dosagelib/plugins/c.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

Severity
Category
Status
Source
Language