QutBioacoustics/baw-audio-tools

View on GitHub

Showing 51 of 57 total issues

Method clipping_check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def clipping_check(source, info_flattened)
      # check for clipping, zero signal
      # only if duration less than 4 minutes
      four_minutes_in_sec = 4.0 * 60.0
      if (info_flattened[:media_type] == 'audio/wav' ||
Severity: Minor
Found in lib/baw-audio-tools/audio_base.rb - 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

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

    def modify_command(source, source_info, target, start_offset = nil, end_offset = nil)
      fail ArgumentError, "Source is not a mp3 file: #{source}" unless source.match(/\.mp3$/)
      fail ArgumentError, "Target is not a mp3 file: : #{target}" unless target.match(/\.mp3$/)
      fail Exceptions::FileNotFoundError, "Source does not exist: #{source}" unless File.exists? source
      fail Exceptions::FileAlreadyExistsError, "Target exists: #{target}" if File.exists? target
Severity: Minor
Found in lib/baw-audio-tools/audio_mp3splt.rb - 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

Method modify_command has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def modify_command(source, source_info, target, start_offset = nil, end_offset = nil, channel = nil, sample_rate = nil)
Severity: Major
Found in lib/baw-audio-tools/audio_sox.rb - About 50 mins to fix

    Method modify_command has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def modify_command(source, source_info, target, start_offset = nil, end_offset = nil, channel = nil, sample_rate = nil)
    Severity: Major
    Found in lib/baw-audio-tools/audio_ffmpeg.rb - About 50 mins to fix

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

          def arg_scale(scale)
            # -d [ --db-scale ] use logarithmic (e.g. decibel) scale instead of linear scale
            cmd_arg = ''
            all_scale_options = AudioWaveform.scale_options.join(', ')
      
      
      Severity: Minor
      Found in lib/baw-audio-tools/audio_waveform.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 modify_command has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def modify_command(source, source_info, target, start_offset = nil, end_offset = nil, channel = nil, sample_rate = nil)
            fail ArgumentError, "Source is not a wav file: #{source}" unless source.match(/\.wav$/)
            fail ArgumentError, "Target is not a wav file: : #{target}" unless target.match(/\.wav$/)
            fail Exceptions::FileNotFoundError, "Source does not exist: #{source}" unless File.exists? source
            fail Exceptions::FileAlreadyExistsError, "Target exists: #{target}" if File.exists? target
      Severity: Minor
      Found in lib/baw-audio-tools/audio_sox.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 audio_tool_segment has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def audio_tool_segment(extension, audio_tool_method, source, source_info, target, modify_parameters)
      Severity: Minor
      Found in lib/baw-audio-tools/audio_base.rb - About 45 mins to fix

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

            def command(source, source_info, target,
                        width = 1800, height = 280,
                        colour_bg = 'efefefff', colour_fg = '00000000',
                        scale = :linear,
                        db_min = -48, db_max = 0)
        Severity: Minor
        Found in lib/baw-audio-tools/audio_waveform.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 spectrogram_command has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def spectrogram_command(source, source_info, target, start_offset = nil, end_offset = nil, channel = nil, sample_rate = nil,
                                    window = nil, window_function = nil, colour = nil)
              fail ArgumentError, "Source is not a wav file: #{source}" unless source.match(/\.wav$/)
              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
        Severity: Minor
        Found in lib/baw-audio-tools/audio_sox.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 modify_command has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def modify_command(source, target)
              fail ArgumentError, "Source is not a wac file: #{source}" unless source.match(/\.wac$/)
              fail ArgumentError, "Target is not a wav file: : #{target}" unless target.match(/\.wav$/)
              fail Exceptions::FileNotFoundError, "Source does not exist: #{source}" unless File.exists? source
              fail Exceptions::FileAlreadyExistsError, "Target exists: #{target}" if File.exists? target
        Severity: Minor
        Found in lib/baw-audio-tools/audio_wac2wav.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def initialize(audio_defaults, logger, temp_dir, run_program, opts = {})
        Severity: Minor
        Found in lib/baw-audio-tools/audio_base.rb - About 35 mins to fix

          Method modify_command has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def modify_command(source, source_info, target, start_offset = nil, end_offset = nil)
          Severity: Minor
          Found in lib/baw-audio-tools/audio_wavpack.rb - About 35 mins to fix

            Method modify_wavpack has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def modify_wavpack(source, source_info, target, start_offset, end_offset)
            Severity: Minor
            Found in lib/baw-audio-tools/audio_base.rb - About 35 mins to fix

              Method read_to_stream has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def read_to_stream(stdout, stderr, output, error, options)
              Severity: Minor
              Found in lib/baw-audio-tools/run_external_program.rb - About 35 mins to fix

                Method modify_command has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def modify_command(source, source_info, target, start_offset = nil, end_offset = nil)
                Severity: Minor
                Found in lib/baw-audio-tools/audio_mp3splt.rb - About 35 mins to fix

                  Method from_executables has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def self.from_executables(audio_defaults, logger, temp_dir, timeout_sec, opts = {})
                  Severity: Minor
                  Found in lib/baw-audio-tools/audio_base.rb - About 35 mins to fix

                    Method modify_mp3splt has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def modify_mp3splt(source, source_info, target, start_offset, end_offset)
                    Severity: Minor
                    Found in lib/baw-audio-tools/audio_base.rb - About 35 mins to fix

                      Method from_executables has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def self.from_executables(audio_master, im_convert_exe, im_identify_exe, spectrogram_defaults, temp_dir)
                      Severity: Minor
                      Found in lib/baw-audio-tools/spectrogram.rb - About 35 mins to fix

                        Method modify_command has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def modify_command(source, source_info, target, start_offset = nil, end_offset = nil)
                        Severity: Minor
                        Found in lib/baw-audio-tools/audio_shntool.rb - About 35 mins to fix

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

                              def check_integrity_item(hash)
                                return nil if hash.blank?
                          
                                return nil if hash[:id].starts_with?('graph')
                                return nil if hash[:id].starts_with?('audio format')
                          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

                          Severity
                          Category
                          Status
                          Source
                          Language