Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable UseBuildEssentialResource and improve messaging #177

Merged
merged 1 commit into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions config/cookstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ Chef/UnnecessaryDependsChef14:
- '**/metadata.rb'

Chef/RespondToInMetadata:
Description: It is no longer necessary to use respond_to? in metadata.rb
Description: It is no longer necessary to use respond_to? in metadata.rb in Chef 12.15 and later
Enabled: true
VersionAdded: '5.1.0'
VersionAdded: '5.2.0'
Include:
- '**/metadata.rb'

Expand All @@ -278,8 +278,8 @@ Chef/MetadataMissingName:
###############################

Chef/UseBuildEssentialResource:
Description: Use the build_essential resource instead of the legacy build-essential recipe
Enabled: false
Description: Use the build_essential resource instead of the legacy build-essential recipe. This resource ships in the build-essential cookbook v5.0+ and is built into Chef Infra Client 14+
Enabled: true
VersionAdded: '5.1.0'

###############################
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/chef/deprecation/respond_to_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module Chef
#

class RespondToInMetadata < Cop
MSG = 'It is no longer necessary to use respond_to? in metadata.rb'.freeze
MSG = 'It is no longer necessary to use respond_to? in metadata.rb in Chef 12.15 and later'.freeze

def on_if(node)
if_repond_to?(node) do
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/chef/modernize/build_essential.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Chef
# # good
# build_essential 'install compilation tools'
class UseBuildEssentialResource < Cop
MSG = 'Use the build_essential resource built into Chef 14+ instead of the legacy build-essential recipe'.freeze
MSG = 'Use the build_essential resource instead of the legacy build-essential recipe. This resource ships in the build-essential cookbook v5.0+ and is built into Chef Infra Client 14+'.freeze

def_node_matcher :build_essential_recipe_usage?, <<-PATTERN
(send nil? :include_recipe (str {"build-essential" "build-essential::default"}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
it "registers an offense when metadata includes the 'if respond_to?(:foo)' gate" do
expect_violation(<<-RUBY)
chef_version '> 13' if respond_to?(:chef_version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It is no longer necessary to use respond_to? in metadata.rb
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It is no longer necessary to use respond_to? in metadata.rb in Chef 12.15 and later
RUBY
end

Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/chef/modernize/build_essential_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
it 'registers an when including the "build-essential" recipe' do
expect_violation(<<-RUBY)
include_recipe 'build-essential'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use the build_essential resource built into Chef 14+ instead of the legacy build-essential recipe
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use the build_essential resource instead of the legacy build-essential recipe. This resource ships in the build-essential cookbook v5.0+ and is built into Chef Infra Client 14+
RUBY
end

it 'registers an offense when including the "build-essential::default" recipe' do
expect_violation(<<-RUBY)
include_recipe 'build-essential::default'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use the build_essential resource built into Chef 14+ instead of the legacy build-essential recipe
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use the build_essential resource instead of the legacy build-essential recipe. This resource ships in the build-essential cookbook v5.0+ and is built into Chef Infra Client 14+
RUBY
end

Expand Down