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
Method update_subscription_job_if_study_or_assay
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_subscription_job_if_study_or_assay
if self.kind_of?(Study) && self.investigation_id_changed?
#update subscriptions for study
old_investigation_id = self.investigation_id_was
old_investigation = Investigation.find_by_id old_investigation_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 send_immediate_subscriptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def send_immediate_subscriptions activity_log
if Seek::Config.email_enabled && subscribers_are_notified_of?(activity_log.action)
subscriptions.each do |subscription|
if !subscription.person.user.nil? && subscription.person.receive_notifications? && subscription.immediately? && can_view?(subscription.person.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"