Showing 40 of 40 total issues
Method create
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
def create
@project = Project.find_by(id: query_dataset_params[:project_id])
if @project.nil?
redirect_to projects_path
else
- 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
File projects_controller.rb
has 468 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'miga'
require 'miga/daemon'
class ProjectsController < ApplicationController
before_action :set_project,
Class ProjectsController
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class ProjectsController < ApplicationController
before_action :set_project,
only: [:destroy, :show, :search, :reference_datasets,
:medoid_clade, :medoid_clade_as,
:rdp_classify, :rdp_classify_as, :new_ncbi_download,
Method aai_intax
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def aai_intax(aai, project, ds_miga)
opts = {}
if project.miga && project.miga.metadata[:aai_p]
opts[:engine] = project.miga.metadata[:aai_p]
end
- 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 21 (exceeds 5 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)
- 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 list_query_datasets
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def list_query_datasets
if params[:project_id]
@project = Project.find(params[:project_id])
qd = params[:all] ? @project.query_datasets.all :
QueryDataset.by_user_and_project(current_user, @project)
- 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_reference
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def create_reference
cmd = params.require(:query_dataset).permit(
:name, :input_type, :input_file, :input_file_2
)
cmd.merge! params.permit(:type, :comments, :description)
- 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 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@project = Project.find_by(id: query_dataset_params[:project_id])
if @project.nil?
redirect_to projects_path
else
Method plot_quality
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def plot_quality(comp, cont, qual)
css_class = ["success","info","warning","danger"]
comp_l = comp > 80.0 ? 0 : comp > 50.0 ? 1 : comp > 20.0 ? 2 : 3
cont_l = cont < 4.0 ? 0 : cont < 10.0 ? 1 : cont < 16.0 ? 2 : 3
qual_l = qual > 80.0 ? 0 : qual > 50.0 ? 1 : qual > 20.0 ? 2 : 3
- 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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def result
qd = @query_dataset
m = qd.miga
res = m.result(params[:result])
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"
Further reading
Method aai_intax
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def aai_intax(aai, project, ds_miga)
opts = {}
if project.miga && project.miga.metadata[:aai_p]
opts[:engine] = project.miga.metadata[:aai_p]
end
Method create_reference
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_reference
cmd = params.require(:query_dataset).permit(
:name, :input_type, :input_file, :input_file_2
)
cmd.merge! params.permit(:type, :comments, :description)
Method discovery
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def discovery
require 'miga/lair'
require 'pathname'
lair = MiGA::Lair.new(Settings.miga_projects)
- 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
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def search
# Query
@q = params[:q]
@query = @q.split(/\s(?=(?:[^"]|"[^"]*")*$)/).map do |i|
(i =~ /^(?:([A-Za-z_]+):)?"?(.*?)"?$/) ? [$2, $1] : [i, 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 list_query_datasets
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_query_datasets
if params[:project_id]
@project = Project.find(params[:project_id])
qd = params[:all] ? @project.query_datasets.all :
QueryDataset.by_user_and_project(current_user, @project)
Method progress
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def progress
ref_ds = @project.miga.dataset_names.select { |i| i !~ /^qG_/ }
status = ref_ds.sample(100).map do |i|
@project.miga.dataset(i).status
end
Method plot_quality_deprecated
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def plot_quality_deprecated(comp, cont, qual)
cols = ["rgba(92,184,92,1)", "rgba(91,192,222,1)",
"rgba(240,173,78,1)", "rgba(217,83,79,1)"]
comp_l = comp > 80.0 ? 0 : comp > 50.0 ? 1 : comp > 20.0 ? 2 : 3
cont_l = cont < 4.0 ? 0 : cont < 10.0 ? 1 : cont < 16.0 ? 2 : 3
- 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_miga_dataset
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create_miga_dataset(par, file1, file2 = nil)
require 'miga/cli'
input_type = par[:input_type]
input_type = 'trimmed_reads' if par[:input_type] == 'trimmed_fasta'
input_type += file2 ? '_paired' : '_single' unless input_type == 'assembly'
- 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 plot_quality
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def plot_quality(comp, cont, qual)
css_class = ["success","info","warning","danger"]
comp_l = comp > 80.0 ? 0 : comp > 50.0 ? 1 : comp > 20.0 ? 2 : 3
cont_l = cont < 4.0 ? 0 : cont < 10.0 ? 1 : cont < 16.0 ? 2 : 3
qual_l = qual > 80.0 ? 0 : qual > 50.0 ? 1 : qual > 20.0 ? 2 : 3
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"