Skip to content

Files

Latest commit

 

History

History
35 lines (25 loc) · 693 Bytes

Lint-ToEnumArguments.md

File metadata and controls

35 lines (25 loc) · 693 Bytes

Pattern: Wrong arguments for to_enum/enum_for

Issue: -

Description

Ensures that to_enum/enum_for, called for the current method, has correct arguments.

Examples

# bad
def method(x, y = 1)
  return to_enum(__method__, x) # `y` is missing
end

# good
def method(x, y = 1)
  return to_enum(__method__, x, y)
end

# bad
def method(required:)
  return to_enum(:method, required: something) # `required` has incorrect value
end

# good
def method(required:)
  return to_enum(:method, required: required)
end

Further Reading