Godley/MuseParse

View on GitHub

Showing 228 of 691 total issues

Function __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, **kwargs):
        self.wrapped = True
        BaseClass.Base.__init__(self)
        if "type" in kwargs:
            if kwargs["type"] is not None:
Severity: Minor
Found in MuseParse/classes/ObjectHierarchy/ItemClasses/Note.py - About 55 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 toLily has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def toLily(self):
        val = ""
        if hasattr(self, "type"):
            if self.type == "subtract":
                val += "no "
Severity: Minor
Found in MuseParse/classes/ObjectHierarchy/ItemClasses/Harmony.py - About 55 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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, **kwargs):
        BaseClass.Base.__init__(self)
        if "title" in kwargs:
            if kwargs["title"] is not None:
                self.title = kwargs["title"]
Severity: Minor
Found in MuseParse/classes/ObjectHierarchy/ItemClasses/Meta.py - About 55 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["frame_note"] is None:
                        data["frame_note"] = Harmony.FrameNote()

Severity: Major
Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

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

      Avoid deeply nested control flow statements.
      Open

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

        Avoid deeply nested control flow statements.
        Open

                                if previous * 2 == value:
                                    result += "."
                                if previous == value:
        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(piece.GetItem().meta, "copyright"):
                                  piece.GetItem().meta.copyright = ""
                              piece.GetItem().meta.copyright += rights
          Severity: Major
          Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

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

              Avoid deeply nested control flow statements.
              Open

                                  if "halign" in attrib["kind"]:
                                      kind.halign = attrib["kind"]["halign"]
                                  if "parenthesis-degrees" 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 "dalsegno" in attrs["sound"]:
                                        measure.dalsegno = attrs["sound"]["dalsegno"]
                                    if "fine" 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 "font-size" in temp:
                                          size = float(temp["font-size"])
                                      if "justify" in temp:
                  Severity: Major
                  Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if "first-fret" in content:
                                            if "first-fret" not in attrib:
                                                data["direction"].frame.firstFret = [
                                                    content["first-fret"]]
                                            else:
                    Severity: Major
                    Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if "parentheses" in attrs["metronome"]:
                                              data["direction"].parentheses = YesNoToBool(
                                                  attrs["metronome"]["parentheses"])
                                  if tags[-1] == "per-minute":
                      Severity: Major
                      Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if "justify" in temp:
                                                justify = temp["justify"]
                                                if justify == "center" and data["handleType"] == "":
                                                    data["handleType"] = "title"
                                                if justify == "right" and data["handleType"] == "":
                        Severity: Major
                        Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  for c in children:
                                                      child = placeholder.GetChild(c)
                                                      if child.GetItem(
                                                      ).__class__.__name__ == OctaveShift.__name__:
                                                          i = placeholder.PopChild(c)
                          Severity: Major
                          Found in MuseParse/classes/ObjectHierarchy/TreeClasses/MeasureNode.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if counter == index:
                                                    return node.GetChild(child)
                                            if isinstance(result, cls_type):
                            Severity: Major
                            Found in MuseParse/classes/ObjectHierarchy/TreeClasses/BaseTree.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if data["handleType"] == "title":
                                                      if not hasattr(piece.GetItem().meta, "title"):
                                                          piece.GetItem().meta.title = 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 not isinstance(node, NoteNode.Placeholder):
                                                            self.index += 1
                                                else:
                                Severity: Major
                                Found in MuseParse/classes/ObjectHierarchy/TreeClasses/MeasureNode.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if "strong-accent" in attrs:
                                                          if "type" in attrs["strong-accent"]:
                                                              s_type = attrs["strong-accent"]["type"]
                                                      accent = Mark.StrongAccent(type=s_type)
                                  Severity: Major
                                  Found in MuseParse/classes/Input/MxmlParser.py - About 45 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language