Showing 42 of 219 total issues
Function compute_overall_histogram
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def compute_overall_histogram(histograms):
"""--------------------------------------------------------------------
Plot an overall histogram obtained by the sum of the histograms provided
as inputs. Every histogram is converted in cents. A new x-axis interval
is created using minimum and maximum value in cents for all the
- 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
Avoid deeply nested control flow statements. Open
if feature:
json.dump(feature, open(f_path, 'w'))
except:
Function download_score
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def download_score(self, docid):
SCORE_FOLDER = os.path.join(FOLDER, '..', 'scores')
if not os.path.exists(SCORE_FOLDER):
os.makedirs(SCORE_FOLDER)
- 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
Consider simplifying this complex logical expression. Open
if index_melodic is -1 and index_form is -1 and index_rhythm is -1 \
and index_composer is -1 and index_performer is -1 and \
index_instrument is -1:
self.toolButton_query.setDisabled(True)
else:
Function get_document_as_json
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_document_as_json(recordingid, thetype, subtype=None, part=None, version=None):
Function change_color
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def change_color(path, tree, root, note_id, color):
Function file_for_document
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def file_for_document(recordingid, thetype, subtype=None, part=None, version=None):
Function create_and_upload_document
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_and_upload_document(collection, document, filetype, title, file):
Function get_works_by_query
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_works_by_query(mid='', uid='', fid='', cmbid='', ambid=''):
Function get_filenames_in_dir
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_filenames_in_dir(dir_name, keyword='*.mp3', skip_foldername='',
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, values=[0, 1], orientation=None, brush=None,
Function add_1d_roi_items
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_1d_roi_items(self, f_type, item):
"""
Adds 1d roi item.
:param f_type: (str) Feature type
- 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
Function create_table
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_table(self, coll):
# first cleans the table, sets the columns and enables the widget
self.setRowCount(0)
self._set_columns()
- 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
Function add_recording
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_recording(self, work):
for rec in work['recordings']:
check_item = QStandardItem()
check_item.setCheckable(True)
title = QStandardItem(rec['title'])
- 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
Function download_release
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def download_release(releaseid, location, slugify=False):
"""Download the mp3s of all recordings in a release and save
them to the specificed directory.
:param release: The MBID of the release
- 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
Function add_items
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_items(self):
if self.feature_dict:
for key in self.feature_dict.keys():
root = QTreeWidgetItem(self, [key])
- 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
Function download_mp3
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def download_mp3(recordingid, location, slugify=False):
"""Download the mp3 of a document and save it to the specificed directory.
:param recordingid: The MBID of the recording
:param location: Where to save the mp3 to
- 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
Function get_feature_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_feature_list(self, docid):
fullnames, folders, names = get_filenames_in_dir(
os.path.join(DOCS_PATH, docid), keyword='*.json')
for name in names:
- 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
Function add_sections_to_waveform
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_sections_to_waveform(self, feature_path):
sections = get_sections(feature_path)
colors = {}
color_index = 0
- 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
Function check_new_doc
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_new_doc(self, docs):
download = []
for docid in docs:
if not os.path.isdir(os.path.join(DOCS_PATH, str(docid))):
download.append(str(docid))
- 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"