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
- #cask_tap ⇒ String? private
- #inner_stanzas(block_node, comments) ⇒ Array<RuboCop::Cask::AST::Stanza> private
- #on_block(block_node) ⇒ void private
- #on_cask(cask_block) ⇒ void private
- #on_cask_stanza_block(cask_stanza_block) ⇒ void private
- #on_system_methods(cask_stanzas) ⇒ Array<RuboCop::Cask::AST::Stanza> private
Instance Method Details
#cask_tap ⇒ String?
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.
61 62 63 64 65 |
# File 'rubocops/cask/mixin/cask_help.rb', line 61 def cask_tap return unless (match_obj = @file_path&.match(%r{/(homebrew-\w+)/})) match_obj[1] end |
#inner_stanzas(block_node, comments) ⇒ Array<RuboCop::Cask::AST::Stanza>
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.
54 55 56 57 58 |
# File 'rubocops/cask/mixin/cask_help.rb', line 54 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.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# 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? @file_path = T.let(processed_source.file_path, T.nilable(String)) 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.
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.
15 |
# File 'rubocops/cask/mixin/cask_help.rb', line 15 def on_cask_stanza_block(cask_stanza_block); end |
#on_system_methods(cask_stanzas) ⇒ Array<RuboCop::Cask::AST::Stanza>
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.
42 43 44 |
# File 'rubocops/cask/mixin/cask_help.rb', line 42 def on_system_methods(cask_stanzas) cask_stanzas.select(&:on_system_block?) end |