YaleSTC/shifts

View on GitHub
app/controllers/payform_item_sets_controller.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method update has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def update
    @payform_item_set = PayformItemSet.find(params[:id])
    set_payform_item_hours("payform_item_set")
    date = build_date_from_params(:date, params[:payform_item_set])
    @new_users = parse_users_autocomplete(params[:auto_ids])
Severity: Minor
Found in app/controllers/payform_item_sets_controller.rb - About 1 hr to fix

    Method create has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create
        set_payform_item_hours("payform_item_set")
        @payform_item_set = PayformItemSet.new(params[:payform_item_set])
        @payform_item_set.active = true #TODO: set this as a default in the database
        date = build_date_from_params(:date, params[:payform_item_set])
    Severity: Minor
    Found in app/controllers/payform_item_sets_controller.rb - About 1 hr to fix

      Method update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def update
          @payform_item_set = PayformItemSet.find(params[:id])
          set_payform_item_hours("payform_item_set")
          date = build_date_from_params(:date, params[:payform_item_set])
          @new_users = parse_users_autocomplete(params[:auto_ids])
      Severity: Minor
      Found in app/controllers/payform_item_sets_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

      There are no issues that match your filters.

      Category
      Status