webcomics/dosage

View on GitHub

Showing 83 of 197 total issues

File p.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: © 2004 Tristan Seligmann and Jonathan Jacobs
# SPDX-FileCopyrightText: © 2012 Bastian Kleineidam
# SPDX-FileCopyrightText: © 2015 Tobias Gruetzmacher
# SPDX-FileCopyrightText: © 2019 Daniel Ring
Severity: Minor
Found in dosagelib/plugins/p.py - About 2 hrs to fix

    Function namer has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def namer(self, imageUrl, pageUrl):
            # Strip date from filenames
            filename = imageUrl.rsplit('/', 1)[-1]
            if 'ultrarosa' not in pageUrl:
                if filename[4] == '-' and filename[7] == '-':
    Severity: Minor
    Found in dosagelib/plugins/kemonocafe.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_download_dir has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_download_dir(self, basepath: str) -> str:
            """Try to find the corect download directory, ignoring case
            differences."""
            path = basepath
            for part in self.name.split('/'):
    Severity: Minor
    Found in dosagelib/scraper.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 getStrips has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def getStrips(self, maxstrips=None):
            """Get comic strips."""
            if maxstrips:
                word = u"strip" if maxstrips == 1 else "strips"
                msg = u'Retrieving %d %s' % (maxstrips, word)
    Severity: Minor
    Found in dosagelib/scraper.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 __init__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, flavor_id="", exit_code=-1):
            """Create an exclusive lockfile or exit with an error and the given
            exit code."""
            self.initialized = False
            scriptname = os.path.splitext(os.path.realpath(sys.argv[0]))[0]
    Severity: Minor
    Found in dosagelib/singleton.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 fetchUrls has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def fetchUrls(self, url, data, urlSearch):
            """Search all entries for given XPath in a HTML page."""
            searchUrls = []
            for match, search in self._matchPattern(data, urlSearch):
                searchUrl = None
    Severity: Minor
    Found in dosagelib/scraper.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 __init__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, stream=None):
            """Initialize context and indentation."""
            self.context = None
            self.level = 0
            self.timestamps = False
    Severity: Minor
    Found in dosagelib/output.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 saveComicStrip has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def saveComicStrip(self, strip):
            """Save a comic strip which can consist of multiple images."""
            allskipped = True
            for image in strip.getImages():
                try:
    Severity: Minor
    Found in dosagelib/director.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 setup_options has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def setup_options() -> ArgumentParser:
        """Construct option parser.
        @return: new option parser
        @rtype argparse.ArgumentParser
        """
    Severity: Minor
    Found in dosagelib/cmd.py - About 1 hr to fix

      Function display_version has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def display_version(verbose):
          """Display application name, version, copyright and license."""
          print(configuration.App)
          print("Using Python {} ({}) on {}".format(platform.python_version(),
              platform.python_implementation(), platform.platform()))
      Severity: Minor
      Found in dosagelib/cmd.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 fetchUrls has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def fetchUrls(self, url, data, urlSearch):
              """Search all entries for given URL pattern(s) in a HTML page."""
              searchUrls = []
              searches = makeSequence(urlSearch)
              for search in searches:
      Severity: Minor
      Found in dosagelib/scraper.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 language has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def language(self):
              """
              Return language of the comic as a human-readable language name instead
              of a 2-character ISO639-1 code.
              """
      Severity: Minor
      Found in dosagelib/scraper.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 getComics has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def getComics(options):
          """Retrieve comics."""
          threads = []
          jobs = ComicQueue()
      
      
      Severity: Minor
      Found in dosagelib/director.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 get_tagged_scraper_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_tagged_scraper_name(scraperobj, limit=None, reasons=None):
          """Get comic scraper name."""
          tags = []
          if scraperobj.adult:
              tags.append(TAG_ADULT)
      Severity: Minor
      Found in dosagelib/cmd.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 find has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def find(self, comic: str) -> Scraper:
              """Find a comic scraper object based on its name. This prefers a
              perfect match, but falls back to a substring match, if that is unique.
              Otharwise a ValueError is thrown.
              """
      Severity: Minor
      Found in dosagelib/scraper.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 __del__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def __del__(self):
              """Remove the lock file."""
              if not self.initialized:
                  return
              try:
      Severity: Minor
      Found in dosagelib/singleton.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, name, sub, lang=None, adult=False, endOfLife=False, segmented=False):
      Severity: Minor
      Found in dosagelib/plugins/comicfury.py - About 45 mins to fix

        Function get_module_plugins has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_module_plugins(module, classobj):
            """Return all subclasses of a class in the module.
            If the module defines __all__, only those entries will be searched,
            otherwise all objects not starting with '_' will be searched.
            """
        Severity: Minor
        Found in dosagelib/loader.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def run(options):
            """Execute comic commands."""
            set_output_info(options)
            scrapercache.adddir(user_plugin_path)
            # ensure only one instance of dosage is running
        Severity: Minor
        Found in dosagelib/cmd.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 fetchText has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def fetchText(self, url, data, textSearch, optional):
                """Search text entry for given text XPath in a HTML page."""
                if not textSearch:
                    return None
                text = []
        Severity: Minor
        Found in dosagelib/scraper.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

        Severity
        Category
        Status
        Source
        Language