autolab/Autolab

View on GitHub

Showing 419 of 572 total issues

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?

Severity: Minor
Found in app/controllers/groups_controller.rb - About 35 mins to fix

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
Severity: Minor
Found in app/controllers/groups_controller.rb - About 35 mins to fix

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 7 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    # if ajax called update, don't set a flash or perform a redirect_to
    if params.include?(:ajax)
      if @problem.update(problem_params)
        render json: { success: true }
Severity: Minor
Found in app/controllers/problems_controller.rb - About 35 mins to fix

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 feedback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def feedback
    # param check
    if !params.has_key?(:problem)
      raise ApiError.new("Required parameter 'problem' not found", :bad_request)
    end
Severity: Minor
Found in app/controllers/api/v1/submissions_controller.rb - About 35 mins to fix

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 function.
Open

    return 'matrix(' + pf(m[0]) + ' ' + pf(m[1]) + ' ' + pf(m[2]) + ' ' +
      pf(m[3]) + ' ' + pf(m[4]) + ' ' + pf(m[5]) + ')';
Severity: Major
Found in app/assets/javascripts/pdf.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return false;
    Severity: Major
    Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return i;
      Severity: Major
      Found in app/assets/javascripts/pdf.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return columns[cell].focusable;
        Severity: Major
        Found in app/assets/javascripts/SlickGrid/2.02/slick.grid.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return result;
          Severity: Major
          Found in app/assets/javascripts/sorttable.js - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return :valid
            Severity: Major
            Found in app/helpers/assessment_handin_core.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                  redirect_to(controller: :jobs, item: nil) && return
              Severity: Major
              Found in app/controllers/jobs_controller.rb - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                    return -1;
                Severity: Major
                Found in app/assets/javascripts/sorttable.js - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return
                  Severity: Major
                  Found in app/models/scoreboard.rb - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                              return false;
                    Severity: Major
                    Found in app/assets/javascripts/materialize-autocomplete.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return;
                      Severity: Major
                      Found in app/assets/javascripts/jquery.event.drag-2.2.js - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return
                        Severity: Major
                        Found in app/models/scoreboard.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                return :fail_type_check
                          Severity: Major
                          Found in app/helpers/assessment_handin_core.rb - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return false;
                            Severity: Major
                            Found in app/assets/javascripts/materialize-autocomplete.js - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                        return
                              Severity: Major
                              Found in app/models/scoreboard.rb - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return false;
                                Severity: Major
                                Found in app/assets/javascripts/jquery.event.drag-2.2.js - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language