app/models/dispatcher.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Class Dispatcher has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class Dispatcher
  def initialize(proposal)
    @proposal = proposal
  end

Severity: Minor
Found in app/models/dispatcher.rb - About 2 hrs to fix

    Assignment Branch Condition size for step_complete is too high. [20.4/15]
    Open

      def step_complete(step)
        if next_step.present?
          StepMailer.proposal_notification(next_step).deliver_later
        end
    
    
    Severity: Minor
    Found in app/models/dispatcher.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [14/10]
    Open

      def deliver_cancelation_emails(canceler, reason = nil)
        cancelation_notification_recipients = [proposal.requester] + active_step_users + only_observers - [canceler]
    
        cancelation_notification_recipients.each do |recipient|
          CancelationMailer.cancelation_notification(
    Severity: Minor
    Found in app/models/dispatcher.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method notify_observers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def notify_observers(needs_review, comment)
        only_observers.each do |observer|
          unless user_is_modifier?(observer, comment.user)
            if observer.role_on(proposal).observer_only?
              if needs_review == true
    Severity: Minor
    Found in app/models/dispatcher.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

    Re-enable Metrics/MethodLength cop with # rubocop:enable after disabling it.
    Open

      # rubocop:disable Metrics/MethodLength
    Severity: Minor
    Found in app/models/dispatcher.rb by rubocop

    Re-enable Style/Next cop with # rubocop:enable after disabling it.
    Open

            # rubocop:disable Style/Next
    Severity: Minor
    Found in app/models/dispatcher.rb by rubocop

    Re-enable Metrics/AbcSize cop with # rubocop:enable after disabling it.
    Open

      # rubocop:disable Metrics/AbcSize
    Severity: Minor
    Found in app/models/dispatcher.rb by rubocop

    There are no issues that match your filters.

    Category
    Status