Harkame/google-images-downloader

View on GitHub
google_images_downloader/gid.py

Summary

Maintainability
B
5 hrs
Test Coverage
A
90%

File gid.py has 316 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import os
import urllib.request
from concurrent.futures import ThreadPoolExecutor, wait
from selenium import webdriver
from selenium.webdriver.common.by import By
Severity: Minor
Found in google_images_downloader/gid.py - About 3 hrs to fix

    Function __scroll has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def __scroll(self, limit):
            if not self.quiet:
                print("Scrolling...")
    
            bottom_tag = self.driver.find_element(By.CSS_SELECTOR, "div[jsname='wEwttd']")
    Severity: Minor
    Found in google_images_downloader/gid.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_item has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Wontfix

    def download_item(index, query, query_destination, image_url, preview_src, resize, file_format, pbar=None):
    Severity: Major
    Found in google_images_downloader/gid.py - About 1 hr to fix

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

          def __get_image_values(self, index, image_item):
              self.driver.execute_script("arguments[0].scrollIntoView(true);", image_item)
      
              side_menu_tag = None
      
      
      Severity: Minor
      Found in google_images_downloader/gid.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 __download_items has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def __download_items(self, query, destination, image_items, resize, limit, file_format, pbar=None):
              query_destination = os.path.join(destination, query)
      
              running_downloads = 0
      
      
      Severity: Minor
      Found in google_images_downloader/gid.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 __download_items has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Wontfix

          def __download_items(self, query, destination, image_items, resize, limit, file_format, pbar=None):
      Severity: Major
      Found in google_images_downloader/gid.py - About 50 mins to fix

        Function save_image has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Wontfix

        def save_image(index, image, query, query_destination, resize, file_format):
        Severity: Minor
        Found in google_images_downloader/gid.py - About 45 mins to fix

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

              def __init__(self, browser=DEFAULT_BROWSER, show=DEFAULT_SHOW, debug=DEFAULT_DEBUG, quiet=DEFAULT_QUIET,
                           disable_safeui=DEFAULT_DISABLE_SAFEUI):
                  logger.debug(f"browser : {browser}")
                  logger.debug(f"show : {show}")
                  logger.debug(f"debug : {debug}")
          Severity: Minor
          Found in google_images_downloader/gid.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 download has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Wontfix

              def download(self, query, destination=DEFAULT_DESTINATION, limit=DEFAULT_LIMIT,
          Severity: Minor
          Found in google_images_downloader/gid.py - About 35 mins to fix

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

                def __init__(self, browser=DEFAULT_BROWSER, show=DEFAULT_SHOW, debug=DEFAULT_DEBUG, quiet=DEFAULT_QUIET,
            Severity: Minor
            Found in google_images_downloader/gid.py - About 35 mins to fix

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

                  def download(self, query, destination=DEFAULT_DESTINATION, limit=DEFAULT_LIMIT,
                               resize=DEFAULT_RESIZE, file_format=DEFAULT_FORMAT):
                      query_destination_folder = os.path.join(destination, query)
                      os.makedirs(query_destination_folder, exist_ok=True)
              
              
              Severity: Minor
              Found in google_images_downloader/gid.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

              There are no issues that match your filters.

              Category
              Status