Showing 15 of 19 total issues
Method todays_stats
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def self.todays_stats(user)
stats = JobStat.minutely_today(user).order(created_at: :asc)
total_jobs_array = stats.collect { |stat| stat.total_jobs || 0 }
enabled_jobs_array = stats.collect { |stat| stat.total_enabled || 0 }
run_jobs_array = stats.collect { |stat| stat.runs || 0 }
- 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 find_jobs
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def self.find_jobs(user, occur_start, occur_end, tags, incexc, enabled, succeeded, running, name, timezone, command)
search = Job.mine(user)
search = search.enabled(enabled) unless enabled.nil?
search = search.running(running) unless running.nil?
search = search.successful(succeeded) unless succeeded.nil?
- 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
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def update
@job.name = params[:name] unless (@job.name == params[:name]) || params[:name].blank?
@job.cron = params[:cron] unless (@job.cron == params[:cron]) || params[:cron].blank?
@job.command = params[:command] unless (@job.command == params[:command]) || params[:command].blank?
@job.timezone = params[:timezone] unless (@job.timezone == params[:timezone]) || params[:timezone].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 search_jobs
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.search_jobs(user, expression)
tags = nil
enabled = nil
succeeded = nil
running = nil
Method todays_stats
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.todays_stats(user)
stats = JobStat.minutely_today(user).order(created_at: :asc)
total_jobs_array = stats.collect { |stat| stat.total_jobs || 0 }
enabled_jobs_array = stats.collect { |stat| stat.total_enabled || 0 }
run_jobs_array = stats.collect { |stat| stat.runs || 0 }
Method find_jobs
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.find_jobs(user, occur_start, occur_end, tags, incexc, enabled, succeeded, running, name, timezone, command)
Method search_jobs
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.search_jobs(user, expression)
tags = nil
enabled = nil
succeeded = nil
running = nil
- 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 filter_runs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def filter_runs(start_dt, end_dt, success)
start_dt = Chronic.parse(start_dt) unless start_dt.blank?
end_dt = Chronic.parse(end_dt) unless end_dt.blank?
query = job_runs
- 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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update
@folder.name = params[:name] unless (@folder.name == params[:name]) || params[:name].blank?
@folder.expression = params[:expression] unless (@folder.expression == params[:expression]) || params[:expression].blank?
@folder.save!
message I18n.t('folders.messages.updated', id: @folder.id), :ok, false, @folder, 'folder'
- 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 stop_job
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def stop_job(run, return_code, success, error_message, stdout, stderr)
Method message
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def message(message, status, is_error = false, object = {}, object_type = '')
Method update_run
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_run(return_code, success, error_message, stdout, stderr)
Method iterate_over_ranges
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def iterate_over_ranges(user, period, stat_start_dt, time_incr, end_dt)
Method compute_run_stats
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compute_run_stats
job_runtimes = JobRun.job_runtimes(id)
avg_runtime = JobRun.avg_runtime_for_job(id)
max_runtime = JobRun.max_runtime_for_job(id)
- 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_run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_run(return_code, success, error_message, stdout, stderr)
self.success = success
self.return_code = return_code
self.error_message = error_message
self.stdout = stdout.nil? ? '' : stdout.encode('UTF-8', invalid: :replace, undef: :replace)
- 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"