Skip to content

Files

Latest commit

 

History

History
36 lines (25 loc) · 905 Bytes

Lint-UnusedMethodArgument.md

File metadata and controls

36 lines (25 loc) · 905 Bytes

Pattern: Unused method argument

Issue: -

Description

Use _ to prefix unused block parameters and local variables. It's also acceptable to use just _ (although it's a bit less descriptive). This convention is recognized by the Ruby interpreter and tools like RuboCop and will suppress their unused variable warnings.

Examples

# bad

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

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

Default configuration

Attribute Value
AllowUnusedKeywordArguments false
IgnoreEmptyMethods true

Further Reading