app/services/invoicing/conflicts_handler.rb
Method has too many lines. [15/10] Open
Open
def blocking_conflict?(conflict)
message = conflict["value"]
matching = CONFLICTS.find do |config|
case config.mode
- Read upRead up
- Exclude checks
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
Open
Conflict.new(message: "Value is zero and not significant, must match data element:", mode: :starts_with, blocking: false),
- Exclude checks
Line is too long. [103/100] Open
Open
Conflict.new(message: "is not open for this data set at this time", mode: :include, blocking: true)
- Exclude checks
Don't extend an instance initialized by Struct.new
. Use a block to customize the struct. Open
Open
class Conflict < Struct.new(:message, :mode, :blocking, keyword_init: true); end
- Read upRead up
- Exclude checks
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
Open
Conflict.new(message: "must be assigned through data sets to organisation unit", mode: :include, blocking: true),
- Exclude checks
Use a guard clause (return unless blocking_conflicts.any?
) instead of wrapping the code inside a conditional expression. Open
Open
if blocking_conflicts.any?
- Read upRead up
- Exclude checks
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
Open
Conflict.new(message: "Data element not found or not acccessible", mode: :include, blocking: true),
- Exclude checks
Line is too long. [114/100] Open
Open
Conflict.new(message: "Category option combo is required but is not specified", mode: :equal, blocking: true),
- Exclude checks
Line is too long. [121/100] Open
Open
Conflict.new(message: "Data value is not numeric, must match data element type", mode: :starts_with, blocking: true),
- Exclude checks
Line is too long. [105/100] Open
Open
Conflict.new(message: "Current date is past expiry days for period", mode: :include, blocking: true),
- Exclude checks