Class: RuboCop::Cop::Cask::ZapNotRequired Private
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 replaces the # No zap stanza required comment with the
auditable zap :not_required stanza.
Example
bad
No zap stanza required
# good
zap :not_required
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 `zap :not_required` instead of a `# No zap stanza required` comment."
Instance Method Summary collapse
- #on_cask(cask_block) ⇒ void private
Methods included from CaskHelp
#cask_tap, #inner_stanzas, #on_block, #on_cask_stanza_block, #on_system_methods
Instance Method Details
#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.
23 24 25 26 27 28 29 30 31 32 |
# File 'rubocops/cask/zap_not_required.rb', line 23 def on_cask(cask_block) cask_block.comments.each do |comment| next unless comment.text.match?(/\A#\s*no zap stanza required\.?\z/i) next unless comment_line?(processed_source[comment.loc.line - 1]) add_offense(comment) do |corrector| corrector.replace(comment, "zap :not_required") end end end |