Method leave
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def leave
if !@assessment.allow_student_assign_group && @cud.student?
flash[:error] = "You are not allowed to change your group for this assessment. "\
"Contact your instructor for group assignment."
redirect_to(action: :index) && return
- 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 groups_controller.rb
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
class GroupsController < ApplicationController
# inherited from ApplicationController
before_action :set_assessment
before_action :set_assessment_breadcrumb
before_action :set_groups_breadcrumb, except: %i[index]
Method add
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def add
if !@assessment.allow_student_assign_group && @cud.student?
flash[:error] = "You are not allowed to add members to your group for this assessment. "\
"Contact your instructor for group assignment."
redirect_to(action: :index) && return
- 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 leave
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def leave
if !@assessment.allow_student_assign_group && @cud.student?
flash[:error] = "You are not allowed to change your group for this assessment. "\
"Contact your instructor for group assignment."
redirect_to(action: :index) && return
Method import
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def import
ass = @course.assessments.find(params[:ass])
if !ass
flash[:error] = "Assessment not found."
redirect_to(action: :index) && return
- 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 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
if !@assessment.allow_student_assign_group && @cud.student?
flash[:error] = "You are not allowed to self-assign group for this assessment. "\
"Contact your instructor for group assignment."
redirect_to(action: :new) && return
Method create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create
if !@assessment.allow_student_assign_group && @cud.student?
flash[:error] = "You are not allowed to self-assign group for this assessment. "\
"Contact your instructor for group assignment."
redirect_to(action: :new) && return
- 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 add
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add
if !@assessment.allow_student_assign_group && @cud.student?
flash[:error] = "You are not allowed to add members to your group for this assessment. "\
"Contact your instructor for group assignment."
redirect_to(action: :index) && return
Method update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update
if params[:group]
aud = @assessment.aud_for @cud.id
if @group.is_member(aud) || @cud.instructor
flash[:notice] = "Group was successfully updated." if @group.update(group_params)
- 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 join
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def join
if !@assessment.allow_student_assign_group && @cud.student?
flash[:error] = "You are not allowed to join another group for this assessment. "\
"Contact your instructor for group assignment."
redirect_to(action: :new) && return
- 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 show
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def show
@aud = @assessment.aud_for @cud.id
unless @cud.instructor
redirect_to(action: :new) && return if @aud.group_id.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 index
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def index
unless @cud.instructor
aud = @assessment.aud_for @cud.id
if aud.group
redirect_to(course_assessment_group_path(@course, @assessment, aud.group)) && return
- 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"