Godley/MuseParse

View on GitHub

Showing 228 of 691 total issues

Avoid deeply nested control flow statements.
Open

                    if attrib["creator"]["type"] == "composer":
                        if "creator" in content:
                            composer = content["creator"]
        if tag[-1] == "movement-title" or "creator":
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.newPage = YesNoToBool(
    Severity: Major
    Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if "text" in attrib["kind"]:
                              kind.text = attrib["kind"]["text"]
                          if "halign" in attrib["kind"]:
      Severity: Major
      Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if measure.GetBarline(location) is None or not hasattr(
                                    measure.GetBarline(location),
                                    "ending"):
                                num_str = attrib["ending"]["number"]
                                split = num_str.split(",")
        Severity: Major
        Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

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

          def HandleFermata(tags, attrs, chars, piece, data):
              if "fermata" in tags:
                  type = None
                  symbol = None
                  if "fermata" in attrs:
          Severity: Minor
          Found in MuseParse/classes/Input/MxmlParser.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 data["handleType"] == "rights":
                                  if not hasattr(piece.GetItem().meta, "copyright"):
                                      piece.GetItem().meta.copyright = 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 data["handleType"] == "page number":
                                    if not hasattr(piece.GetItem().meta, "pageNum"):
                                        piece.GetItem().meta.pageNum = True
                                data["handleType"] = ""
            Severity: Major
            Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if "parenthesis-degrees" in attrib["kind"]:
                                      kind.parenthesis = attrib[
                                          "kind"]["parenthesis-degrees"]
              
              
              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 attrib:
                                        if "text" in attrib["degree-type"]:
                                            data["degree"].display = attrib[
                                                "degree-type"]["text"]
                
                
                Severity: Major
                Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

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

                    Avoid deeply nested control flow statements.
                    Open

                                        if "valign" in temp:
                                            valign = temp["valign"]
                                            if valign == "bottom" and data["handleType"] == "":
                                                data["handleType"] = "rights"
                    
                    
                    Severity: Major
                    Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if location not in measure.barlines or not hasattr(
                                                  measure.GetBarline(location),
                                                  "ending"):
                                              btype = attrib["ending"]["type"]
                                          else:
                      Severity: Major
                      Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if "font-family" in attrs["metronome"]:
                                                data["direction"].font = attrs[
                                                    "metronome"]["font-family"]
                                            if "font-size" in attrs["metronome"]:
                        Severity: Major
                        Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if "font-size" in attrs["metronome"]:
                                                  data["direction"].size = float(
                                                      attrs["metronome"]["font-size"])
                                              if "parentheses" in attrs["metronome"]:
                          Severity: Major
                          Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if not hasattr(bline2, "ending"):
                                                        bline1.ending.type = "discontinue"
                                                else:
                            Severity: Major
                            Found in MuseParse/classes/ObjectHierarchy/TreeClasses/PartNode.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if fraction == 0.25:
                                                          value += "."
                                      return value
                              Severity: Major
                              Found in MuseParse/classes/ObjectHierarchy/TreeClasses/MeasureNode.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

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

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if hasattr(barline, "ending"):
                                                          position = -2
                                                          index = part.getMeasureIDAtPosition(
                                                              position,
                                                              staff=data["staff_id"])
                                  Severity: Major
                                  Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        if "font-size" in attrs["metronome"]:
                                                            data["direction"].size = attrs[
                                                                "metronome"]["font-size"]
                                                        if "parentheses" in attrs["metronome"]:
                                    Severity: Major
                                    Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                          if "font-family" in attrs["metronome"]:
                                                              data["direction"].font = attrs[
                                                                  "metronome"]["font-family"]
                                                          if "font-size" in attrs["metronome"]:
                                      Severity: Major
                                      Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language