Showing 38 of 40 total issues
Method estimated_wait_time
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def estimated_wait_time(project_id)
@estimated_wait_time_last_check ||= []
@estimated_wait_time ||= []
if @estimated_wait_time_last_check[project_id].nil? or
@estimated_wait_time_last_check[project_id] < 48.hours.ago
- 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 create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create
user = User.find_by(email: params[:session][:email].downcase)
if user && user.authenticate(params[:session][:password])
if user.activated?
# Log the user in and redirect to the user's show page.
- 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 link_to_reference_dataset
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def link_to_reference_dataset(project, dataset_name)
pm = project.miga if project
ds_miga = pm.dataset(dataset_name) if pm
if ds_miga.nil?
content_tag(:del, dataset_name, title: 'Reference dataset removed')
- 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 result
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def result
qd = @query_dataset
m = qd.miga
res = m.result(params[:result])
if res.nil?
Method aai_novel
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def aai_novel(aai, project)
opts = {}
if project.miga && project.miga.metadata[:aai_p]
opts[:engine] = project.miga.metadata[:aai_p]
end
Method plot_assembly
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def plot_assembly(n50, len)
# Trace1: RefSeq genomes
trace1 = {
x: [298471,2240716,3402093,4653910,13033779],
type: "box",
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@user = User.find_by(id: params[:user_id])
par = project_params
par[:official] = false unless @user.admin?
@project = @user.projects.create(par)
Method display_data
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def display_data(obj, html_safe = false)
case obj
when Float
obj.round(2).to_s
when Array
- 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
Avoid deeply nested control flow statements. Open
if saved_cnt == 1
redirect_to @query_dataset
else
redirect_to project_query_datasets_url(@project)
end
Method create_miga_dataset
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_miga_dataset
# Don't do anything if it already exists
return true if project.miga.dataset(miga_name)
err = project.create_miga_dataset(
- 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 launch_get_db
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def launch_get_db
name = params[:name]
version = params[:version]
Thread.new do
require 'miga/cli'
- 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 reference_dataset_result
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def reference_dataset_result
if p = @project and m = p.miga
if ds = m.dataset(params[:dataset]) and res = ds.result(params[:result])
if file = res.data[:files][params[:file].to_sym]
send_result(file, res)
- 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 send_result
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def send_result(file, res)
f = File.expand_path(file, res.dir)
if Dir.exist? f and params[:f] and not params[:f]=~/\//
f = File.expand_path(params[:f], f)
file = params[:f]
- 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 current_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def current_user
if (user_id = session[:user_id])
@current_user ||= User.find_by(id: user_id)
elsif (user_id = cookies.signed[:user_id])
user = User.find_by(id: user_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 create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create
par = user_params
if User.all.empty?
par[:activated] = true
par[:activated_at] = Time.zone.now
- 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 result_partial
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def result_partial
if params[:q_ds].nil?
obj = @project
proj = obj
unless params[:r_ds].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 get_db
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_db
manif = Project.miga_online_manif
@downloadable = manif[:databases].map do |name, i|
local = Project.find_by(path: name)
local_v = (local.miga.metadata[:release] || 'unknown') if local && local.miga
- 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 rdp_classify
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rdp_classify(ds_name)
ds_miga = miga.dataset(ds_name)
return if ds_miga.nil?
res = ds_miga.result(:ssu)
return if res.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"