Showing 714 of 1,025 total issues
Method create
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def create
@sample = Sample.new(params[:sample])
# create new specimen only for combined form
is_new_spec = params[:sample][:specimen_id].nil? ? true : false
- 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 is_authorized?
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def self.is_authorized?(action, thing_type, thing, user=nil)
# initially not authorized, so if all tests fail -
# safe result of being not authorized will get returned
is_authorized = false
- 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 populate_sample
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def populate_sample sample_json, specimen, assay=nil
sample_title = sample_json["title"]
sample_type = sample_json["type"]
- 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 dortmund_hengstler_mapping
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dortmund_hengstler_mapping
age_regex = /(\d+-?\d*)\s*(day|week|month|year)s?/i
treatment_regex = /(\d*\.?\d*)\s*(\w+\/\w+)\s*([\w\.\s,']*),?\s+([\w\.]*)/
incubation_time_regex = /(\d+\.?\d*)(\w{1})/
File person.rb
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'grouped_pagination'
class Person < ActiveRecord::Base
include Seek::Rdf::RdfGeneration
Method included
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def self.included klass
klass.class_eval do
include Seek::Search::CommonFields
searchable do
- 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 set_default_subscriptions
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def set_default_subscriptions projects
unless projects.empty?
Person.scoped(:include => :project_subscriptions).each do |person|
project_subscriptions = person.project_subscriptions
project_subscriptions.each do |ps|
- 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 people_controller.rb
has 357 lines of code (exceeds 250 allowed). Consider refactoring. Open
class PeopleController < ApplicationController
include Seek::AnnotationCommon
include Seek::Publishing::PublishingCommon
include Seek::Publishing::GatekeeperPublish
Method submit_to_jws
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def submit_to_jws
following_action=params.delete("following_action")
error=nil
#FIXME: currently we have to assume that a model with multiple files only contains 1 model file that would be executed on jws online, and only the first one is chosen
- 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
Class Policy
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Policy < ActiveRecord::Base
has_many :permissions,
:dependent => :destroy,
:order => "created_at ASC",
Method list_samples_and_assay_organisms
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def list_samples_and_assay_organisms attribute, assay_samples, assay_organisms, html_options={}, none_text="Not Specified"
result= "<p class='#{html_options[:class]}' id='#{html_options[:id]}'> <b>#{attribute}</b>: "
result +="<span class='none_text'>#{none_text}</span>" if assay_samples.blank? and assay_organisms.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 perform_search
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def perform_search
@search_query = params[:search_query]
@search=@search_query # used for logging, and logs the origin search query - see ApplicationController#log_event
@search_query||=""
@search_type = params[:search_type]
- 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
Class ApplicationController
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
include Seek::Errors::ControllerErrorHandling
include Seek::EnabledFeaturesFilter
include Recaptcha::Verify
Class BioSamples
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class BioSamples
attr_reader :investigation, :study, :assay, :assay_class, :assay_type,
:units, :treatments, :organisms, :strains, :culture_growth_type, :tissue_and_cell_types,
:specimens, :samples, :specimen_names, :sample_names, :treatments,:treatments_text,
Method create_or_update_attributions
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def self.create_or_update_attributions(resource, attributions_from_params, predicate = Relationship::ATTRIBUTED_TO)
# added this branching on .nil? because of the danger of loosing all attributions for a model (for example) if due to an incomplete post request attributions is nil
# the former code interpreted a nil parameter as an empty list => remove all attributions from an asset
unless attributions_from_params.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 dortmund_bcat_ko_mapping
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dortmund_bcat_ko_mapping
age_regex = /(\d+-?\d*)\s*(day|week|month|year)s?/i
treatment_substance_regex = /.*\((control|treated)\s?=\s?(.*)\)/i
treatment_concentration_unit_regex = /(\d*[,\.]?\d*)\s*([\w\s\/]*).*$/
Function dragObject
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
function dragObject(element, attachElement, lowerBound, upperBound, startCallback, moveCallback, endCallback, attachLater)
{
if(typeof(element) == "string")
element = document.getElementById(element);
if(element == null)
- 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 dragObject
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
function dragObject(element, attachElement, lowerBound, upperBound, startCallback, moveCallback, endCallback, attachLater)
{
if(typeof(element) == "string")
element = document.getElementById(element);
if(element == null)
- 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 update
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def update
group_name = white_list(params[:favourite_group_name])
found = FavouriteGroup.where(:name => group_name, :user_id => current_user.id).first
# if the found group with the same is the current one - that's fine; otherwise - can't rename a group with such new name
- 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 included
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def self.included klass
klass.class_eval do
searchable do
text :title do
if self.respond_to?(:title)
- 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"