elizabrock/coursewareofthefuture

View on GitHub

Showing 9 of 9 total issues

Method calendar has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

  def calendar(options = {}, &block)
    raise(ArgumentError, "No year given")  unless options.has_key?(:year)
    raise(ArgumentError, "No month given") unless options.has_key?(:month)

    block                        ||= Proc.new {|d| nil}
Severity: Minor
Found in lib/calendar_helper.rb - About 6 hrs 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 calendar has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def calendar(options = {}, &block)
    raise(ArgumentError, "No year given")  unless options.has_key?(:year)
    raise(ArgumentError, "No month given") unless options.has_key?(:month)

    block                        ||= Proc.new {|d| nil}
Severity: Major
Found in lib/calendar_helper.rb - About 3 hrs to fix

    Function drawGraph has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function drawGraph(){
        //Retrieve and sort self reports
        var selfReports = $('#self_reports').data('data');
        selfReports.sort(function(a, b){
          if(a.date < b.date){
    Severity: Major
    Found in app/assets/javascripts/user_show.js - About 2 hrs to fix

      Class Material has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Material
        include Materiable
      
        attr_accessor :children, :local_id
        @@LAST_ID = 0
      Severity: Minor
      Found in app/models/material.rb - About 2 hrs to fix

        Method populate_from_markdown has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def populate_from_markdown(section, materials)
            return if section.blank?
            lines = section.split("\n")
            return if lines.empty?
            if lines.first.start_with?("#")
        Severity: Minor
        Found in app/models/milestone.rb - About 55 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 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
            if assignment.save
              if assignment.published?
                redirect_to course_assignment_path(current_course, assignment), notice: "Your assignment has been published."
              else
        Severity: Minor
        Found in app/controllers/assignments_controller.rb - About 45 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 populate_quizzes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def populate_quizzes(days, course)
            quizzes = course.quizzes.find_all{|q| can?(:view, q) }
            quizzes.collect do |quiz|
              quiz_description = "#{quiz.title} Due"
              link = quiz.published? ? edit_course_quiz_submission_path(course, quiz) : edit_course_quiz_path(course, quiz)
        Severity: Minor
        Found in app/helpers/events_helper.rb - About 25 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 populate_materials has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def populate_materials(days, course)
            course.covered_materials.each do |covered_material|
              material_description = "#{covered_material.formatted_title} Covered"
              class_text = ReadMaterial.where(material_fullpath: covered_material.material_fullpath)[0] ? "secondary" : "primary"
              read_class = read_materials_fullpaths.include?(covered_material.fullpath) ? "fi-check" : "fi-asterisk"
        Severity: Minor
        Found in app/helpers/events_helper.rb - About 25 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 require_profile! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def require_profile!
            return unless user_signed_in?
            return unless request.method == "GET"
            unless current_user.has_confirmed_photo?
              flash.keep
        Severity: Minor
        Found in app/controllers/application_controller.rb - About 25 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

        Severity
        Category
        Status
        Source
        Language