webcomics/dosage

View on GitHub

Showing 83 of 197 total issues

Avoid too many return statements within this function.
Open

        return "%.1fMB" % (float(b) / (1024 * 1024))
Severity: Major
Found in dosagelib/util.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return display_help(options)
    Severity: Major
    Found in dosagelib/cmd.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return super().getPrevUrl(url, data)
      Severity: Major
      Found in dosagelib/plugins/e.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return self.stripUrl % 'Kickstarter+Stories/54'
        Severity: Major
        Found in dosagelib/plugins/e.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return self.stripUrl % 'Book+0/81'
          Severity: Major
          Found in dosagelib/plugins/e.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return director.getComics(options)
            Severity: Major
            Found in dosagelib/cmd.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return "%.2fGB" % (float(b) / (1024 * 1024 * 1024))
              Severity: Major
              Found in dosagelib/util.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return super(PeterIsTheWolfGeneral, self).getPrevUrl(url, data)
                Severity: Major
                Found in dosagelib/plugins/wlpcomics.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return "%.1fGB" % (float(b) / (1024 * 1024 * 1024))
                  Severity: Major
                  Found in dosagelib/util.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return vote_comics(options)
                    Severity: Major
                    Found in dosagelib/cmd.py - About 30 mins to fix

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

                          def getPrevUrl(self, url, data):
                              # Fix missing navigation links between books
                              if url == self.stripUrl % 'Book+5/1':
                                  return self.stripUrl % 'Book+4/203'
                              elif url == self.stripUrl % 'Book+4/1':
                      Severity: Minor
                      Found in dosagelib/plugins/e.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 write has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def write(self, s, level=0, color=None):
                              """Write message with indentation, context and optional timestamp."""
                              if level > self.level:
                                  return
                              if self.timestamps:
                      Severity: Minor
                      Found in dosagelib/output.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 find_dups has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def find_dups(self, name):
                              """Check if comic name already exists."""
                              names = [(tmpl % name).lower() for tmpl in self.dup_templates]
                              if names:
                                  for scraper in scrapers.all():
                      Severity: Minor
                      Found in scripts/scriptutil.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 collect_results has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def collect_results(self):
                              """Parse the front page."""
                              data = self.get_url('http://keenspot.com/')
                      
                              for comiclink in data.xpath('//td[@id]/a'):
                      Severity: Minor
                      Found in scripts/keenspot.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 get_plugin_modules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def get_plugin_modules():
                          """Find (and import) all valid modules in the "plugins" package.
                          @return: all loaded valid modules
                          @rtype: iterator of module
                          """
                      Severity: Minor
                      Found in dosagelib/loader.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 create_cbz has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def create_cbz(directory):
                          """Creates or updates a CBZ from files in the given comic directory."""
                          if not os.path.isdir(directory):
                              print("ERROR: Directory", directory, "not found.")
                              return
                      Severity: Minor
                      Found in scripts/create-cbz.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 namer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def namer(self, imageUrl, pageUrl):
                              # Fix duplicate filenames
                              filename = imageUrl.rsplit('/', 1)[-1]
                              if '2015/12/jamet101' in imageUrl:
                                  filename = filename.replace('101', '10')
                      Severity: Minor
                      Found in dosagelib/plugins/p.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 extract_css_bg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def extract_css_bg(self, page) -> str | None:
                              comicdivs = self.match(page, '//div[@id="comic"]')
                              if comicdivs:
                                  style = comicdivs[0].attrib.get('style')
                                  if style:
                      Severity: Minor
                      Found in dosagelib/plugins/u.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 get_existing_comics has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def get_existing_comics(basepath=None, adult=True, listing=False):
                          for scraperobj in scrapercache.all(include_removed=True):
                              dirname = scraperobj.get_download_dir(basepath)
                              if os.path.isdir(dirname):
                                  if shouldRunScraper(scraperobj, adult, listing):
                      Severity: Minor
                      Found in dosagelib/director.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 copy_after_end has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def copy_after_end(self, src, dest):
                              skip = True
                              for line in src:
                                  if line.strip().startswith(self.END):
                                      skip = False
                      Severity: Minor
                      Found in scripts/scriptutil.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