Method show
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def show
# It turns out that it's faster to just get everything and let the
# view handle it
problemQuery = "SELECT scores.score AS score,
submissions.version AS version,
- 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 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
# It turns out that it's faster to just get everything and let the
# view handle it
problemQuery = "SELECT scores.score AS score,
submissions.version AS version,
File scoreboards_controller.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ScoreboardsController < ApplicationController
before_action :set_assessment
before_action :set_assessment_breadcrumb
before_action :set_edit_assessment_breadcrumb, only: [:edit]
before_action :set_scoreboard, except: [:create]
Method scoreboardOrderSubmissions
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def scoreboardOrderSubmissions(a, b)
# If the assessment is not autograded, or the instructor did
# not create a custom column spec, then revert to the default,
# which sorts by total problem, then by submission time.
if !@assessment.has_autograder? ||
- 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 scoreboardOrderSubmissions
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scoreboardOrderSubmissions(a, b)
# If the assessment is not autograded, or the instructor did
# not create a custom column spec, then revert to the default,
# which sorts by total problem, then by submission time.
if !@assessment.has_autograder? ||
Method createScoreboardEntry
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def createScoreboardEntry(scores, autoresult)
# If the assessment was not autograded or the scoreboard was
# not customized, then simply return the list of problem
# scores and their total.
if !autoresult ||
Method emitColSpec
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def emitColSpec(colspec)
return "Empty column specification" if colspec.blank?
begin
# Quote JSON keys and values if they are not already quoted
Method emitColSpec
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def emitColSpec(colspec)
return "Empty column specification" if colspec.blank?
begin
# Quote JSON keys and values if they are not already quoted
- 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
Avoid too many return
statements within this method. Open
render("scoreboards/edit") && return
Avoid too many return
statements within this method. Open
redirect_to(course_assessment_path(@course, @assessment)) && return
Avoid too many return
statements within this method. Open
return unless @scoreboard.colspec.present?