sophiazheng/CS169_Great_Course_Guide

View on GitHub

Showing 8 of 8 total issues

Method recommended_EECS_courses has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def recommended_EECS_courses(ignore_flag)
    draft_schedule = Utils.draft_schedule
    semesters = {
        fall: {
            courses: {},
Severity: Minor
Found in app/models/user.rb - About 1 hr to fix

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

      def can_take(course_number, ignore_flag)
        if Course.exists?(number: course_number)
          course = Course.find_by(number: course_number)
          if has_taken(course)
            return false
    Severity: Minor
    Found in app/models/user.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 get_course_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_course_data(course_list, term_list)
        course_list.map! { |course_number| [Course.find_by(number: course_number),
                  term_list[course_number].split(";")]}
                  #get_average_rating_of_professors(term_list[course_number].split(";"))] }
        course_list.each do |data|
    Severity: Minor
    Found in app/models/user.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 recommended_EECS_courses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def recommended_EECS_courses(ignore_flag)
        draft_schedule = Utils.draft_schedule
        semesters = {
            fall: {
                courses: {},
    Severity: Minor
    Found in app/models/user.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 filter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.filter
        map = {}
        self.all.each do |course|
          department = course.number[0..1]
          course.number =~ /(\d+)/
    Severity: Minor
    Found in app/models/course.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 recommended_breadth_courses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def recommended_breadth_courses
        fall_breadth_courses = Utils.breadth_schedule
        distinguished_fall_breadth_courses = []
        fall_breadth_courses.each do |course|
          professor = Professor.find_by(name: course[2])
    Severity: Minor
    Found in app/models/user.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 method.
    Open

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

      Method create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def create
          @user = User.create(first_name: params[:first_name],
                              last_name: params[:last_name], email: params[:email],
                                                              uid: session[:cas_user])
          if not @user.valid?
      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