CastagnaIT/plugin.video.netflix

View on GitHub
resources/lib/database/db_shared.py

Summary

Maintainability
C
7 hrs
Test Coverage

File db_shared.py has 431 lines of code (exceeds 400 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
"""
    Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix)
    Copyright (C) 2019 Stefano Gottardo - @CastagnaIT (original implementation module)
    Sharable database access and functions
Severity: Minor
Found in resources/lib/database/db_shared.py - About 2 hrs to fix

    Function get_shareddb_class has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring.
    Open

    def get_shareddb_class(use_mysql=False):
        # Dynamically sets the inherit class
        base_class = db_base_mysql.MySQLDatabase if use_mysql else db_base_sqlite.SQLiteDatabase
    
        class NFSharedDatabase(base_class):
    Severity: Minor
    Found in resources/lib/database/db_shared.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 get_stream_continuity has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def get_stream_continuity(self, profile_guid, videoid, default_value=None, data_type=None):
    Severity: Minor
    Found in resources/lib/database/db_shared.py - About 35 mins to fix

      Function get_watched_status has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def get_watched_status(self, profile_guid, videoid, default_value=None, data_type=None):
      Severity: Minor
      Found in resources/lib/database/db_shared.py - About 35 mins to fix

        Function insert_episode has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def insert_episode(self, tvshowid, seasonid, episodeid, file_path):
        Severity: Minor
        Found in resources/lib/database/db_shared.py - About 35 mins to fix

          Function get_tvshow_property has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  def get_tvshow_property(self, tvshowid, enum_vid_prop, default_value=None, data_type=None):
          Severity: Minor
          Found in resources/lib/database/db_shared.py - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status