Skip to content

Commit

Permalink
Move AttributeMetadata cop as well
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed Dec 9, 2019
1 parent 8432bc8 commit dd29ab9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
module RuboCop
module Cop
module Chef
module ChefDeprecations
# Don't use the deprecated 'attribute' metadata value
module ChefModernize
# The attribute metadata.rb method is not used and is unnecessary in cookbooks.
#
# @example
#
Expand All @@ -33,7 +33,7 @@ module ChefDeprecations
# default: '"127.0.0.1:2181"'
#
class AttributeMetadata < Cop
MSG = "Don't use the deprecated 'attribute' metadata value".freeze
MSG = 'The attribute metadata.rb method is not used and is unnecessary in cookbooks.'.freeze

def on_send(node)
add_offense(node, location: :expression, message: MSG, severity: :refactor) if node.method_name == :attribute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

require 'spec_helper'

describe RuboCop::Cop::Chef::ChefDeprecations::AttributeMetadata, :config do
describe RuboCop::Cop::Chef::ChefModernize::AttributeMetadata, :config do
subject(:cop) { described_class.new(config) }

it 'registers an offense when metadata uses "attribute"' do
expect_offense(<<~RUBY)
attribute 'foo'
^^^^^^^^^^^^^^^ Don't use the deprecated 'attribute' metadata value
^^^^^^^^^^^^^^^ The attribute metadata.rb method is not used and is unnecessary in cookbooks.
RUBY

expect_correction("\n")
Expand Down

0 comments on commit dd29ab9

Please sign in to comment.