autolab/Autolab

View on GitHub
app/helpers/gradebook_helper.rb

Summary

Maintainability
C
1 day
Test Coverage

Method gradebook_rows has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def gradebook_rows(matrix, course, section = nil, lecture = nil)
    rows = []

    course.course_user_data.each do |cud|
      next unless matrix.has_cud? cud.id
Severity: Minor
Found in app/helpers/gradebook_helper.rb - About 4 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 gradebook_csv has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def gradebook_csv(matrix, course)
    CSV.generate do |csv|
      csv << csv_header(matrix, course)

      course.course_user_data.each do |cud|
Severity: Minor
Found in app/helpers/gradebook_helper.rb - About 2 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 gradebook_columns has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def gradebook_columns(matrix, course)
    # user info columns
    columns = [
      { id: "number", name: "#", field: "", width: 50 },
      { id: "email", name: "Email", field: "email",
Severity: Minor
Found in app/helpers/gradebook_helper.rb - About 1 hr to fix

    Method gradebook_rows has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def gradebook_rows(matrix, course, section = nil, lecture = nil)
        rows = []
    
        course.course_user_data.each do |cud|
          next unless matrix.has_cud? cud.id
    Severity: Minor
    Found in app/helpers/gradebook_helper.rb - About 1 hr to fix

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

        def csv_header(matrix, course)
          header = %w(Email first_name last_name Lecture Section School Major Year grace_days_used penalty_late_days)
          course.assessment_categories.each do |cat|
            next unless matrix.has_category? cat
      
      
      Severity: Minor
      Found in app/helpers/gradebook_helper.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 gradebook_columns has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def gradebook_columns(matrix, course)
          # user info columns
          columns = [
            { id: "number", name: "#", field: "", width: 50 },
            { id: "email", name: "Email", field: "email",
      Severity: Minor
      Found in app/helpers/gradebook_helper.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

      There are no issues that match your filters.

      Category
      Status