Showing 127 of 287 total issues
Function convertsymbtr2xml
has a Cognitive Complexity of 198 (exceeds 5 allowed). Consider refactoring. Open
def convertsymbtr2xml(self, verbose=None):
if verbose is not None:
self.verbose = verbose
outkoddict = dict((e, 0) for e in kodlist)
- 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
File symbtr2musicxml.py
has 792 lines of code (exceeds 250 allowed). Consider refactoring. Open
import copy
import os
from lxml import etree
Function correct_jumps
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def correct_jumps(self, pitch):
for i in range(4, len(pitch) - 6):
if self.are_close(pitch[i - 4][1], pitch[i - 3][1]) and \
self.are_close(pitch[i - 3][1], pitch[i - 2][1]) and \
self.are_close(pitch[i - 2][1], pitch[i - 1][1]):
- 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 correct_octave_errors_by_chunks
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def correct_octave_errors_by_chunks(self, pitch):
pitch_chunks = self.decompose_into_chunks(pitch=pitch)
zero_chunks = []
zero_ind = []
- 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 decompose_into_chunks
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def decompose_into_chunks(self, pitch):
"""
decomposes the given pitch track into the chunks.
"""
pitch_chunks = []
- 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_filenames_in_dir
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def get_filenames_in_dir(dir_name, keyword='*', skip_foldername='',
match_case=True, verbose=False):
"""
Args:
dir_name (str): The foldername.
- 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
File pitchdistribution.py
has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2015 - 2018 Altuğ Karakurt & Sertan Şentürk
#
# This file is part of tomato: https://github.com/sertansenturk/tomato/
#
# tomato is free software: you can redistribute it and/or modify it under
Function _get_theoretical_intervals_to_search
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def _get_theoretical_intervals_to_search(self, makam):
# Reading dictionary which contains note symbol, theoretical names and
# their cent values
note_dict = IO.load_music_data('note')
- 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
SymbTrScore
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class SymbTrScore:
def __init__(self, txtpath, mu2path, symbtrname='', mbid_url='',
verbose=None):
self.txtpath = txtpath # filepath for the txt score
self.mu2path = mu2path # filepath for the mu2 score; used for
PitchDistribution
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class PitchDistribution:
def __init__(self, pd_bins, pd_vals, kernel_width=7.5, ref_freq=440.0):
"""-------------------------------------------------------------------
The main data structure that wraps all the relevant information about a
pitch distribution.
Function fetchsymbtrinfo
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def fetchsymbtrinfo(self, info):
self.sira = info[0]
self.kod = info[1]
self.nota53 = info[2]
self.notaae = info[3]
- 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 ((self.are_close(pitch_chunks[i][0][1] / 2.,
pitch_chunks[i - 1][-1][1]) and
(pitch_chunks[i][-1][1] / 1.5 >
pitch_chunks[i + 1][0][1])) or
(self.are_close(med_chunk_i / 2., med_chunk_prev) and
Function readsymbtrlines
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def readsymbtrlines(self):
global kodlist, koddict
# read operation
f = open(self.txtpath, encoding='utf-8')
- 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
File plotter.py
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2016 - 2018 Sertan Şentürk
#
# This file is part of tomato: https://github.com/sertansenturk/tomato/
#
# tomato is free software: you can redistribute it and/or modify it under
File pitchfilter.py
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2014 - 2018 Hasan Sercan Atlı & Sertan Şentürk
#
# This file is part of tomato: https://github.com/sertansenturk/tomato/
#
# tomato is free software: you can redistribute it and/or modify it under
Function read_header
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def read_header(cls, score_file, symbtr_name=None):
"""
Reads the header of the SymbTr-mu2 scores.
Parameters
- 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
File knnclassifier.py
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2015 - 2018 Altuğ Karakurt & Sertan Şentürk
#
# This file is part of tomato: https://github.com/sertansenturk/tomato/
#
# tomato is free software: you can redistribute it and/or modify it under
Function get_note_type
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def get_note_type(self):
# print(self.sira, self.kod, "symbtrnote.get_note_type")
temp_pay_payda = float(self.pay) / int(self.payda)
temp_undotted = None
- 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
File jointanalyzer.py
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2016 - 2018 Sertan Şentürk
#
# This file is part of tomato: https://github.com/sertansenturk/tomato/
#
# tomato is free software: you can redistribute it and/or modify it under
AudioAnalyzer
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class AudioAnalyzer(Analyzer):
_inputs = ['makam', 'melodic_progression', 'metadata', 'note_models',
'pitch', 'pitch_class_distribution', 'pitch_distribution',
'pitch_filtered', 'tempo', 'tonic', 'transposition']