krists/id3tag

View on GitHub

Showing 7 of 7 total issues

Class BasicFrame has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

      class BasicFrame
        DECOMPRESSED_SIZE_BYTE_COUNT = 4
        GROUP_BYTE_COUNT = 1

        attr_reader :id, :raw_content
Severity: Minor
Found in lib/id3tag/frames/v2/basic_frame.rb - About 2 hrs to fix

    Method split_by_null_byte has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.split_by_null_byte(string)
          null_byte_found = false
          has_skipped = false
          before, after = [], []
          string.each_byte do |byte|
    Severity: Minor
    Found in lib/id3tag/string_util.rb - About 1 hr 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

    Method frame_class has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def frame_class
              case @id
              when /^(TCON|TCO)$/
                GenreFrame
              when /^TXX/
    Severity: Minor
    Found in lib/id3tag/frames/v2/frame_fabricator.rb - About 1 hr to fix

      Method mime_type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def mime_type
                if @major_version_number > 2
                  result = parts[:mime_type]
                  if StringUtil.blank?(result.strip)
                    IMPLIED_MIME_TYPE
      Severity: Minor
      Found in lib/id3tag/frames/v2/picture_frame.rb - 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

      Method v2_tag_body has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def v2_tag_body
            if v2_tag_size > 0
              @file.seek(v2_tag_frame_and_padding_position)
              bytes_to_read = v2_tag_frame_and_padding_size
              return BLANK_STRING if bytes_to_read < 0
      Severity: Minor
      Found in lib/id3tag/audio_file.rb - 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

      Method remove has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def remove
            prev_byte = nil
            loop do
              current_byte = input_bytes.next
              next_byte = input_bytes.peek rescue nil
      Severity: Minor
      Found in lib/id3tag/unsynchronization.rb - 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

      Method find_position_and_length_for_additional_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def find_position_and_length_for_additional_info(*methods_of_interest)
                start_position = 0
                target_info_byte_count = nil
                additional_info_flags_in_effect.map do |query_method, byte_count|
                  start_position += (byte_count) unless methods_of_interest.include?(query_method)
      Severity: Minor
      Found in lib/id3tag/frames/v2/frame_flags.rb - 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

      Severity
      Category
      Status
      Source
      Language