DueWiz/Student_Organizer

View on GitHub

Showing 11 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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            @my_hw.each do |hw|
              if count == 0
                @table[index] = Array.new
                @date_infos[index] = Array.new
              end
        Severity: Major
        Found in app/controllers/homework_controller.rb and 1 other location - About 1 hr to fix
        app/controllers/homework_controller.rb on lines 60..70

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 48.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            @my_hw.each do |hw|
              if count == 0
                @table[index] = Array.new
                @date_infos[index] = Array.new
              end
        Severity: Major
        Found in app/controllers/homework_controller.rb and 1 other location - About 1 hr to fix
        app/controllers/homework_controller.rb on lines 28..38

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 48.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            homework.due_date = Time.zone.local(params[:homework]["due_date(1i)"].to_i,
                                         params[:homework]["due_date(2i)"].to_i,
                                         params[:homework]["due_date(3i)"].to_i,
                                         params[:homework]["due_date(4i)"].to_i,
                                         params[:homework]["due_date(5i)"].to_i,)
        Severity: Minor
        Found in app/controllers/homework_controller.rb and 1 other location - About 30 mins to fix
        app/controllers/homework_controller.rb on lines 101..105

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 33.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            @new.due_date = Time.zone.local(params[:homework]["due_date(1i)"].to_i,
                                         params[:homework]["due_date(2i)"].to_i,
                                         params[:homework]["due_date(3i)"].to_i,
                                         params[:homework]["due_date(4i)"].to_i,
                                         params[:homework]["due_date(5i)"].to_i,)
        Severity: Minor
        Found in app/controllers/homework_controller.rb and 1 other location - About 30 mins to fix
        app/controllers/homework_controller.rb on lines 84..88

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 33.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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