Godley/Music-Library

View on GitHub

Showing 202 of 202 total issues

File MusicManager.py has 677 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import shutil
import zipfile
from xml.sax._exceptions import *

Severity: Major
Found in implementation/primaries/ExtractMetadata/classes/MusicManager.py - About 1 day to fix

    File qtclass.py has 675 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    
    # This file is part of pyqt4topyqt5
    
    MODULES = [
    Severity: Major
    Found in qtclass.py - About 1 day to fix

      File musicdata.py has 633 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """
      This class handles very low level queries to the database file, including
      creation of tables when files are first created (will do if not exists so
      there are no clashes), handling connection and disconnection from the DB,
      etc.

        File MainWindow.py has 428 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from PyQt4 import QtGui, QtCore, uic
        import sip
        import os
        import difflib
        import time
        Severity: Minor
        Found in implementation/primaries/GUI/MainWindow.py - About 6 hrs to fix

          MusicData has 39 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class MusicData(querylayer.QueryLayer):
              parsers = {"tempos": TempoParser(),
                         "time_signatures": MeterParser(),
                         "instruments": InstrumentParser()}
          
          

            Application has 35 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Application(QtCore.QObject):
                windows = {}
            
                def __init__(self, app):
                    self.wifi = True
            Severity: Minor
            Found in Application.py - About 4 hrs to fix

              File querylayer.py has 348 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              from sqlalchemy import create_engine, update
              from sqlalchemy.orm import sessionmaker
              from sqlalchemy.sql.expression import exists, alias, select, or_
              
              from sqlalchemy import Table, Column, Integer, String, MetaData, \

                MainWindow has 33 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class MainWindow(QtGui.QMainWindow, themedWindow.ThemedWindow):
                    widgets = {}
                    frames = {}
                    colors = {}
                
                
                Severity: Minor
                Found in implementation/primaries/GUI/MainWindow.py - About 4 hrs to fix

                  File Application.py has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  from threading import Lock
                  import os
                  import pickle
                  from PyQt4 import QtGui, QtCore, QtXml
                  from implementation.primaries.GUI import renderingErrorPopup, SetupWindow
                  Severity: Minor
                  Found in Application.py - About 3 hrs to fix

                    Function parseThemePath has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def parseThemePath(path, theme_folder):
                        path_to_parse = path
                        prefix = ''
                        postfix = ''
                        parsed_path = path
                    Severity: Minor
                    Found in implementation/primaries/GUI/helpers.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

                    QueryLayer has 26 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class QueryLayer(object):
                        tables = {}
                        join_tables = {"keys": "keys_ins_piece",
                                       "clefs": "clefs_ins_piece",
                                       "instruments": "clefs_ins_piece",

                      MusicManager has 25 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class MusicManager(SearchLayer):
                          """
                          Grand master class which pulls together features from every other class. This class is instantiated by the Application
                          class and should provide methods for the application to access everything else, from rendering to info extraction
                          to API access.
                      Severity: Minor
                      Found in implementation/primaries/ExtractMetadata/classes/MusicManager.py - About 2 hrs to fix

                        Function LoadMeta has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def LoadMeta(self):
                                try:
                                    col_fob = open(self.meta_file(), 'rb')
                                except:
                                    self.SaveMeta()
                        Severity: Minor
                        Found in Application.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

                        SearchLayer has 23 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class SearchLayer(MusicData):
                        
                            def __init__(self, folder, database):
                                super().__init__(database)
                                self.folder = folder
                        Severity: Minor
                        Found in implementation/primaries/ExtractMetadata/classes/MusicManager.py - About 2 hrs to fix

                          Cyclomatic complexity is too high in function parseThemePath. (10)
                          Open

                          def parseThemePath(path, theme_folder):
                              path_to_parse = path
                              prefix = ''
                              postfix = ''
                              parsed_path = path

                          Cyclomatic Complexity

                          Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                          Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                          Construct Effect on CC Reasoning
                          if +1 An if statement is a single decision.
                          elif +1 The elif statement adds another decision.
                          else +0 The else statement does not cause a new decision. The decision is at the if.
                          for +1 There is a decision at the start of the loop.
                          while +1 There is a decision at the while statement.
                          except +1 Each except branch adds a new conditional path of execution.
                          finally +0 The finally block is unconditionally executed.
                          with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                          assert +1 The assert statement internally roughly equals a conditional statement.
                          Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                          Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                          Source: http://radon.readthedocs.org/en/latest/intro.html

                          File Widgets.py has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          from PyQt4 import uic, QtCore, QtGui
                          from implementation.primaries.GUI.helpers import get_base_dir, merge_clefs_and_keys, merge_instruments, fit_columns_to_widget
                          import os
                          
                          
                          
                          Severity: Minor
                          Found in implementation/primaries/GUI/Widgets.py - About 2 hrs to fix

                            Cyclomatic complexity is too high in method handleInstrumentQueries. (9)
                            Open

                                def handleInstrumentQueries(self, search_data, online=False):
                                    results = {}
                                    all_matched = True
                                    result_data = {}
                            
                            

                            Cyclomatic Complexity

                            Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                            Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                            Construct Effect on CC Reasoning
                            if +1 An if statement is a single decision.
                            elif +1 The elif statement adds another decision.
                            else +0 The else statement does not cause a new decision. The decision is at the if.
                            for +1 There is a decision at the start of the loop.
                            while +1 There is a decision at the while statement.
                            except +1 Each except branch adds a new conditional path of execution.
                            finally +0 The finally block is unconditionally executed.
                            with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                            assert +1 The assert statement internally roughly equals a conditional statement.
                            Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                            Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                            Source: http://radon.readthedocs.org/en/latest/intro.html

                            Cyclomatic complexity is too high in method LoadMeta. (9)
                            Open

                                def LoadMeta(self):
                                    try:
                                        col_fob = open(self.meta_file(), 'rb')
                                    except:
                                        self.SaveMeta()
                            Severity: Minor
                            Found in Application.py by radon

                            Cyclomatic Complexity

                            Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                            Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                            Construct Effect on CC Reasoning
                            if +1 An if statement is a single decision.
                            elif +1 The elif statement adds another decision.
                            else +0 The else statement does not cause a new decision. The decision is at the if.
                            for +1 There is a decision at the start of the loop.
                            while +1 There is a decision at the while statement.
                            except +1 Each except branch adds a new conditional path of execution.
                            finally +0 The finally block is unconditionally executed.
                            with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                            assert +1 The assert statement internally roughly equals a conditional statement.
                            Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                            Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                            Source: http://radon.readthedocs.org/en/latest/intro.html

                            Function setup_data_items has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def setup_data_items(
                                        self,
                                        playlist_fnames,
                                        playlist_data,
                                        start_index,
                            Severity: Minor
                            Found in implementation/primaries/GUI/MainWindow.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

                            Cyclomatic complexity is too high in method searchForExactMatch. (8)
                            Open

                                def searchForExactMatch(self, filters):
                                    '''
                                    method to search the db for specific things. This will apply each filter in turn,
                                    and then extract the results which exist in every response.
                                    :param filters: a dictionary of things to filter it by. The value of each entry should be a list.

                            Cyclomatic Complexity

                            Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

                            Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

                            Construct Effect on CC Reasoning
                            if +1 An if statement is a single decision.
                            elif +1 The elif statement adds another decision.
                            else +0 The else statement does not cause a new decision. The decision is at the if.
                            for +1 There is a decision at the start of the loop.
                            while +1 There is a decision at the while statement.
                            except +1 Each except branch adds a new conditional path of execution.
                            finally +0 The finally block is unconditionally executed.
                            with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
                            assert +1 The assert statement internally roughly equals a conditional statement.
                            Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
                            Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

                            Source: http://radon.readthedocs.org/en/latest/intro.html

                            Severity
                            Category
                            Status
                            Source
                            Language