Class: RuboCop::Cop::Homebrew::NoMultilineInterpolation Private

Inherits:
Base
  • Object
show all
Defined in:
rubocops/no_multiline_interpolation.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Keep each interpolation on one line so the surrounding text is easy to read.

Examples:

# bad
"HTTP #{response.dig(:redirect,
                     :status)}"

# good
redirect = response[:redirect]
"HTTP #{redirect[:status]}"

Constant Summary collapse

MSG =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

"Keep each interpolation on one line."

Instance Method Summary collapse

Instance Method Details

#on_begin(node) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.

Parameters:



21
22
23
# File 'rubocops/no_multiline_interpolation.rb', line 21

def on_begin(node)
  add_offense(node.loc.begin) if node.loc_is?(:begin, '#{') && node.multiline?
end