Showing 714 of 1,025 total issues
Method studies_link_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def studies_link_list studies,sorted=true
#FIXME: make more generic and share with other model link list helper methods
studies=studies.select{|s| !s.nil?} #remove nil items
return "<span class='none_text'>Not associated with any #{t('study').pluralize}</span>".html_safe if studies.empty?
- 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_item_with_icon
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def list_item_with_icon(icon_type, item, caption, truncate_to, custom_tooltip=nil, size=nil)
Method recently_downloaded_item_logs_hash
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def recently_downloaded_item_logs_hash time=1.month.ago, number_of_item=10
Rails.cache.fetch("download_activity_#{current_user_id}") do
activity_logs = ActivityLog.no_spider.where(["action = ? AND created_at > ?", 'download', time]).order("created_at DESC")
selected_activity_logs = []
selected_items = []
- 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_people_in_FG
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_people_in_FG contributor, fg_id=nil, is_white_list=nil, is_black_list=nil
if is_white_list
f_group = FavouriteGroup.where(["name = ? AND user_id = ?", "__whitelist__", contributor.user.id]).first
elsif is_black_list
f_group = FavouriteGroup.where(["name = ? AND user_id = ?", "__blacklist__", contributor.user.id]).first
- 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 cytoscape_edge_elements
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cytoscape_edge_elements edges
cytoscape_edge_elements = []
edges.each do |edge|
source, target = edge.split('--')
source.strip!
- 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 tree_single_select_tag
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def tree_single_select_tag type, id, selected_item=nil, disabled_items=[], name=nil, html_options={:multiple => false, :size => 10, :style => "width:600px;"}
Method list_item_expandable_text
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_item_expandable_text attribute, text, length=200
full_text = text_or_not_specified(text, :description => false, :auto_link=>false)
trunc_text = text_or_not_specified(text, :description => false, :auto_link=>false, :length=>length)
#Don't bother with fancy stuff if not enough text to expand
if full_text == trunc_text
- 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 recently_added_item_logs_hash
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def recently_added_item_logs_hash time=1.month.ago, number_of_item=10
Rails.cache.fetch("create_activity_#{current_user_id}") do
item_types = Seek::Util.user_creatable_types.collect{|type| type.name} | [Project,Programme]
activity_logs = ActivityLog.where(["action = ? AND created_at > ? AND activity_loggable_type in (?)", 'create', time, item_types]).order("created_at DESC")
selected_activity_logs = []
- 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 avatar
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def avatar(object, size=200, return_image_tag_only=false, url=nil, alt=nil, show_tooltip=true)
Method related_items_method
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def related_items_method(resource, item_type)
if item_type == "TavernaPlayer::Run"
method_name = 'runs'
else
method_name = item_type.underscore.pluralize
- 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 policy_and_permissions_for_public_scope
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def policy_and_permissions_for_public_scope(policy, permissions, privileged_people, resource_name, updated_can_publish_immediately, send_request_publish_approval)
Method determine_submitter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def determine_submitter object
#FIXME: needs to be the creators for assets
return object.owner if object.respond_to?("owner")
result = object.contributor if object.respond_to?("contributor") && !object.kind_of?(Permission)
if (result)
- 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 allow_model_comparison
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def allow_model_comparison model,displayed_model,user=User.current_user
return false unless model.is_a?(Model)
return false unless model.can_download?(user)
return false unless displayed_model.contains_sbml?
return false unless model.versions.select{|v| v.contains_sbml?}.count > 1
- 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 deep_parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def deep_parse(types, output, zip, index = [])
content = "<ol>"
i = 0
types.each do |type|
if type.is_a?(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
Method list_item_with_icon
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_item_with_icon(icon_type, item, caption, truncate_to, custom_tooltip=nil, size=nil)
list_item = "<li>"
if icon_type.downcase == "flag"
list_item += flag_icon(item.country)
elsif icon_type == "data_file" || icon_type == "sop"
- 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 delete_model_format
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete_model_format params
id=params[:selected_model_format_id]
model_format=ModelFormat.find(id)
success=false
if (model_format.models.empty?)
- 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 new_strain
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def new_strain strain_params
strain = Strain.new
# to delete id hash which is saved in the hidden id field (automatically generated in form with fields_for)
# try_block {
#delete id hashes of genotypes/phenotypes
- 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 determine_return_url_after_login
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def determine_return_url_after_login
if !params[:called_from].blank? && !params[:called_from][:url].blank?
return_to_url = params[:called_from][:url]
elsif !params[:called_from].blank? && params[:called_from][:controller] != "sessions"
if params[:called_from][: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 submit_to_sycamore
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def submit_to_sycamore
@model = Model.find_by_id(params[:id])
@display_model = @model.find_version(params[:version])
error_message = nil
if !Seek::Config.sycamore_enabled
- 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 destroy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def destroy
respond_to do |format|
if @suggested_technology_type.can_destroy?
title = @suggested_technology_type.label
@suggested_technology_type.destroy
- 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"