DueWiz/Student_Organizer

View on GitHub

Showing 7 of 11 total issues

Method perform has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perform(current_user)
    agent = Mechanize.new
    agent.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    logger.info "Latte Account Name:#{current_user.latte_account.name}"
    logger.info "Latte Account password:#{current_user.latte_account.password}\n\n\n\n\n\n\n\n\n"
Severity: Major
Found in app/jobs/load_latte_job.rb - About 2 hrs to fix

    Method result has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def result
        @my_hw = current_user.homeworks.order(:due_date)
        if params[:hw_choice] == "All"
          @my_hw = current_user.homeworks.order(:due_date)
        elsif params[:hw_choice] == "Uncompleted"
    Severity: Minor
    Found in app/controllers/homework_controller.rb - About 1 hr to fix

      Method display_date_info has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def display_date_info (hw)
          time_remain = time_due(hw.due_date)
          if time_remain[0] == 0 and time_remain[1]>=0 and time_remain[2]>=0
            if time_remain[1] == 0 # min
              num = time_remain[2]
      Severity: Minor
      Found in app/controllers/application_controller.rb - About 1 hr 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 display_date_info has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def display_date_info (hw)
          time_remain = time_due(hw.due_date)
          if time_remain[0] == 0 and time_remain[1]>=0 and time_remain[2]>=0
            if time_remain[1] == 0 # min
              num = time_remain[2]
      Severity: Minor
      Found in app/controllers/application_controller.rb - About 1 hr to fix

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

          def perform(current_user)
            agent = Mechanize.new
            agent.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE
            logger.info "Latte Account Name:#{current_user.latte_account.name}"
            logger.info "Latte Account password:#{current_user.latte_account.password}\n\n\n\n\n\n\n\n\n"
        Severity: Minor
        Found in app/jobs/load_latte_job.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 result has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def result
            @my_hw = current_user.homeworks.order(:due_date)
            if params[:hw_choice] == "All"
              @my_hw = current_user.homeworks.order(:due_date)
            elsif params[:hw_choice] == "Uncompleted"
        Severity: Minor
        Found in app/controllers/homework_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 show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def show
            if params[:id] == "-1"
              myhws = getMyHw
              hws = myhws.where(group_id: nil).order(:due_date)
            else
        Severity: Minor
        Found in app/controllers/group_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