Harkame/JapScanDownloader

View on GitHub

Showing 7 of 7 total issues

Function download has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    def download(self, item):
        if "chapters" in item:
            chapters = item["chapters"]

            url = chapters["manga"]
Severity: Minor
Found in japscandownloader/jsd_selenium.py - About 5 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

File jsd_selenium.py has 351 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import errno
import logging
import math
import os
import shutil
Severity: Minor
Found in japscandownloader/jsd_selenium.py - About 4 hrs to fix

    Function download_chapter has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def download_chapter(self, chapter_url):
            self.driver.get(chapter_url)
    
            WebDriverWait(self.driver, 10).until(
                ec.presence_of_element_located(
    Severity: Minor
    Found in japscandownloader/jsd_selenium.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 init_arguments has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def init_arguments(self, arguments):
            arguments = get_arguments(arguments)
    
            if arguments.verbose:
                logger.setLevel(logging.DEBUG)
    Severity: Minor
    Found in japscandownloader/jsd_selenium.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

    Function download_page has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def download_page(self, chapter_path, page_url, index, total):
    
            image_name = self.prepend_zeroes(index, total) + ".png"
            image_full_path = os.path.join(chapter_path, image_name)
    
    
    Severity: Minor
    Found in japscandownloader/jsd_selenium.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

    Avoid deeply nested control flow statements.
    Open

                            if self.split_reverse:
                                logger.debug("Reverse splitted double page")
                                file_a, file_b = file_b, file_a
    
    
    Severity: Major
    Found in japscandownloader/jsd_selenium.py - About 45 mins to fix

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

      def update_config(config_file_path, manga, last_chapter):
      
          yaml = ruamel.yaml.YAML()
      
          with open(config_file_path) as fp:
      Severity: Minor
      Found in japscandownloader/helpers/helper_config.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