app/services/invoicing/conflicts_handler.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
96%

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

    def blocking_conflict?(conflict)
      message = conflict["value"]

      matching = CONFLICTS.find do |config|
        case config.mode

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.

Line is too long. [126/100]
Open

    Conflict.new(message: "Value is zero and not significant, must match data element:", mode: :starts_with, blocking: false),

Line is too long. [103/100]
Open

    Conflict.new(message: "is not open for this data set at this time", mode: :include, blocking: true)

Don't extend an instance initialized by Struct.new. Use a block to customize the struct.
Open

  class Conflict < Struct.new(:message, :mode, :blocking, keyword_init: true); end

This cop checks for inheritance from Struct.new.

Example:

# bad
class Person < Struct.new(:first_name, :last_name)
  def age
    42
  end
end

# good
Person = Struct.new(:first_name, :last_name) do
  def age
    42
  end
end

Line is too long. [117/100]
Open

    Conflict.new(message: "must be assigned through data sets to organisation unit", mode: :include, blocking: true),

Use a guard clause (return unless blocking_conflicts.any?) instead of wrapping the code inside a conditional expression.
Open

      if blocking_conflicts.any?

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

Line is too long. [103/100]
Open

    Conflict.new(message: "Data element not found or not acccessible", mode: :include, blocking: true),

Line is too long. [114/100]
Open

    Conflict.new(message: "Category option combo is required but is not specified", mode: :equal, blocking: true),

Line is too long. [121/100]
Open

    Conflict.new(message: "Data value is not numeric, must match data element type", mode: :starts_with, blocking: true),

Line is too long. [105/100]
Open

    Conflict.new(message: "Current date is past expiry days for period", mode: :include, blocking: true),

There are no issues that match your filters.

Category
Status