rubocop / rubocop/ruby-style-guide

Multi-line method calls with multi-line block

Open
#305 4 comments 0 reactions 0 assignees View on GitHub

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

I have a dilemma regarding styling this peace of code.

Should end on the last line be aligned with the start of the initial line or with the .map call?
It seems logical to be with .map but it looks better with initial line.

(2.weeks.ago.to_date..Date.today)
  .map do |date|
    time = date.to_time
    for_day(time)
  end

vs.

(2.weeks.ago.to_date..Date.today)
  .map do |date|
    time = date.to_time
    for_day(time)
end

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review issue 305 and its two Ruby formatting examples, then inspect the surrounding style-guide conventions for chained calls and block endings. A decision is complete when the guide clearly states the preferred alignment and the examples consistently demonstrate it.

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
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.