Showing 66 of 66 total issues
Method update
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def update
@user = User.find(params[:id])
if params[:user][:user_phenotypes_attributes].present?
params[:user][:user_phenotypes_attributes].each do |p|
- 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 show
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
# showing a single user's page
@user = User.find_by_id(params[:id]) || not_found
@title = @user.name + '\'s page'
@first_name = @user.name.split.first
Method perform
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def perform()
puts "Running PgpAnnotationJob\n"
known_snps = {}
Snp.find_each do |s| known_snps[s.name] = true 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 11 (exceeds 5 allowed). Consider refactoring. Open
def create
unless @phenotype = PicturePhenotype.find_by_characteristic(params[:picture_phenotype][:characteristic])
puts params[:picture_phenotype]
@phenotype = PicturePhenotype.create(picture_phenotype_params)
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def create
@user_phenotype = UserPhenotype.new(user_phenotype_params)
@user_phenotype.user_id = current_user.id
if params[:js_modal]
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def create
@user_phenotype = current_user.user_picture_phenotypes.new(
phenotype_picture: params[:user_picture_phenotype][:phenotype_picture])
@user_phenotype.phenotype_picture = params[:user_picture_phenotype][:phenotype_picture]
@user_phenotype.user_id = current_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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@user_phenotype = current_user.user_picture_phenotypes.new(
phenotype_picture: params[:user_picture_phenotype][:phenotype_picture])
@user_phenotype.phenotype_picture = params[:user_picture_phenotype][:phenotype_picture]
@user_phenotype.user_id = current_user.id
Method process_row
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_row(row)
snp_name = row[21]
pvalue = row[27].to_f
snp = Snp.find_by_name(snp_name)
return unless snp && pvalue < 1e-8 && known_snps.include?(snp_name.downcase)
Method index
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
# showing all users
# TODO: Refactor this. - Helge
@users = User.order(sort_column + ' ' + sort_direction)
@users_paginate = @users.paginate(page: params[:page], per_page: 10)
Method create
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@user_phenotype = UserPhenotype.new(user_phenotype_params)
@user_phenotype.user_id = current_user.id
if params[:js_modal]
Method perform
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(snp_id)
Snp.reset_counters(snp_id, :user_snps)
s = Snp.find(snp_id)
s.allele_frequency ||= { "A" => 0, "T" => 0, "G" => 0, "C" => 0}
s.genotype_frequency ||= {}
Method process_documents
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_documents(documents)
if documents.blank?
logger.info("mendeley: No papers found")
return
end
Method json_element
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def json_element(params)
# TODO: Refactor this. - Helge
@result = {}
begin
@snp = params[:snp] || Snp.find_by_name(params[:snp_name].downcase)
Method perform
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(mendeley_paper_id)
mendeley_paper = MendeleyPaper.find_by_id(mendeley_paper_id.to_i)
return if mendeley_paper.nil?
key_handle = File.open(::Rails.root.to_s+"/key_mendeley.txt")
Method update
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@user = User.find(params[:id])
if params[:user][:user_phenotypes_attributes].present?
params[:user][:user_phenotypes_attributes].each do |p|
Method json_annotation
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def json_annotation
result = {}
if params[:snp_name].index(',')
snps = params[:snp_name].split(',')
snps.each do |s|
- 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 call
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def call
Genotype.includes(:user).find_each do |genotype|
next unless File.exist?(genotype.genotype.path)
user = genotype.user
- 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 parse_iyg
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_iyg(rows)
db_snp_names = {
"MT-T3027C" => "rs199838004", "MT-T4336C" => "rs41456348",
"MT-G4580A" => "rs28357975", "MT-T5004C" => "rs41419549",
"MT-C5178a" => "rs28357984", "MT-A5390G" => "rs41333444",
Method create
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@phenotype_comment = PhenotypeComment.new(phenotype_comment_params)
if @phenotype_comment.comment_text.index(/\A(\@\#\d*\:)/) == nil
@phenotype_comment.reply_to_id = -1
else
Method create
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@phenotype_comment = PicturePhenotypeComment.new(picture_phenotype_comment_params)
if @phenotype_comment.comment_text.index(/\A(\@\#\d*\:)/) == nil
@phenotype_comment.reply_to_id = -1
else