QutBioacoustics/baw-audio-tools

View on GitHub

Showing 51 of 57 total issues

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

    def arg_offsets(start_offset, end_offset)
      cmd_arg = ''

      # start offset
      # -ss Seek to given time position in seconds. hh:mm:ss[.xxx] syntax is also supported.
Severity: Minor
Found in lib/baw-audio-tools/audio_ffmpeg.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 arg_offsets has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def arg_offsets(start_offset, end_offset)
      # Cuts portions out of the audio. Any number of positions may be given; audio is not sent
      # to the output until the first position is reached. The effect then alternates between
      # copying and discarding audio at each position.

Severity: Minor
Found in lib/baw-audio-tools/audio_sox.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 arg_offsets has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def arg_offsets(start_offset, end_offset)
      cmd_arg = ''

      unless start_offset.blank?
        start_offset_formatted = Time.at(start_offset.to_f).utc.strftime('%H:%M:%S.%2N')
Severity: Minor
Found in lib/baw-audio-tools/audio_shntool.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 info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def info(source)
      fail ArgumentError, "Source is not a wac file: #{source}" unless source.match(/\.wac$/)
      fail Exceptions::AudioFileNotFoundError, "Could not find #{source}." unless File.exist?(source)

      # WAac header format:
Severity: Minor
Found in lib/baw-audio-tools/audio_wac2wav.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

Avoid too many return statements within this method.
Open

      return nil if hash[:description].starts_with?('max_analyze_duration')
Severity: Major
Found in lib/baw-audio-tools/audio_ffmpeg.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return nil if hash[:description].starts_with?('parser not found for')
    Severity: Major
    Found in lib/baw-audio-tools/audio_ffmpeg.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return nil if hash[:description].starts_with?('Application provided invalid, non monotonically increasing dts to muxer in stream')
      Severity: Major
      Found in lib/baw-audio-tools/audio_ffmpeg.rb - About 30 mins to fix

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

            def modify_command(source, target)
              fail ArgumentError, "Source is not a png file: #{source}" unless source.match(/\.png/)
              fail ArgumentError, "Target is not a png file: : #{target}" unless target.match(/\.png/)
              fail Exceptions::FileNotFoundError, "Source does not exist: #{source}" unless File.exists? source
              # target will probably already exist, coz we're overwriting the image
        Severity: Minor
        Found in lib/baw-audio-tools/image_image_magick.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

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

            def arg_colour(colour)
              cmd_arg = ''
              colours_available = AudioSox.colour_options.map { |k, v| "#{k} (#{v})" }.join(', ')
              colour_param = ''
        
        
        Severity: Minor
        Found in lib/baw-audio-tools/audio_sox.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

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

            def info(source)
              fail Exceptions::FileNotFoundError, "Source does not exist: #{source}" unless File.exists? source
              fail Exceptions::FileEmptyError, "Source exists, but has no content: #{source}" if File.size(source) < 1
        
              if File.extname(source) == '.wac'
        Severity: Minor
        Found in lib/baw-audio-tools/audio_base.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

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

            def parse_ffprobe_output(source, execute_msg)
              # ffprobe std err contains info (separate on first equals(=))
        
              result = {}
              ffprobe_current_block_name = ''
        Severity: Minor
        Found in lib/baw-audio-tools/audio_ffmpeg.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