dry-rb/dry-monads

View on GitHub
lib/dry/monads/maybe.rb

Summary

Maintainability
A
0 mins
Test Coverage
D
62%

When using method_missing, define respond_to_missing?.
Open

        def self.method_missing(m, *)
          if (instance.methods(true) - methods(true)).include?(m)
            raise ConstructorNotAppliedError.new(m, :None)
          else
            super
Severity: Minor
Found in lib/dry/monads/maybe.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 value.some?
Severity: Minor
Found in lib/dry/monads/maybe.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 a guard clause instead of wrapping the code inside a conditional expression.
Open

          if (instance.methods(true) - methods(true)).include?(m)
Severity: Minor
Found in lib/dry/monads/maybe.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

There are no issues that match your filters.

Category
Status