Godley/Music-Library

View on GitHub
implementation/primaries/ExtractMetadata/classes/MetaParser.py

Summary

Maintainability
C
7 hrs
Test Coverage

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

    def collate_parts(self):
        instrument_list = []
        keys = ["key", "clef"]
        for part in self.parts:
            data = {}
Severity: Minor
Found in implementation/primaries/ExtractMetadata/classes/MetaParser.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 handleTransposition has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def handleTransposition(tags, attrs, chars, parts, data):
Severity: Minor
Found in implementation/primaries/ExtractMetadata/classes/MetaParser.py - About 35 mins to fix

    Function create_elem has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def create_elem(chars, key1, key2, cast1=int, cast2=str):
    Severity: Minor
    Found in implementation/primaries/ExtractMetadata/classes/MetaParser.py - About 35 mins to fix

      Function handleMeter has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def handleMeter(tags, attrs, chars, parts, data):
      Severity: Minor
      Found in implementation/primaries/ExtractMetadata/classes/MetaParser.py - About 35 mins to fix

        Function handle_clef_or_key has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def handle_clef_or_key(tags, attrs, chars, parts, data):
        Severity: Minor
        Found in implementation/primaries/ExtractMetadata/classes/MetaParser.py - About 35 mins to fix

          Function handleBibliography has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def handleBibliography(tags, attrs, chars, parts, data):
          Severity: Minor
          Found in implementation/primaries/ExtractMetadata/classes/MetaParser.py - About 35 mins to fix

            Function make_new_part has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def make_new_part(tags, attrs, chars, parts, data):
            Severity: Minor
            Found in implementation/primaries/ExtractMetadata/classes/MetaParser.py - About 35 mins to fix

              Function handle_tempo has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def handle_tempo(tags, attrs, chars, parts, data):
              Severity: Minor
              Found in implementation/primaries/ExtractMetadata/classes/MetaParser.py - About 35 mins to fix

                Function make_new_part has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def make_new_part(tags, attrs, chars, parts, data):
                    """
                    handler which works with anything inside the score-part tag, which creates a new part inside the data dict
                    :param tags: current list of xml tags
                    :param attrs: current dict of attribs
                Severity: Minor
                Found in implementation/primaries/ExtractMetadata/classes/MetaParser.py - About 35 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 handle_beat_unit_dot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def handle_beat_unit_dot(list_of_dicts, tag):
                    if tag == "beat-unit-dot":
                        copy_of_dict = copy.deepcopy(list_of_dicts)
                        if len(copy_of_dict) > 0:
                            if "beat_2" in copy_of_dict[-1]:
                Severity: Minor
                Found in implementation/primaries/ExtractMetadata/classes/MetaParser.py - About 35 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 handleMeter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def handleMeter(tags, attrs, chars, parts, data):
                    data.setdefault("time_signatures", [])
                
                    if tags[-1] != "time" and "time" in tags:
                        elem = create_elem(chars, "beats", "beat-type", cast2=int)
                Severity: Minor
                Found in implementation/primaries/ExtractMetadata/classes/MetaParser.py - About 25 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 handleTransposition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def handleTransposition(tags, attrs, chars, parts, data):
                    id = helpers.GetID(attrs, "part", "id")
                    if id is not None:
                        init_kv(parts, id, init_value={})
                        init_kv(parts[id], "transposition", init_value={})
                Severity: Minor
                Found in implementation/primaries/ExtractMetadata/classes/MetaParser.py - About 25 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 handleBibliography has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def handleBibliography(tags, attrs, chars, parts, data):
                    if tags[-1] == "creator":
                        creator_type = helpers.GetID(attrs, "creator", "type")
                        if creator_type is not None:
                            init_kv(data, creator_type, init_value="")
                Severity: Minor
                Found in implementation/primaries/ExtractMetadata/classes/MetaParser.py - About 25 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

                Line too long (110 > 79 characters)
                Open

                    handler which works with anything inside the score-part tag, which creates a new part inside the data dict

                Limit all lines to a maximum of 79 characters.

                There are still many devices around that are limited to 80 character
                lines; plus, limiting windows to 80 characters makes it possible to
                have several windows side-by-side.  The default wrapping on such
                devices looks ugly.  Therefore, please limit all lines to a maximum
                of 79 characters. For flowing long blocks of text (docstrings or
                comments), limiting the length to 72 characters is recommended.
                
                Reports error E501.

                Line too long (84 > 79 characters)
                Open

                    select a return value from chars dictionary. Priority given to key 2 over key 1,

                Limit all lines to a maximum of 79 characters.

                There are still many devices around that are limited to 80 character
                lines; plus, limiting windows to 80 characters makes it possible to
                have several windows side-by-side.  The default wrapping on such
                devices looks ugly.  Therefore, please limit all lines to a maximum
                of 79 characters. For flowing long blocks of text (docstrings or
                comments), limiting the length to 72 characters is recommended.
                
                Reports error E501.

                Line too long (98 > 79 characters)
                Open

                from implementation.primaries.ExtractMetadata.classes.helpers import combine_dictionaries, init_kv

                Limit all lines to a maximum of 79 characters.

                There are still many devices around that are limited to 80 character
                lines; plus, limiting windows to 80 characters makes it possible to
                have several windows side-by-side.  The default wrapping on such
                devices looks ugly.  Therefore, please limit all lines to a maximum
                of 79 characters. For flowing long blocks of text (docstrings or
                comments), limiting the length to 72 characters is recommended.
                
                Reports error E501.

                Line too long (84 > 79 characters)
                Open

                    Method to check if a dictionary is empty, or if it's last entry contains the tag

                Limit all lines to a maximum of 79 characters.

                There are still many devices around that are limited to 80 character
                lines; plus, limiting windows to 80 characters makes it possible to
                have several windows side-by-side.  The default wrapping on such
                devices looks ugly.  Therefore, please limit all lines to a maximum
                of 79 characters. For flowing long blocks of text (docstrings or
                comments), limiting the length to 72 characters is recommended.
                
                Reports error E501.

                Line too long (82 > 79 characters)
                Open

                    both are cast to whatever value we need. Used by clef and key handlers as both

                Limit all lines to a maximum of 79 characters.

                There are still many devices around that are limited to 80 character
                lines; plus, limiting windows to 80 characters makes it possible to
                have several windows side-by-side.  The default wrapping on such
                devices looks ugly.  Therefore, please limit all lines to a maximum
                of 79 characters. For flowing long blocks of text (docstrings or
                comments), limiting the length to 72 characters is recommended.
                
                Reports error E501.

                Line too long (87 > 79 characters)
                Open

                    need the first element, then the second, and both happen to be format int then str.

                Limit all lines to a maximum of 79 characters.

                There are still many devices around that are limited to 80 character
                lines; plus, limiting windows to 80 characters makes it possible to
                have several windows side-by-side.  The default wrapping on such
                devices looks ugly.  Therefore, please limit all lines to a maximum
                of 79 characters. For flowing long blocks of text (docstrings or
                comments), limiting the length to 72 characters is recommended.
                
                Reports error E501.

                Line too long (92 > 79 characters)
                Open

                    add it. Used by clef and key creation queries, might be used by other handlers in future

                Limit all lines to a maximum of 79 characters.

                There are still many devices around that are limited to 80 character
                lines; plus, limiting windows to 80 characters makes it possible to
                have several windows side-by-side.  The default wrapping on such
                devices looks ugly.  Therefore, please limit all lines to a maximum
                of 79 characters. For flowing long blocks of text (docstrings or
                comments), limiting the length to 72 characters is recommended.
                
                Reports error E501.

                Line too long (92 > 79 characters)
                Open

                from implementation.primaries.ExtractMetadata.classes.DataLayer.helpers import get_if_exists

                Limit all lines to a maximum of 79 characters.

                There are still many devices around that are limited to 80 character
                lines; plus, limiting windows to 80 characters makes it possible to
                have several windows side-by-side.  The default wrapping on such
                devices looks ugly.  Therefore, please limit all lines to a maximum
                of 79 characters. For flowing long blocks of text (docstrings or
                comments), limiting the length to 72 characters is recommended.
                
                Reports error E501.

                Line too long (81 > 79 characters)
                Open

                    :return: string of instrument name and a dict so the part dict can be updated

                Limit all lines to a maximum of 79 characters.

                There are still many devices around that are limited to 80 character
                lines; plus, limiting windows to 80 characters makes it possible to
                have several windows side-by-side.  The default wrapping on such
                devices looks ugly.  Therefore, please limit all lines to a maximum
                of 79 characters. For flowing long blocks of text (docstrings or
                comments), limiting the length to 72 characters is recommended.
                
                Reports error E501.

                There are no issues that match your filters.

                Category
                Status