SylvainDe/ComicBookMaker

View on GitHub

Showing 111 of 111 total issues

File comics.py has 5211 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/bin/python3
# vim: set expandtab tabstop=4 shiftwidth=4 :
"""Module to retrieve webcomics"""

from comic_abstract import GenericComic, get_date_for_comic
Severity: Major
Found in comics.py - About 2 wks to fix

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

        @classmethod
        def get_navi_link(cls, last_soup, next_):
            """Get link to next or previous comic."""
            # Based on get_a_comicnavbase_comicnavnext but with workaround
            link = last_soup.find(
    Severity: Major
    Found in comics.py and 1 other location - About 4 hrs to fix
    comics.py on lines 2935..2946

    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 85.

    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 2 locations. Consider refactoring.
    Open

        @classmethod
        def get_navi_link(cls, last_soup, next_):
            """Get link to next or previous comic."""
            link = last_soup.find("link", rel="next" if next_ else "prev")
            # Workaround because a page leads to 404 error
    Severity: Major
    Found in comics.py and 1 other location - About 4 hrs to fix
    comics.py on lines 3643..3660

    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 85.

    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

    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

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

          @classmethod
          def get_comic_info(cls, soup, archive_elt):
              """Get information about a particular comics."""
              title = soup.find("meta", property="og:title")["content"]
              imgs = soup.find_all("meta", property="og:image")
      Severity: Major
      Found in comics.py and 1 other location - About 3 hrs to fix
      comics.py on lines 3522..3529

      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 72.

      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 2 locations. Consider refactoring.
      Open

          @classmethod
          def get_comic_info(cls, soup, link):
              """Get information about a particular comics."""
              title = soup.find("meta", property="og:title")["content"]
              imgs = soup.find_all("meta", property="og:image")
      Severity: Major
      Found in comics.py and 1 other location - About 3 hrs to fix
      comics.py on lines 2409..2416

      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 72.

      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 check_prev_next_links has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_prev_next_links(cls, url):
              """Check that navigation to prev/next from a given URL seems to be working - for dev purposes."""
              cls.log("about to check prev/next from %s" % url)
              ok = True
              if url is None:
      Severity: Minor
      Found in comics.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

      Function main has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      def main():
          """Main function"""
          logger = logging.getLogger()
          arg_to_method = {
              "list": "print_name",
      Severity: Minor
      Found in comicbookmaker.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

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

              try:
                  get_soup_at_url(last_api_url)
              except urllib.error.HTTPError:
                  try:
                      get_soup_at_url(cls.url)
      Severity: Major
      Found in comics.py and 1 other location - About 3 hrs to fix
      comics.py on lines 6247..6259

      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 62.

      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 2 locations. Consider refactoring.
      Open

              try:
                  get_soup_at_url(last_url)
              except urllib.error.HTTPError:
                  try:
                      get_soup_at_url(cls.url)
      Severity: Major
      Found in comics.py and 1 other location - About 3 hrs to fix
      comics.py on lines 4295..4307

      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 62.

      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

      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

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

            @classmethod
            def get_navi_link(cls, last_soup, next_):
                """Get link to next or previous comic."""
                for link in last_soup.find_all("a", id="nav-next" if next_ else "nav-prev"):
                    if link["href"] != "http://www.sheldoncomics.com":
        Severity: Major
        Found in comics.py and 1 other location - About 2 hrs to fix
        comics.py on lines 2813..2819

        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 57.

        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 2 locations. Consider refactoring.
        Open

            @classmethod
            def get_navi_link(cls, last_soup, next_):
                """Get link to next or previous comic."""
                for link in last_soup.find_all("a", rel="next" if next_ else "prev"):
                    if link["href"] != "/comic":
        Severity: Major
        Found in comics.py and 1 other location - About 2 hrs to fix
        comics.py on lines 3546..3552

        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 57.

        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 get_soup_at_url has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_soup_at_url(
            url, detect_meta=False, detect_rel=False, detect_angular=False, save_in_file=False
        ):
            """Get content at url as BeautifulSoup.
        
        
        Severity: Minor
        Found in urlfunctions.py - About 2 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

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

            @classmethod
            def get_navi_link(cls, last_soup, next_):
                """Get link to next or previous comic."""
                li = last_soup.find("li", class_="link-next" if next_ else "link-prev")
                return li.find("a") if li else None
        Severity: Major
        Found in comics.py and 4 other locations - About 1 hr to fix
        comics.py on lines 834..839
        comics.py on lines 1120..1126
        comics.py on lines 3368..3373
        comics.py on lines 4111..4115

        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 49.

        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 5 locations. Consider refactoring.
        Open

            @classmethod
            def get_navi_link(cls, last_soup, next_):
                """Get link to next or previous comic."""
                link = last_soup.find(
                    "div", class_="nav-comic nav-right" if next_ else "nav-comic nav-left"
        Severity: Major
        Found in comics.py and 4 other locations - About 1 hr to fix
        comics.py on lines 771..775
        comics.py on lines 834..839
        comics.py on lines 3368..3373
        comics.py on lines 4111..4115

        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 49.

        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 5 locations. Consider refactoring.
        Open

            @classmethod
            def get_navi_link(cls, last_soup, next_):
                """Get link to next or previous comic."""
                # prev is next / next is prev
                li = last_soup.find("li", class_="prev" if next_ else "next")
        Severity: Major
        Found in comics.py and 4 other locations - About 1 hr to fix
        comics.py on lines 771..775
        comics.py on lines 1120..1126
        comics.py on lines 3368..3373
        comics.py on lines 4111..4115

        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 49.

        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 5 locations. Consider refactoring.
        Open

            @classmethod
            def get_navi_link(cls, last_soup, next_):
                """Get link to next or previous comic."""
                # prev is next / next is prev
                li = last_soup.find("li", class_="prev" if next_ else "next")
        Severity: Major
        Found in comics.py and 4 other locations - About 1 hr to fix
        comics.py on lines 771..775
        comics.py on lines 834..839
        comics.py on lines 1120..1126
        comics.py on lines 4111..4115

        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 49.

        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 5 locations. Consider refactoring.
        Open

            @classmethod
            def get_navi_link(cls, last_soup, next_):
                """Get link to next or previous comic."""
                li = last_soup.find("li", class_="prev" if next_ else "next")
                return li.find("a") if li else None
        Severity: Major
        Found in comics.py and 4 other locations - About 1 hr to fix
        comics.py on lines 771..775
        comics.py on lines 834..839
        comics.py on lines 1120..1126
        comics.py on lines 3368..3373

        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 49.

        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

        Severity
        Category
        Status
        Source
        Language