Class: RuboCop::Cop::Cask::NoDslVersion

Inherits:
RuboCop::Cop show all
Extended by:
Forwardable
Includes:
CaskHelp
Defined in:
brew/Library/Homebrew/rubocops/cask/no_dsl_version.rb

Overview

Do not use the deprecated DSL version syntax in your cask header.

Examples:

# bad
cask :v1 => 'foo' do
  ...
end

# good
cask 'foo' do
  ...
end

Constant Summary collapse

MESSAGE =
"Use `%{preferred}` instead of `%{current}`"

Instance Method Summary collapse

Methods included from CaskHelp

#on_block

Instance Method Details

#autocorrect(method_node) ⇒ Object



33
34
35
36
37
38
# File 'brew/Library/Homebrew/rubocops/cask/no_dsl_version.rb', line 33

def autocorrect(method_node)
  @cask_header = cask_header(method_node)
  lambda do |corrector|
    corrector.replace(header_range, preferred_header_str)
  end
end

#on_cask(cask_block) ⇒ Object



26
27
28
29
30
31
# File 'brew/Library/Homebrew/rubocops/cask/no_dsl_version.rb', line 26

def on_cask(cask_block)
  @cask_header = cask_block.header
  return unless offense?

  offense
end