dry-rb/dry-types

View on GitHub
lib/dry/types/coercions/params.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

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

            if block_given?
Severity: Minor
Found in lib/dry/types/coercions/params.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

Unused method argument - block. If it's necessary, use _ or _block as an argument name to indicate that it won't be used.
Open

        def self.to_decimal(input, &block)
Severity: Minor
Found in lib/dry/types/coercions/params.rb by rubocop

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

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

            if block_given?
Severity: Minor
Found in lib/dry/types/coercions/params.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 block_given?
Severity: Minor
Found in lib/dry/types/coercions/params.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