rubocop / rubocop/ruby-style-guide
Numbered parameters
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 16.5k
- Forks
- 3.3k
- PR merge metrics
- No merged PRs in 30d
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 }
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing this issue together with the linked PR introducing the numbered-parameters cop and its referenced discussion. Compare the proposed bad and good examples, resolve the open question about explicit array names and default style, and update the style guide once the project’s position is agreed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100