Module: RuboCop::Cop::Cask::CaskHelp Private

Includes:
CommentsHelp, RuboCop::Cop::CommentsHelp
Included in:
Discontinued, NoOverrides, OnDescStanza, OnHomepageStanza, OnSystemConditionals, OnUrlStanza, StanzaGrouping, StanzaOrder, Variables
Defined in:
rubocops/cask/mixin/cask_help.rb,
rubocops/cask/mixin/cask_help.rbi

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

Instance Method Summary collapse

Instance Method Details

#inner_stanzas(block_node, comments) ⇒ Object

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.



37
38
39
40
41
# File 'rubocops/cask/mixin/cask_help.rb', line 37

def inner_stanzas(block_node, comments)
  block_contents = block_node.child_nodes.select(&:begin_type?)
  inner_nodes = block_contents.map(&:child_nodes).flatten.select(&:send_type?)
  inner_nodes.map { |n| RuboCop::Cask::AST::Stanza.new(n, comments) }
end

#on_block(block_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:

  • block_node (RuboCop::AST::BlockNode)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'rubocops/cask/mixin/cask_help.rb', line 18

def on_block(block_node)
  super if defined? super

  return if !block_node.cask_block? && !block_node.cask_on_system_block?

  comments = comments_in_range(block_node).to_a
  stanza_block = RuboCop::Cask::AST::StanzaBlock.new(block_node, comments)
  on_cask_stanza_block(stanza_block)

  return unless block_node.cask_block?

  cask_block = RuboCop::Cask::AST::CaskBlock.new(block_node, comments)
  on_cask(cask_block)
end

#on_cask(cask_block) ⇒ 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:



12
# File 'rubocops/cask/mixin/cask_help.rb', line 12

def on_cask(cask_block); end

#on_cask_stanza_block(cask_stanza_block) ⇒ 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:



15
# File 'rubocops/cask/mixin/cask_help.rb', line 15

def on_cask_stanza_block(cask_stanza_block); end

#on_system_methods(cask_stanzas) ⇒ Object

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.



33
34
35
# File 'rubocops/cask/mixin/cask_help.rb', line 33

def on_system_methods(cask_stanzas)
  cask_stanzas.select(&:on_system_block?)
end