app/helpers/assessment_helper.rb
Method csv_row_for
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def csv_row_for(asmt, cud, as_seen_by)
aud = AssessmentUserDatum.get asmt.id, cud.id
throw "csv_row_for: no AUD for (#{asmt.id}, #{cud.id})" unless aud
# create csv row with latest submission time and user email (first and second columns)
- 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 stats_table
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def stats_table(data)
out =
'<table class="striped">
<thead>
<tr class="red darken-3 white-text">
Method gradesheet_csv
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def gradesheet_csv(asmt, as_seen_by)
CSV.generate do |csv|
# title row with the column names:
title = ["Submission Time","Email","Total"]
asmt.problems.each { |problem| title << problem.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"