rubocop / rubocop/ruby-style-guide

New cop for surrounding multiline code blocks by empty lines

Open
#961 2 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

# bad

def foo
  x = 1
  y = 1
  if bar
    zoo
    quux
  end
  false
end

# good

def foo
  x = 1
  y = 1

  if bar # <--- multiline, should be separated by a blank line from its neighbors
    zoo
    quux
  end

  false
end

These extra spaces adds breathing room and makes code easier to read.
I am going to implement this in my app as a custom cop. If this is welcome in core, let me know.

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

Start with the bad and good Ruby examples in this issue; no repository file or test entry point is identified. Confirm the intended cop scope and where such a rule belongs, then consider it done when surrounding multiline blocks are consistently separated by blank lines and the behavior is covered by the project's tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
documentation, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.