Godley/MuseParse

View on GitHub

Showing 228 of 691 total issues

File BaseTree.py has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class CannotAddToTreeException(BaseException):

    '''error in tree addition!'''


Severity: Minor
Found in MuseParse/classes/ObjectHierarchy/TreeClasses/BaseTree.py - About 3 hrs to fix

    Function handleTimeMod has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def handleTimeMod(tags, attrs, chars, piece, data):
        if "notations" in tags:
            if tags[-1] == "tuplet":
                type = None
                bracket = None
    Severity: Minor
    Found in MuseParse/classes/Input/MxmlParser.py - About 2 hrs 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 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, **kwargs):
            font = None
            size = None
            text = None
            if "font" in kwargs:
    Severity: Minor
    Found in MuseParse/classes/ObjectHierarchy/ItemClasses/Directions.py - About 2 hrs 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 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def toLily(self):
            '''
            Method which converts the object instance, its attributes and children to a string of lilypond code
    
            :return: str of lilypond code
    Severity: Minor
    Found in MuseParse/classes/ObjectHierarchy/TreeClasses/PartNode.py - About 2 hrs 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 CheckDynamics has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def CheckDynamics(tag):
        return_val = False
        dmark = ["p", "f"]
        if len(tag) == 1 and tag in dmark:
            return_val = True
    Severity: Minor
    Found in MuseParse/classes/Input/MxmlParser.py - About 2 hrs 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 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def toLily(self):
            val = ""
            if not hasattr(self, "step"):
                val += "c"
            else:
    Severity: Minor
    Found in MuseParse/classes/ObjectHierarchy/ItemClasses/Note.py - About 2 hrs 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 HandleArpeggiates has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def HandleArpeggiates(tags, attrs, content, piece, data):
        if len(tags) > 0:
            if tags[-1] == "arpeggiate":
                data["direction"] = None
                if "arpeggiate" in attrs:
    Severity: Minor
    Found in MuseParse/classes/Input/MxmlParser.py - About 2 hrs 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 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def toLily(self):
            '''
            Method which converts the object instance, its attributes and children to a string of lilypond code
    
            :return: str of lilypond code
    Severity: Minor
    Found in MuseParse/classes/ObjectHierarchy/TreeClasses/MeasureNode.py - About 2 hrs 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 GetTotalValue has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def GetTotalValue(self):
            """Gets the total value of the bar according to it's time signature"""
            value = ""
            if hasattr(self, "meter"):
                top_value = self.meter.beats
    Severity: Minor
    Found in MuseParse/classes/ObjectHierarchy/TreeClasses/MeasureNode.py - About 2 hrs 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 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def toLily(self):
            '''
            Method which converts the object instance and its attributes to a string of lilypond code
    
            :return: str of lilypond code
    Severity: Minor
    Found in MuseParse/classes/ObjectHierarchy/ItemClasses/Directions.py - About 2 hrs 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

    PartNode has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PartNode(IndexedNode):
        """
        Class representing the node holding the part.
        """
    
    
    Severity: Minor
    Found in MuseParse/classes/ObjectHierarchy/TreeClasses/PartNode.py - About 2 hrs to fix

      Function NumbersToWords has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def NumbersToWords(number):
          """
          little function that converts numbers to words. This could be more efficient,
          and won't work if the number is bigger than 999 but it's for stave names,
          and I doubt any part would have more than 10 staves let alone 999.
      Severity: Minor
      Found in MuseParse/helpers.py - About 2 hrs 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 FindByIndex has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def FindByIndex(node, index):
          '''
          Method which finds child according to index. Applies only to nodes whose children are sorted into a dict,
          so if the current node's children are in a list it will recursively search - similarly if the index is not found
          in the current node's dictionary indexes.
      Severity: Minor
      Found in MuseParse/classes/ObjectHierarchy/TreeClasses/BaseTree.py - About 2 hrs 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 CopyDirectionsAndExpressions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def CopyDirectionsAndExpressions(self, v_obj):
              child = self.GetChildrenIndexes()[0]
              voice = self.GetChild(child)
              voice_notes = v_obj.GetChildrenIndexes()
              for n in voice_notes:
      Severity: Minor
      Found in MuseParse/classes/ObjectHierarchy/TreeClasses/MeasureNode.py - About 2 hrs 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 GetNotation has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def GetNotation(self, id, type):
              '''
              method which searches for notation from <type> list at position <id>
              :param id: the number to look for - i.e if you're looking for the first one in wrap notation, id will be 0
              :param type: post, pre or wrap
      Severity: Minor
      Found in MuseParse/classes/ObjectHierarchy/ItemClasses/Note.py - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def toLily(self):
              val = ""
              value = ""
              if hasattr(self, "print") and not self.print:
                  val += "\n\\hideNotes\n"
      Severity: Minor
      Found in MuseParse/classes/ObjectHierarchy/ItemClasses/Note.py - About 2 hrs 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 Backup has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def Backup(self, duration=0):
              '''
              method to use when a backup tag is encountered in musicXML. Moves back in the bar by <duration>
              :param duration:
              :return:
      Severity: Minor
      Found in MuseParse/classes/ObjectHierarchy/TreeClasses/MeasureNode.py - About 2 hrs 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 AddBarline has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def AddBarline(self, item=None, measure_id=1, location="left"):
              measure = self.GetChild(measure_id)
              if measure is None:
                  self.AddChild(MeasureNode.MeasureNode(), measure_id)
                  measure = self.GetChild(measure_id)
      Severity: Minor
      Found in MuseParse/classes/ObjectHierarchy/TreeClasses/StaffNode.py - About 2 hrs 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 CheckPreviousBarline has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def CheckPreviousBarline(self, staff):
              """method which checks the bar before the current for changes we need to make to it's barlines"""
              measure_before_last = self.getMeasureAtPosition(-2, staff)
              last_measure = self.getMeasureAtPosition(-1, staff)
              if last_measure is not None and measure_before_last is not None:
      Severity: Minor
      Found in MuseParse/classes/ObjectHierarchy/TreeClasses/PartNode.py - About 2 hrs 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 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, **kwargs):
              text = None
              size = None
              font = None
              type = None
      Severity: Minor
      Found in MuseParse/classes/ObjectHierarchy/ItemClasses/Directions.py - About 2 hrs 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