Method closing_reminder_staff
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def closing_reminder_staff(assessment, students)
course_instructors = assessment.course.instructors.includes(:user)
student_list = name_list(students)
email_enabled = assessment.course.email_enabled(:assessments, :closing_reminder_summary, assessment.tab.category.id)
course_instructors.each do |instructor|
- Read upRead up
- Create a ticketCreate a ticket
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 uncompleted_subscribed_students
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def uncompleted_subscribed_students(assessment, course_user_ids, include_unsubscribed)
course_users = assessment.course.course_users
course_users = course_users.where(id: course_user_ids) unless course_user_ids.empty?
email_enabled = assessment.course.email_enabled(:assessments, :closing_reminder, assessment.tab.category.id)
# Eager load :user as it's needed for the recipient email.
- Read upRead up
- Create a ticketCreate a ticket
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 closing_reminder
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def closing_reminder(assessment, token)
email_enabled = assessment.course.email_enabled(:assessments, :closing_reminder, assessment.tab.category.id)
return unless assessment.closing_reminder_token == token && assessment.published?
return unless email_enabled.phantom || email_enabled.regular
- Read upRead up
- Create a ticketCreate a ticket
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"