Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 539 Bytes

Lint-ReturnInVoidContext.md

File metadata and controls

39 lines (30 loc) · 539 Bytes

Pattern: return in void context

Issue: -

Description

This rule checks for the use of a return with a value in a context where the value will be ignored (initialize and setter methods).

Examples

# bad
def initialize
  foo
  return :qux if bar?
  baz
end

def foo=(bar)
  return 42
end
# good
def initialize
  foo
  return if bar?
  baz
end

def foo=(bar)
  return
end

Further Reading