Seraphim-Solutions/bettercinema

View on GitHub

Showing 11 of 11 total issues

File app.py has 559 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# from textwrap import wrap
import os
import hashlib
import json
import sys
Severity: Major
Found in app.py - About 1 day to fix

    Cli has 37 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Cli():
        """handles the cli"""
        def __init__(self):
            ConfigHandler()
            with open('config/config.json', 'r', encoding="utf-8") as f:
    Severity: Minor
    Found in app.py - About 4 hrs to fix

      Function menu has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def menu(self):
              """Shows the main menu"""
              self.clear_table_data()
              self.clear_console()
              vip_data = self.bc.get_vip_status(self.wst)
      Severity: Minor
      Found in app.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

          def internet(self):
              """Check if user is connected to Internet"""
              try:
                  response = requests.get(self.check_internet, timeout=5)
                  if response.status_code == 200:
      Severity: Major
      Found in handlers/connection_handler.py and 1 other location - About 2 hrs to fix
      handlers/connection_handler.py on lines 23..32

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

      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

          def webshare(self):
              """Check if user can connect to Webshare.cz"""
              try:
                  response = requests.get(self.webshare_url, timeout=5)
                  if response.status_code == 200:
      Severity: Major
      Found in handlers/connection_handler.py and 1 other location - About 2 hrs to fix
      handlers/connection_handler.py on lines 11..21

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

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

          def select_item_from_results(self):
              """Selects an item from the results"""
               
              selected_movie = inquirer.text(message="~> ").execute()
              commands = ("help", "more", "search", "sort", "menu", "exit")
      Severity: Minor
      Found in app.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

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

          def get_ctx1(self):
              for i in range(1000):
                  ctx1 = ''.encode('utf-8')
                  if i & 1:
                      ctx1 = ctx1 + self.pw
      Severity: Minor
      Found in misc/md5Crypt.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

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

          def download_latest_version(self):
              """Download BetterCinema latest version"""
              os_name = platform.system()
              if os_name == "Windows":
                  extension = "exe"
      Severity: Minor
      Found in handlers/version_handler.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 accounts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def accounts(self):
              self.update_user_dict()
              user_choice = inquirer.select(message="Choose account: ", choices=[
                  *self.user_dict,
                  "Add new account",
      Severity: Minor
      Found in app.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 add_trakt_user_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def add_trakt_user_data(self, username, private, vip, vip_ep, slug):
      Severity: Minor
      Found in handlers/db_handler.py - About 35 mins to fix

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

            def list_results(self, query, sort):
                """Generates table with results"""
                self.get_result_data()
                
                self.movie_table = Table(show_header=True, header_style=self.color_neutral, title=f'Search Results for \"{query}\" | sort by: {"relevance" if sort == "" else sort}', title_justify="center")
        Severity: Minor
        Found in app.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