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 *
File qtclass.py
has 675 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# This file is part of pyqt4topyqt5
MODULES = [
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
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
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 = {}
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
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
- Read upRead up
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.
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()
- Read upRead up
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
Cyclomatic complexity is too high in function parseThemePath. (10) Open
def parseThemePath(path, theme_folder):
path_to_parse = path
prefix = ''
postfix = ''
parsed_path = path
- Read upRead up
- Exclude checks
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. |
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
Cyclomatic complexity is too high in method handleInstrumentQueries. (9) Open
def handleInstrumentQueries(self, search_data, online=False):
results = {}
all_matched = True
result_data = {}
- Read upRead up
- Exclude checks
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. |
Cyclomatic complexity is too high in method LoadMeta. (9) Open
def LoadMeta(self):
try:
col_fob = open(self.meta_file(), 'rb')
except:
self.SaveMeta()
- Read upRead up
- Exclude checks
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. |
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,
- Read upRead up
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.
- Read upRead up
- Exclude checks
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. |