Class: RuboCop::Cop::Homebrew::FullNameSplit Private

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Defined in:
rubocops/full_name_split.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.

Checks for formula or cask full-name parsing that should use Utils.name_from_full_name.

Examples

# bad
name.split("/").last
token.split("/").fetch(-1)

# good
Utils.name_from_full_name(name)
Utils.name_from_full_name(token)

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.

"Use `Utils.name_from_full_name` instead of splitting formula or cask full names."
RESTRICT_ON_SEND =

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.

[:last, :fetch].freeze

Instance Method Summary collapse

Instance Method Details

#on_csend(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:

  • node (RuboCop::AST::SendNode)


51
52
53
# File 'rubocops/full_name_split.rb', line 51

def on_csend(node)
  check_full_name_split(node)
end

#on_send(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:

  • node (RuboCop::AST::SendNode)


46
47
48
# File 'rubocops/full_name_split.rb', line 46

def on_send(node)
  check_full_name_split(node)
end