Showing 228 of 691 total issues
Avoid deeply nested control flow statements. Open
Open
if attrib["creator"]["type"] == "composer":
if "creator" in content:
composer = content["creator"]
if tag[-1] == "movement-title" or "creator":
Avoid deeply nested control flow statements. Open
Open
for staff in staves:
if part.getMeasure(measure_id, staff) is None:
part.addEmptyMeasure(measure_id, staff)
measure = part.getMeasure(measure_id, staff)
measure.newPage = YesNoToBool(
Avoid deeply nested control flow statements. Open
Open
if "text" in attrib["kind"]:
kind.text = attrib["kind"]["text"]
if "halign" in attrib["kind"]:
Avoid deeply nested control flow statements. Open
Open
if measure.GetBarline(location) is None or not hasattr(
measure.GetBarline(location),
"ending"):
num_str = attrib["ending"]["number"]
split = num_str.split(",")
Function HandleFermata
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def HandleFermata(tags, attrs, chars, piece, data):
if "fermata" in tags:
type = None
symbol = None
if "fermata" in attrs:
- 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
Open
if data["handleType"] == "rights":
if not hasattr(piece.GetItem().meta, "copyright"):
piece.GetItem().meta.copyright = text
else:
if text.replace(
Avoid deeply nested control flow statements. Open
Open
if data["handleType"] == "page number":
if not hasattr(piece.GetItem().meta, "pageNum"):
piece.GetItem().meta.pageNum = True
data["handleType"] = ""
Avoid deeply nested control flow statements. Open
Open
if "parenthesis-degrees" in attrib["kind"]:
kind.parenthesis = attrib[
"kind"]["parenthesis-degrees"]
Avoid deeply nested control flow statements. Open
Open
if "degree-type" in attrib:
if "text" in attrib["degree-type"]:
data["degree"].display = attrib[
"degree-type"]["text"]
Avoid deeply nested control flow statements. Open
Open
if "fret" in tag and "fret" in content:
data["frame_note"].fret = content["fret"]
if "barre" in tag and "barre" in attrib:
Avoid deeply nested control flow statements. Open
Open
if "valign" in temp:
valign = temp["valign"]
if valign == "bottom" and data["handleType"] == "":
data["handleType"] = "rights"
Avoid deeply nested control flow statements. Open
Open
if location not in measure.barlines or not hasattr(
measure.GetBarline(location),
"ending"):
btype = attrib["ending"]["type"]
else:
Avoid deeply nested control flow statements. Open
Open
if "font-family" in attrs["metronome"]:
data["direction"].font = attrs[
"metronome"]["font-family"]
if "font-size" in attrs["metronome"]:
Avoid deeply nested control flow statements. Open
Open
if "font-size" in attrs["metronome"]:
data["direction"].size = float(
attrs["metronome"]["font-size"])
if "parentheses" in attrs["metronome"]:
Avoid deeply nested control flow statements. Open
Open
if not hasattr(bline2, "ending"):
bline1.ending.type = "discontinue"
else:
Avoid deeply nested control flow statements. Open
Open
if fraction == 0.25:
value += "."
return value
Avoid deeply nested control flow statements. Open
Open
if "root-step" in content:
root.step = content["root-step"]
if tag[-1] == "root-alter":
Avoid deeply nested control flow statements. Open
Open
if hasattr(barline, "ending"):
position = -2
index = part.getMeasureIDAtPosition(
position,
staff=data["staff_id"])
Avoid deeply nested control flow statements. Open
Open
if "font-size" in attrs["metronome"]:
data["direction"].size = attrs[
"metronome"]["font-size"]
if "parentheses" in attrs["metronome"]:
Avoid deeply nested control flow statements. Open
Open
if "font-family" in attrs["metronome"]:
data["direction"].font = attrs[
"metronome"]["font-family"]
if "font-size" in attrs["metronome"]: