dphaener/kanji

View on GitHub
lib/kanji/type.rb

Summary

Maintainability
A
0 mins
Test Coverage

When using method_missing, fall back on super.
Open

    def method_missing(method_name, *args, &block)
      if resolve(:value).respond_to?(method_name)
        resolve(:value).send(method_name, *args)
      else
        super(method_name, *args, &block)
Severity: Minor
Found in lib/kanji/type.rb by rubocop

This cop checks for the presence of method_missing without also defining respond_to_missing? and falling back on super.

Example:

#bad
def method_missing(name, *args)
  # ...
end

#good
def respond_to_missing?(name, include_private)
  # ...
end

def method_missing(name, *args)
  # ...
  super
end

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

      if repo = self.class.resolve(:repo)
Severity: Minor
Found in lib/kanji/type.rb by rubocop

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

Use == if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition.
Open

      if repo = self.class.resolve(:repo)
Severity: Minor
Found in lib/kanji/type.rb by rubocop

This cop checks for assignments in the conditions of if/while/until.

Example:

# bad

if some_var = true
  do_something
end

Example:

# good

if some_var == true
  do_something
end

There are no issues that match your filters.

Category
Status