Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 648 Bytes

Lint-ShadowingOuterLocalVariable.md

File metadata and controls

37 lines (26 loc) · 648 Bytes

Pattern: Shadowing outer local variable

Issue: -

Description

This rule looks for use of the same name as outer local variables for block arguments or block local variables. This is a mimic of the warning shadowing outer local variable - foo from ruby -cw.

Examples

# bad

def some_method
  foo = 1

  2.times do |foo| # shadowing outer `foo`
    do_something(foo)
  end
end
# good

def some_method
  foo = 1

  2.times do |bar|
    do_something(bar)
  end
end

Further Reading