QutBioacoustics/baw-server

View on GitHub

Showing 213 of 257 total issues

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/gems/baw-audio-tools/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/gems/baw-audio-tools/lib/baw_audio_tools/audio_base.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/gems/baw-audio-tools/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/gems/baw-audio-tools/lib/baw_audio_tools/audio_base.rb - About 35 mins to fix

          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/gems/baw-audio-tools/lib/baw_audio_tools/audio_base.rb - About 35 mins to fix

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

                    def initialize(original_store, analysis_cache, logger, dir_worker_top, dir_programs)
            Severity: Minor
            Found in lib/gems/baw-workers/lib/baw_workers/jobs/analysis/runner.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/gems/baw-audio-tools/lib/baw_audio_tools/audio_shntool.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/gems/baw-audio-tools/lib/baw_audio_tools/spectrogram.rb - About 35 mins to fix

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

                    def self.filter_settings
                      {
                        valid_fields: [:id, :name, :description, :notes, :creator_id,
                                       :created_at, :updater_id, :updated_at, :deleter_id, :deleted_at, :region_id],
                        render_fields: [:id, :name, :description, :notes, :creator_id,
                  Severity: Minor
                  Found in app/models/site.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 do_get_opts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def do_get_opts
                        # normalize params and get access to rails request instance
                        allowed_params = params.slice(:analysis_job_id, :audio_recording_id, :results_path, :format).permit!.to_h
                        request_params = CleanParams.perform(allowed_params)
                  
                  
                  Severity: Minor
                  Found in app/modules/api/analysis_jobs_items_shared.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 deep_map_internal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def deep_map_internal(value, context, &block)
                      case value
                      when ::Hash
                        result = value.class.new
                        value.each do |key, item|
                  Severity: Minor
                  Found in lib/gems/baw-app/lib/patches/hash.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 update_status_params_check has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def update_status_params_check
                      opts = { error_info: { audio_recording_id: params[:id] } }
                  
                      if @audio_recording.blank?
                        respond_error(
                  Severity: Minor
                  Found in app/controllers/audio_recordings_controller.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def update
                      do_load_resource
                      do_authorize_instance
                  
                      the_params = user_update_params.dup
                  Severity: Minor
                  Found in app/controllers/user_accounts_controller.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 make_site_annotations_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def make_site_annotations_path(project_value, site_value)
                        project_id = project_value.is_a?(Project) ? project_value.id : project_value.to_i
                        site_id = site_value.is_a?(Site) ? site_value.id : site_value.to_i
                        site_tz = site_value.is_a?(Site) && !site_value.rails_tz.blank? ? site_value.rails_tz : 'UTC'
                        data_request_path(selected_project_id: project_id, selected_site_id: site_id, selected_timezone_name: site_tz)
                  Severity: Minor
                  Found in app/modules/api/custom_url_helpers.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 validate_level_combination has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def validate_level_combination(levels)
                          if levels.respond_to?(:each)
                            if (levels.include?(:none) || levels.include?('none')) && levels.size > 1
                              # none cannot be with other levels because this can be ambiguous, and points to a problem with how the
                              # permissions were obtained.
                  Severity: Minor
                  Found in app/modules/access/core.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 validate_name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def validate_name(name, allowed)
                        raise CustomErrors::FilterArgumentError, "Name must not be null, got #{name}" if name.blank?
                        raise CustomErrors::FilterArgumentError, "Name must be a symbol, got #{name}" unless name.is_a?(Symbol)
                        raise CustomErrors::FilterArgumentError, "Allowed must be an Array, got #{allowed}" unless allowed.is_a?(Array)
                        raise CustomErrors::FilterArgumentError, "Name must be in #{allowed}, got #{name}" unless allowed.include?(name)
                  Severity: Minor
                  Found in app/modules/filter/validate.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 validate_hash_key has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def validate_hash_key(hash, key, value_types)
                        raise CustomErrors::FilterArgumentError, "Hash must include key #{key}." unless hash.include?(key)
                  
                        value_types_normalised = [value_types].flatten
                        value = hash[key]
                  Severity: Minor
                  Found in app/modules/filter/validate.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 get_project_if_exists has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def get_project_if_exists(for_list_endpoint: false)
                      return unless params.key?(:project_id)
                  
                      @project = Project.find(params[:project_id])
                  
                  
                  Severity: Minor
                  Found in app/controllers/harvests_controller.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 filter_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.filter_settings(priority_algorithm = nil)
                      result = {
                        valid_fields: [
                          :id, :dataset_id, :audio_recording_id, :start_time_seconds,
                          :end_time_seconds, :order, :creator_id, :created_at, :priority
                  Severity: Minor
                  Found in app/models/dataset_item.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/gems/baw-audio-tools/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

                  Severity
                  Category
                  Status
                  Source
                  Language