Godley/MuseParse

View on GitHub

Showing 228 of 691 total issues

Avoid deeply nested control flow statements.
Open

                        if previous == value:
                            if total >= previous:
                                total -= previous
                            else:
                                total -= previous / 2
Severity: Major
Found in MuseParse/classes/ObjectHierarchy/TreeClasses/MeasureNode.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if not hasattr(
                                data["direction"],
                                "beat") or data["direction"].beat is None:
                            data["direction"].beat = unit
                        else:
    Severity: Major
    Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      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.newSystem = YesNoToBool(
      Severity: Major
      Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if not hasattr(piece.GetItem(), "meta"):
                                piece.GetItem().meta = Meta.Meta()
                            piece.GetItem().meta.AddCredit(credit)
        Severity: Major
        Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if "degree-alter" in content:
                                  data["degree"].alter = content["degree-alter"]
                          if "degree-type" in tag:
          Severity: Major
          Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if "degree-type" in content:
                                    data["degree"].type = content["degree-type"]
                                if "degree-type" in attrib:
            Severity: Major
            Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if "fingering" in tag and "fingering" in content:
                                      data["frame_note"].fingering = content["fingering"]
                  handleBarline(tag, attrib, content, piece, data)
              Severity: Major
              Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if data["note"].Search(type(accent)) is None:
                                        data["note"].addNotation(accent)
                                    accent = None
                Severity: Major
                Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if "degree-value" in content:
                                          data["degree"].value = content["degree-value"]
                                  if "degree-alter" in tag:
                  Severity: Major
                  Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if "barre" in tag and "barre" in attrib:
                                            data["frame_note"].barre = attrib["barre"]["type"]
                                        if "fingering" in tag and "fingering" in content:
                    Severity: Major
                    Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                      Function toLily has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def toLily(self):
                              '''
                      
                              Method which converts the object instance and its attributes to a string of lilypond code
                      
                      
                      Severity: Minor
                      Found in MuseParse/classes/ObjectHierarchy/TreeClasses/OtherNodes.py - About 45 mins to fix

                      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 "default-x" in temp:
                                              x = float(temp["default-x"])
                                          if "default-y" in temp:
                      Severity: Major
                      Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if "default-y" in temp:
                                                y = float(temp["default-y"])
                                            if "font-size" in temp:
                        Severity: Major
                        Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if data["handleType"] == "composer":
                                                  if not hasattr(piece.GetItem().meta, "composer"):
                                                      piece.GetItem().meta.composer = text
                                                  else:
                                                      if text.replace(
                          Severity: Major
                          Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if part.getMeasure(measure_id, staff) is None:
                                                    part.addEmptyMeasure(measure_id, staff)
                                        measure = part.getMeasure(
                            Severity: Major
                            Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if measure is None:
                                                      part.addEmptyMeasure(measure_id, data["staff_id"])
                                                      measure = part.getMeasure(measure_id, data["staff_id"])
                                                  if measure is not None:
                              Severity: Major
                              Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if "fine" in attrs["sound"]:
                                                        measure.fine = YesNoToBool(attrs["sound"]["fine"])
                                                    if "segno" in attrs["sound"]:
                                Severity: Major
                                Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if "segno" in attrs["sound"]:
                                                          measure.segno = attrs["sound"]["segno"]
                                                      if "tocoda" in attrs["sound"]:
                                  Severity: Major
                                  Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                                    Function addClef has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                    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:
                                    Severity: Minor
                                    Found in MuseParse/classes/ObjectHierarchy/TreeClasses/PartNode.py - About 45 mins to fix

                                    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 GetLastClef has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        def GetLastClef(self, voice=1):
                                            if self.GetChild(voice) is None:
                                                self.addVoice(VoiceNode(), voice)
                                            voice_obj = self.GetChild(voice)
                                            if voice_obj is not None:
                                    Severity: Minor
                                    Found in MuseParse/classes/ObjectHierarchy/TreeClasses/MeasureNode.py - About 45 mins to fix

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language