StegSchreck/RatS

View on GitHub

Showing 9 of 23 total issues

File transfer_ratings.py has 251 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
import argparse
import datetime
import os
import sys
Severity: Minor
Found in transfer_ratings.py - About 2 hrs to fix

    Function execute_inserting has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def execute_inserting(args, movies: List[Movie], parser: RatingsParser):
        if not args.all_destinations and not args.destination:
            return
        destinations: List[Site] = (
            [inserter for inserter in INSERTERS.keys()]
    Severity: Minor
    Found in transfer_ratings.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

    Consider simplifying this complex logical expression.
    Open

            if args and args.verbose and args.verbose >= 3:
                log_level = "trace"
            elif args and args.verbose and args.verbose == 2:
                log_level = "debug"
            elif args and args.verbose and args.verbose == 1:
    Severity: Major
    Found in RatS/utils/browser_handler.py - About 1 hr to fix

      Function _is_movie_in_search_results has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Confirmed

          def _is_movie_in_search_results(self, movie: Movie, search_results):
              if self._on_search_result_page():
                  for search_result in search_results:
                      if self._is_requested_movie(movie, search_result):
                          return True  # Found
      Severity: Minor
      Found in RatS/filmaffinity/filmaffinity_ratings_inserter.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 _handle_cookie_notice_if_present has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def _handle_cookie_notice_if_present(self):
              cookie_notices = self.browser.find_elements(By.ID, "qc-cmp2-container")
              if len(cookie_notices) == 0:
                  return
              cookie_notice = cookie_notices[0]
      Severity: Minor
      Found in RatS/filmaffinity/filmaffinity_site.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 _compare_external_links has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def _compare_external_links(
              page_source, movie: Movie, external_url_base: str, site: Site
          ):
              movie_details_page = BeautifulSoup(page_source, "html.parser")
              external_links: List = (
      Severity: Minor
      Found in RatS/trakt/trakt_ratings_inserter.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 from_json has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def from_json(movie_json):
              if "id" in movie_json.keys():
                  return SiteSpecificMovieData.from_json(movie_json)
              elif "site_data" in movie_json.keys():
                  return Movie(
      Severity: Minor
      Found in RatS/base/movie_entity.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, args):
              login_form_selector = "//form[@name='sign_in']"
              self.LOGIN_USERNAME_SELECTOR = (
                  login_form_selector + "//input[@id='sign_in__username']"
              )
      Severity: Minor
      Found in RatS/allocine/allocine_site.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 _compare_external_links has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _compare_external_links(
              page_source, movie: Movie, external_url_base: str, site: Site
          ):
              movie_details_page = BeautifulSoup(page_source, "html.parser")
              if movie_details_page.find(class_="ratingstable"):
      Severity: Minor
      Found in RatS/listal/listal_ratings_inserter.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