Showing 75 of 86 total issues
Method execute
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(prepared_opts, opts)
BawWorkers::Validation.check_custom_hash(prepared_opts, BawWorkers::Analysis::Payload::COMMAND_PLACEHOLDERS)
BawWorkers::Validation.check_custom_hash(opts, BawWorkers::Analysis::Payload::OPTS_FIELDS)
BawWorkers::Analysis::Runner.check_command_format(opts)
Method action_perform
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def action_perform(analysis_params)
analysis_params_sym = BawWorkers::Analysis::Payload.normalise_opts(analysis_params)
BawWorkers::Config.logger_worker.info(logger_name) {
"Started analysis using '#{format_params_for_log(analysis_params_sym)}'."
Method action_perform
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def action_perform(analysis_params)
analysis_params_sym = BawWorkers::Analysis::Payload.normalise_opts(analysis_params)
BawWorkers::Config.logger_worker.info(logger_name) {
"Started analysis using '#{format_params_for_log(analysis_params_sym)}'."
- Read upRead up
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 run
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def run(audio_params, is_real_run)
# validate params
audio_params_sym = BawWorkers::AudioCheck::WorkHelper.validate(audio_params)
if is_real_run
- Read upRead up
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 error_notification
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def error_notification(to, from, job, error)
fail ArgumentError, "Error is not a ruby error object #{error.inspect}." unless error.is_a?(StandardError)
fail ArgumentError, "From is not a string #{from.inspect}." unless from.is_a?(String)
fail ArgumentError, "To is not a string or Array #{to.inspect}." unless (to.is_a?(String) || to.is_a?(Array))
fail ArgumentError, "Job is not a hash #{job.inspect}." unless job.is_a?(Hash)
Method compare_csv_db
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def compare_csv_db(csv_file)
original_audio = BawWorkers::Config.original_audio_helper
# gather all existing files
files = []
Method process
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def process(path, top_dir, recurse = true)
dirs = []
results = []
path = File.expand_path(path)
- Read upRead up
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_path
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def normalise_path(path, top_level_dir = nil)
path = '' if path.nil?
# first replace '..', '~', '//', '\\', '/./', '\.\'
# ensure no double or more slashes
- Read upRead up
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_analysis_jobs_item_status
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_analysis_jobs_item_status(analysis_job_id, audio_recording_id, status, security_info)
approved_statuses = [:working, :successful, :failed, :timed_out, :cancelled]
raise "Cannot set status to `#{status}`" unless approved_statuses.include?(status)
Method parse_file_path
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_file_path(file_path)
file_name = File.basename(file_path)
file_name_split = file_name.split('_')
Method compare_info
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def compare_info(existing_file, existing_file_info, audio_params)
correct = :pass
wrong = :fail
bit_rate_bps_delta = 10000 # due to difference for asf files of 1300-2000 bps (set large to catch only very different bit rates)
Method rename_file
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def rename_file(existing_file, file_name_utc, is_real_run)
# create all needed information
existing_path = existing_file
existing_name = File.basename(existing_path)
- Read upRead up
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_analysis_jobs_item_status
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_analysis_jobs_item_status(analysis_job_id, audio_recording_id, status, security_info)
approved_statuses = [:working, :successful, :failed, :timed_out, :cancelled]
raise "Cannot set status to `#{status}`" unless approved_statuses.include?(status)
- Read upRead up
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_folder_settings
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_folder_settings(file)
unless File.file?(file)
@logger.debug(@class_name) { "Harvest directory config file was not found '#{file}'." }
return {}
end
Method rename_file
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rename_file(existing_file, file_name_utc, is_real_run)
# create all needed information
existing_path = existing_file
existing_name = File.basename(existing_path)
Method action_summary
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def action_summary(results)
base_path = Pathname.new(results[:path])
files = results[:results]
BawWorkers::Config.logger_worker.debug(self.name) {
Method process
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process(path, top_dir, recurse = true)
dirs = []
results = []
path = File.expand_path(path)
Method request_login
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request_login
login_response = send_request('Login request', :post, host, port, endpoint_login, nil, {email: user, password: password})
# get cookies
# from http://stackoverflow.com/a/9320190/31567
Method validate_job_id
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_job_id(opts)
provided = validate_msg_provided(opts)
fail ArgumentError, "#{validate_msg_base} job_id. #{provided}" unless opts.include? :job_id
fail ArgumentError, "job_id must not be blank. #{provided}" if opts[:job_id].blank?
- Read upRead up
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 resolve
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def resolve(payload)
return payload unless payload.is_a?(Hash)
has_string = payload.has_key?(PARTIAL_PAYLOAD_KEY)
has_symbol = payload.has_key?(PARTIAL_PAYLOAD_KEY.to_sym)
- Read upRead up
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"