-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Description
Following my PR introducing a cop for numbered parameters, @koic suggested that choosing the default style required a discussion in the style guide.
As a basis, here is what we agreed upon in our team. "Explicit" array name is not per se enforcable with a cop, so I'm not sure how it would fit in the guide.
# bad - non explicit array name
results = electric_appliance.process!
results.each { _1.taste }
# bad - multi line block
waffles.each do
topping = @user.toppings.max_by(&:evaluation)
_1.spread topping
end
# bad - block can be created from method
waffles.each { _1.taste } # => waffles.each(&:taste)
waffles.each { taste(_1) } # => waffles.each(&method(:taste))
# good - explicit array name + single line block + necessity to write block
waffles.each { _1.spread(jam) }
waffles.filter { _1.baking == :well_done }
pirj
Metadata
Metadata
Assignees
Labels
No labels