Showing 691 of 691 total issues
Avoid deeply nested control flow statements. Open
Open
if fraction == 0.25:
value += "."
return value
Avoid deeply nested control flow statements. Open
Open
if not hasattr(piece.GetItem().meta, "copyright"):
piece.GetItem().meta.copyright = ""
piece.GetItem().meta.copyright += rights
Avoid deeply nested control flow statements. Open
Open
if "default-x" in temp:
x = float(temp["default-x"])
if "default-y" in temp:
Avoid deeply nested control flow statements. Open
Open
if part.getMeasure(measure_id, staff) is None:
part.addEmptyMeasure(measure_id, staff)
measure = part.getMeasure(
Avoid deeply nested control flow statements. Open
Open
if "first-fret" in content:
if "first-fret" not in attrib:
data["direction"].frame.firstFret = [
content["first-fret"]]
else:
Avoid deeply nested control flow statements. Open
Open
if "string" in tag and "string" in content:
data["frame_note"].string = content["string"]
data["direction"].frame.notes[
int(content["string"])] = data["frame_note"]
if "fret" in tag and "fret" in content:
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 measure is not None:
key = measure.GetLastKey(voice=data["voice"])
if key is not None and type(key) is not Key.Key:
key = key.GetItem()
measure.addKey(Key.Key(), data["voice"])
Avoid deeply nested control flow statements. Open
Open
if "halign" in attrib["kind"]:
kind.halign = attrib["kind"]["halign"]
if "parenthesis-degrees" in attrib["kind"]:
Avoid deeply nested control flow statements. Open
Open
if "dacapo" in attrs["sound"]:
measure.dacapo = YesNoToBool(attrs["sound"]["dacapo"])
if "dalsegno" in attrs["sound"]:
Function addClef
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def addClef(self, item, measure_id, staff_id, voice):
measure = self.getMeasure(measure_id, staff_id)
if measure is not None:
measure.addClef(item, voice)
else:
- 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 "valign" in temp:
valign = temp["valign"]
if valign == "bottom" and data["handleType"] == "":
data["handleType"] = "rights"
Avoid deeply nested control flow statements. Open
Open
if not isinstance(node, NoteNode.Placeholder):
self.index += 1
else:
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 data["note"].Search(type(accent)) is None:
data["note"].addNotation(accent)
accent = None
Avoid deeply nested control flow statements. Open
Open
if data["frame_note"] is None:
data["frame_note"] = Harmony.FrameNote()
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 "dalsegno" in attrs["sound"]:
measure.dalsegno = attrs["sound"]["dalsegno"]
if "fine" in attrs["sound"]:
Avoid deeply nested control flow statements. Open
Open
if "segno" in attrs["sound"]:
measure.segno = attrs["sound"]["segno"]
if "tocoda" in attrs["sound"]:
Avoid deeply nested control flow statements. Open
Open
for c in children:
child = placeholder.GetChild(c)
if child.GetItem(
).__class__.__name__ == OctaveShift.__name__:
i = placeholder.PopChild(c)