Showing 714 of 1,025 total issues
Function updateDisciplines
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateDisciplines() {
discipline_text=''
type="Discipline"
discipline_ids=new Array();
Function updateOrganisms
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateOrganisms() {
organism_text=''
type="Organism"
organism_ids=new Array();
Method indented_tree_child_options
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def indented_tree_child_options parent, depth=0, show_edit=true, show_delete=true, selected_id=nil, related_resource_type="Person",selected_display_items=nil, foldable=true
result = []
unless parent.children.empty?
parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|
display_style = (foldable==true) ? "display:none" : "display:block"
Method avatar
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def avatar(object, size=200, return_image_tag_only=false, url=nil, alt=nil, show_tooltip=true)
alternative = ""
title = get_object_title(object)
if show_tooltip
tooltip_text = (alt.nil? ? h(title) : alt)
Method fetch_preview
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fetch_preview
#trim the PubMed or Doi Id
params[:key] = params[:key].strip() unless params[:key].blank?
params[:publication][:project_ids].reject!(&:blank?).map! { |id| id.split(',') }.flatten!
@publication = Publication.new(params[:publication])
Method included
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(base)
raise "Only People can have roles" unless base==Person
base.extend(ClassMethods)
ROLES.each do |role|
Function toggleDynamicMenu
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function toggleDynamicMenu(element) {
function documentClickedHandler(event) {
if (!event.element().hasClassName("dynamic_menu_li")) {
switch (event.element().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
Function updateOrganisms
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function updateOrganisms() {
organism_text='<ul class="related_asset_list">';
for (var i=0;i<organisms.length;i++) {
organism=organisms[i];
- 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 check_uniqueness_of_identifier_within_project
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def check_uniqueness_of_identifier_within_project
if !doi.blank?
existing = Publication.find_all_by_doi(doi) - [self]
if !existing.empty?
matching_projects = existing.collect(&:projects).flatten.uniq & 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 process_queue
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def process_queue
#including item_type in the order, encourages assets to be processed before users (since they are much quicker), due to tha happy coincidence
#that User falls last alphabetically. Its not that important if a new authorized type is added after User in the future.
todo = AuthLookupUpdateQueue.order("priority,item_type,id").limit(BATCHSIZE).collect do |queued|
todo = queued.item
- 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_announcement_emails
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def send_announcement_emails site_announcement, from_notifiee_id
if Seek::Config.email_enabled
NotifieeInfo.where(["id IN (?) AND receive_notifications=?", (from_notifiee_id .. (from_notifiee_id + BATCHSIZE)), true]).each do |notifiee_info|
begin
unless notifiee_info.notifiee.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 value_for_key
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def value_for_key config_for_key, object
facet_values = []
value_from = config_for_key['value_from']
value_from.split(',').each do |from|
facet_value = object
- 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 file_extension
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def file_extension
if metadata.nil?
nil
else
if metadata[: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 concat_roles_to_name
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def concat_roles_to_name grouped_people_by_access_type, creators, asset_managers
creator_id_array = creators.collect{|c| c.id unless c.blank?}
asset_manage_id_array = asset_managers.collect{|am| am.id unless am.blank?}
grouped_people_by_access_type = grouped_people_by_access_type.reject{|key,value| key == Policy::DETERMINED_BY_GROUP}.each_value do |value|
value.each do |person|
- 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_visibility
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def list_item_visibility item,css_class="visibility_icon"
title = ""
html = ""
policy = item.policy
- 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 windowed_pagination_links
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def windowed_pagination_links(pagingEnum, options)
link_to_current_page = options[:link_to_current_page]
always_show_anchors = options[:always_show_anchors]
padding = options[:window_size]
- 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 builder
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def builder
saved_file=params[:saved_file]
error=nil
supported=false
begin
- 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
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def new
@assay=Assay.new
@assay.create_from_asset = params[:create_from_asset]
study = Study.find(params[:study_id]) if params[:study_id]
@assay.study = study if params[:study_id] if study.try :can_edit?
- 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 index
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def index
if (params[:discipline_id])
@discipline=Discipline.find(params[:discipline_id])
#FIXME: strips out the disciplines that don't match
@people=Person.where(["disciplines.id=?",@discipline.id]).includes(:disciplines)
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def create
if handle_upload_data
@sop = Sop.new(params[:sop])
@sop.policy.set_attributes_with_sharing params[:sharing], @sop.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"