Pattern: Unused method argument
Issue: -
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.
# bad
def some_method(used, unused, _unused_but_allowed)
puts used
end
# good
def some_method(used, _unused, _unused_but_allowed)
puts used
end
Attribute | Value |
---|---|
AllowUnusedKeywordArguments | false |
IgnoreEmptyMethods | true |