3scale/porta

View on GitHub
app/lib/three_scale/has_money.rb

Summary

Maintainability
A
0 mins
Test Coverage

ThreeScale::HasMoney::ClassMethods#has_money contains iterators nested 2 deep
Open

          define_method("#{name}=") do |value|
Severity: Minor
Found in app/lib/three_scale/has_money.rb by reek

A Nested Iterator occurs when a block contains another block.

Example

Given

class Duck
  class << self
    def duck_names
      %i!tick trick track!.each do |surname|
        %i!duck!.each do |last_name|
          puts "full name is #{surname} #{last_name}"
        end
      end
    end
  end
end

Reek would report the following warning:

test.rb -- 1 warning:
  [5]:Duck#duck_names contains iterators nested 2 deep (NestedIterators)

ThreeScale::HasMoney#read_money_attribute manually dispatches method call
Open

      if attribute.respond_to?(:call)
Severity: Minor
Found in app/lib/three_scale/has_money.rb by reek

Reek reports a Manual Dispatch smell if it finds source code that manually checks whether an object responds to a method before that method is called. Manual dispatch is a type of Simulated Polymorphism which leads to code that is harder to reason about, debug, and refactor.

Example

class MyManualDispatcher
  attr_reader :foo

  def initialize(foo)
    @foo = foo
  end

  def call
    foo.bar if foo.respond_to?(:bar)
  end
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [9]: MyManualDispatcher manually dispatches method call (ManualDispatch)

There are no issues that match your filters.

Category
Status