QutBioacoustics/baw-workers

View on GitHub

Showing 75 of 86 total issues

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

    def update_audio_recording_details(description, file_to_process, audio_recording_id, update_hash, security_info)
Severity: Minor
Found in lib/baw-workers/api_communicator.rb - About 35 mins to fix

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

        def create_new_audio_recording(file_to_process, project_id, site_id, audio_info_hash, security_info)
    Severity: Minor
    Found in lib/baw-workers/api_communicator.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/baw-workers/analysis/runner.rb - About 35 mins to fix

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

              def get_new_audio_recording(file_path, project_id, site_id, audio_info_hash, security_info)
        Severity: Minor
        Found in lib/baw-workers/harvest/single_file.rb - About 35 mins to fix

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

              def update_audio_recording_status(description, file_to_process, audio_recording_id, update_hash, security_info)
          Severity: Minor
          Found in lib/baw-workers/api_communicator.rb - About 35 mins to fix

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

                    def action_enqueue_rake(csv_file, is_real_run)
                      BawWorkers::Validation.normalise_file(csv_file)
            
                      successes = []
                      failures = []
            Severity: Minor
            Found in lib/baw-workers/audio_check/action.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 generate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def generate(klass, args = [])
            
                    # HACK: I don't know what this ever sorts, but it is important that it doesn't work - sometimes
                    args.map! do |arg|
                      if arg.is_a?(Hash) then
            Severity: Minor
            Found in lib/baw-workers/resque_job_id.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 action_gather_and_process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    def action_gather_and_process(to_do_path, is_real_run, copy_on_success = false)
                      gather_files = action_gather_files
                      file_hashes = gather_files.run(to_do_path)
            
                      results = {path: to_do_path, results: []}
            Severity: Minor
            Found in lib/baw-workers/harvest/action.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 format_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def self.format_command(opts, command_opts)
                    command_format = opts[:command_format].dup
            
                    command_placeholders = BawWorkers::Analysis::Runner.extract_command_placeholders(opts)
                    allowed_placeholders = BawWorkers::Analysis::Payload::COMMAND_PLACEHOLDERS
            Severity: Minor
            Found in lib/baw-workers/analysis/runner.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 get_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def get_config(raw_opts)
                    fail ArgumentError, 'Must provide only one of config_file or config_string.' if raw_opts[:config_file] && raw_opts[:config_string]
                    fail ArgumentError, 'Must provide one of config_file or config_string.' if !raw_opts[:config_file] && !raw_opts[:config_string]
            
                    return raw_opts[:config_string] if raw_opts[:config_string]
            Severity: Minor
            Found in lib/baw-workers/analysis/payload.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 rename_harvested_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def rename_harvested_file(file_path, storage_target_paths)
                    # rename file once it is copied to all destinations
                    source_size = File.size(file_path)
            
                    check_target_paths = storage_target_paths.select { |file| File.exists?(file) && File.file?(file) && File.size(file) == source_size }
            Severity: Minor
            Found in lib/baw-workers/harvest/single_file.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 normalise_datetime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def normalise_datetime(value)
                    fail ArgumentError, 'Expected value to be a ActiveSupport::TimeWithZone, got blank.' if value.blank?
            
                    return value if value.is_a?(ActiveSupport::TimeWithZone)
            
            
            Severity: Minor
            Found in lib/baw-workers/validation.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 validate_channel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def validate_channel(opts)
                    provided = validate_msg_provided(opts)
                    fail ArgumentError, "#{validate_msg_base} channel. #{provided}" unless opts.include? :channel
                    fail ArgumentError, "channel #{validate_msg_eq_or_gt} 0: #{opts[:channel]}. #{provided}" unless opts[:channel].to_i >= 0
                    fail ArgumentError, "channel must be an integer: #{opts[:channel]}. #{provided}" unless opts[:channel].to_i.to_s == opts[:channel].to_s
            Severity: Minor
            Found in lib/baw-workers/storage/common.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 action_run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    def action_run(harvest_params, is_real_run)
            
                      BawWorkers::Config.logger_worker.info(self.name) {
                        "Started harvest #{is_real_run ? 'real run' : 'dry run' } using '#{harvest_params}'."
                      }
            Severity: Minor
            Found in lib/baw-workers/harvest/action.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 decode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def decode(object)
                  return unless object
            
                  begin
                    if MultiJson.respond_to?(:dump) && MultiJson.respond_to?(:load)
            Severity: Minor
            Found in lib/baw-workers/redis_communicator.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