Class: RuboCop::Cop::Cask::StanzaGrouping Private

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector, Forwardable
Includes:
RangeHelp, CaskHelp
Defined in:
rubocops/cask/stanza_grouping.rb,
sorbet/rbi/dsl/rubo_cop/cop/cask/stanza_grouping.rbi

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.

This cop checks that a cask's stanzas are grouped correctly, including nested within on_* blocks.

Constant Summary collapse

MISSING_LINE_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.

"stanza groups should be separated by a single empty line"
EXTRA_LINE_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.

"stanzas within the same group should have no lines between them"

Instance Method Summary collapse

Methods included from CaskHelp

#cask_tap, #inner_stanzas, #on_block, #on_cask_stanza_block, #on_system_methods

Instance Method Details

#cask_node(*args, &block) ⇒ T.untyped

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.

Parameters:

  • args (T.untyped)
  • block (T.untyped)

Returns:

  • (T.untyped)


10
# File 'sorbet/rbi/dsl/rubo_cop/cop/cask/stanza_grouping.rbi', line 10

def cask_node(*args, &block); end

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



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'rubocops/cask/stanza_grouping.rb', line 20

def on_cask(cask_block)
  @cask_block = cask_block
  @line_ops = {}
  cask_stanzas = cask_block.toplevel_stanzas
  add_offenses(cask_stanzas)

  return if (on_blocks = on_system_methods(cask_stanzas)).none?

  on_blocks.map(&:method_node).select(&:block_type?).each do |on_block|
    stanzas = inner_stanzas(on_block, processed_source.comments)
    add_offenses(stanzas)
  end
end

#toplevel_stanzas(*args, &block) ⇒ T.untyped

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.

Parameters:

  • args (T.untyped)
  • block (T.untyped)

Returns:

  • (T.untyped)


13
# File 'sorbet/rbi/dsl/rubo_cop/cop/cask/stanza_grouping.rbi', line 13

def toplevel_stanzas(*args, &block); end