michaelherold/freedom

View on GitHub

Showing 2 of 2 total issues

Freedom::Patch#self.call is controlled by argument 'method_type'
Open

        case method_type
Severity: Minor
Found in lib/freedom/patch.rb by reek

Control Parameter is a special case of Control Couple

Example

A simple example would be the "quoted" parameter in the following method:

def write(quoted)
  if quoted
    write_quoted @value
  else
    write_unquoted @value
  end
end

Fixing those problems is out of the scope of this document but an easy solution could be to remove the "write" method alltogether and to move the calls to "writequoted" / "writeunquoted" in the initial caller of "write".

Freedom::Patch#self.define_hook contains iterators nested 2 deep
Open

        mod.define_singleton_method(hook_name) do |base|
Severity: Minor
Found in lib/freedom/patch.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)
Severity
Category
Status
Source
Language