rubocop

https://github.com/bbatsov/rubocop

Ruby

A Ruby static code analyzer, based on the community Ruby style guide.

RuboCop::Cop::MultilineLiteralBraceLayout#last_line_heredoc?

Starting with the parent node and recursively for the parent node's
children, check if the node is a HEREDOC and if the HEREDOC ends below
or on the last line of the parent node.

Example:

  # node is `b: ...` parameter
  # last_line_heredoc?(node) => false
  foo(a,
    b: {
      a: 1,
      c: <<-EOM
        baz
      EOM
    }
  )

  # node is `b: ...` parameter
  # last_line_heredoc?(node) => true
  foo(a,
    b: <<-EOM
      baz
    EOM
  )

Source | Google | Stack overflow

Edit

git clone [email protected]:bbatsov/rubocop.git

cd rubocop

open lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-RuboCop--Cop--MultilineLiteralBraceLayout-last_line_heredoc--for-pr


# Commit to git

git add lib/rubocop/cop/mixin/multiline_literal_brace_layout.rbgit commit -m "better docs for RuboCop::Cop::MultilineLiteralBraceLayout#last_line_heredoc?"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-RuboCop--Cop--MultilineLiteralBraceLayout-last_line_heredoc--for-pr

hub pull-request


# Celebrate!