A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rubocop/rubocop/issues/14322 below:

Discourage "it" as function parameter · Issue #14322 · rubocop/rubocop · GitHub

Is your feature request related to a problem? Please describe.
def foo1(it = 'bar')
  puts it
  'baz'.then { puts it }
end

foo1

def foo2(its = 'bar')
  puts its
  'baz'.then { |its| puts its }
end

foo2

Lint/ShadowingOuterLocalVariable doesn't warn when a function parameter named it takes precedence over an implicit it in a block.

Describe the solution you'd like

Warn about it (pun intended).

Describe alternatives you've considered

Rather, warn about using it as a function parameter, which seems like asking for trouble in the first place.

Additional context

I love it.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4