Method ajax_probe_assignment
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def ajax_probe_assignment
@intervention = current_student.interventions.find_by_id(params[:intervention_id]) || Intervention.new
if params[:id] == 'custom'
@intervention_probe_assignment = @intervention.intervention_probe_assignments.build if @intervention
if @intervention_probe_assignment and @intervention_probe_assignment.probe_definition.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 find_intervention
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_intervention
if current_student.blank?
# alternate entry point
intervention = Intervention.find(params[:id])
if intervention && intervention.student && intervention.student.belongs_to_user?(current_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"
Further reading
Method update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
if params[:intervention]
params[:intervention][:participant_user_ids] ||=[]
params[:intervention][:intervention_probe_assignment] ||= {}
params[:intervention][:comment_author] = current_user.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"