webcomics/dosage

View on GitHub

Showing 197 of 197 total issues

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

    def __init__(self, name, path, first, sid, eol=False):
Severity: Minor
Found in dosagelib/plugins/shivaestudios.py - About 35 mins to fix

    Function strsize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def strsize(b):
        """Return human representation of bytes b. A negative number of bytes
        raises a value error."""
        if b < 0:
            raise ValueError("Invalid negative byte number")
    Severity: Minor
    Found in dosagelib/util.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def fetchText(self, url, data, textSearch, optional):
            """Search text entry for given text pattern in a HTML page."""
            if textSearch:
                match = textSearch.search(data[0])
                if match:
    Severity: Minor
    Found in dosagelib/scraper.py - About 35 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 getIndexStripUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def getIndexStripUrl(self, index):
            (volume, strip) = index.split('-', maxsplit=1)
            try:
                pageNr = int(strip)
            except ValueError:
    Severity: Minor
    Found in dosagelib/plugins/b.py - About 35 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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    class FlakyPastry(_BasicScraper):
        baseUrl = 'http://flakypastry.runningwithpencils.com/'
        url = baseUrl + 'index.php'
        stripUrl = baseUrl + 'comic.php?strip_id=%s'
        firstStripUrl = stripUrl % '0'
    Severity: Minor
    Found in dosagelib/plugins/f.py and 2 other locations - About 35 mins to fix
    dosagelib/plugins/p.py on lines 57..64
    dosagelib/plugins/u.py on lines 74..81

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 65.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function connect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def connect(self, lastchange=None):
            """Connect to host and get meta information."""
            headers = {}
            if lastchange:
                headers['If-Modified-Since'] = lastchange.strftime(RFC_1123_DT_STR)
    Severity: Minor
    Found in dosagelib/comic.py - About 35 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 save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def save(self, basepath):
            """Save comic URL to filename on disk."""
            fnbase = self._fnbase(basepath)
            exist = [x for x in glob.glob(fnbase + ".*") if not x.endswith(".txt")]
            out.info(u"Get image URL %s" % self.url, level=1)
    Severity: Minor
    Found in dosagelib/comic.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def namer(self, imageUrl, pageUrl):
            filename = imageUrl.rsplit('/', 1)[-1].split('.', 1)[0]
            ext = imageUrl.rsplit('.', 1)[-1]
            if filename == 'j':
                filename = 'RF_E3_P52'
    Severity: Minor
    Found in dosagelib/plugins/r.py - About 35 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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    class PastelDefender(_BasicScraper):
        baseUrl = 'http://www.pasteldefender.com/'
        url = baseUrl + 'coverbackcover.html'
        stripUrl = baseUrl + '%s.html'
        firstStripUrl = stripUrl % 'cover'
    Severity: Minor
    Found in dosagelib/plugins/p.py and 2 other locations - About 35 mins to fix
    dosagelib/plugins/f.py on lines 71..78
    dosagelib/plugins/u.py on lines 74..81

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 65.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    class UnicornJelly(BasicScraper):
        baseUrl = 'http://unicornjelly.com/'
        url = baseUrl + 'uni666.html'
        stripUrl = baseUrl + 'uni%s.html'
        firstStripUrl = stripUrl % '001'
    Severity: Minor
    Found in dosagelib/plugins/u.py and 2 other locations - About 35 mins to fix
    dosagelib/plugins/f.py on lines 71..78
    dosagelib/plugins/p.py on lines 57..64

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 65.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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 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 vote_comics(options)
          Severity: Major
          Found in dosagelib/cmd.py - About 30 mins to fix

            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 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 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 "%.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 "%.1fGB" % (float(b) / (1024 * 1024 * 1024))
                      Severity: Major
                      Found in dosagelib/util.py - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language