cookstyle 7.22.3 → 7.23.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f991818edd484753a75e2c0ae4e0d363f48b9213189cd4240bda17b08e260d4
4
- data.tar.gz: fa69ed0eb47f5276d723b7f75acd6c08f21e8c57391f6c1b8c71f2e74c023880
3
+ metadata.gz: 9be1741ac594805428a4c1269af0b63e1176abf6e14aa6e04c47639c1153f083
4
+ data.tar.gz: b7d95d2ba12571d8a09d1a6eabaacce48e2ee0956ac91c595d7c5be5e010978b
5
5
  SHA512:
6
- metadata.gz: 5f5a09a0805b0b184e1fe10e90bbdd0270a537b4c823560f74f1b4cfd6e6ea332fc62fc6695595b92cf35733db3871d94a037b4747681572bd0925525c7a3da9
7
- data.tar.gz: 5118bf5677557d03e0e730de31670c7defcd943d5d356147f40eed1c86118f463f29083f081d4af0e622c7375db9415c5b9e57da933291c441c500ee658d6265
6
+ metadata.gz: 4409915af7d5e193e9fcbc49c333370aa318e50c4a798ccee1a6b619912b4ff3bd6f8016b67f96da4f3ba10bda212e453d45fbfe5ec3a611d6eb64a78911820f
7
+ data.tar.gz: cb2d001bd4d5fb913dbb6a14972bb341e43fa982a926ae30a37d3adcce6e5fc599a8e535ff53dd82cac3dddf8de8fde0ce49c1e1db9192e83ad51a99c609a0f2
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gemspec
7
7
  group :debug do
8
8
  gem 'pry'
9
9
  gem 'pry-byebug'
10
- gem 'pry-stack_explorer', '< 0.4.13' # 0.4.13+ drops support for Ruby < 2.6
10
+ gem 'pry-stack_explorer', '<= 0.4.13' # 0.4.13+ drops support for Ruby < 2.6
11
11
  end
12
12
 
13
13
  group :docs do
data/config/cookstyle.yml CHANGED
@@ -1897,7 +1897,7 @@ Chef/Modernize/DependsOnOpensslCookbook:
1897
1897
  - '**/metadata.rb'
1898
1898
 
1899
1899
  Chef/Modernize/UseChefLanguageEnvHelpers:
1900
- Description: Chef Infra Client 15.5 and later include a large number of new helpers in the Chef Infra Language to simplify checking the system configuration in recipes and resources. These should be used when possible over more complex attribute or ENV var comparisons.
1900
+ Description: Chef Infra Client 15.5 and later include a large number of new helpers in the Chef Infra Language to simplify checking the system configuration in recipes and resources. These should be used when possible over more complex attributes or ENV var comparisons.
1901
1901
  StyleGuide: 'chef_modernize_usecheflanguageenvhelpers'
1902
1902
  Enabled: true
1903
1903
  VersionAdded: '7.21.0'
@@ -1907,7 +1907,7 @@ Chef/Modernize/UseChefLanguageEnvHelpers:
1907
1907
  - '**/recipes/*.rb'
1908
1908
 
1909
1909
  Chef/Modernize/UseChefLanguageCloudHelpers:
1910
- Description: hef Infra Client 15.5 and later include cloud helpers to make detecting instance that run on public and private clouds easier.
1910
+ Description: Chef Infra Client 15.5 and later include cloud helpers to make detecting instances that run on public and private clouds easier.
1911
1911
  StyleGuide: 'chef_modernize_usecheflanguagecloudhelpers'
1912
1912
  Enabled: true
1913
1913
  VersionAdded: '7.22.0'
@@ -1916,6 +1916,14 @@ Chef/Modernize/UseChefLanguageCloudHelpers:
1916
1916
  - '**/providers/*.rb'
1917
1917
  - '**/recipes/*.rb'
1918
1918
 
1919
+ Chef/Modernize/ClassEvalActionClass:
1920
+ Description: In Chef Infra Client 12.9 and later it is no longer necessary to call the class_eval method on the action class block.
1921
+ StyleGuide: 'chef_modernize_classevalactionclass'
1922
+ Enabled: true
1923
+ VersionAdded: '7.23.0'
1924
+ Include:
1925
+ - '**/resources/*.rb'
1926
+
1919
1927
  ###############################
1920
1928
  # Chef/RedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
1921
1929
  ###############################
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Cookstyle
3
- VERSION = "7.22.3" # rubocop: disable Style/StringLiterals
3
+ VERSION = "7.23.0" # rubocop: disable Style/StringLiterals
4
4
  RUBOCOP_VERSION = '1.20.0'
5
5
  end
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Deprecations
22
- # Chef Infra Client 15.3 and later include a new Unified Mode that simplifies the execution of resources by replace the traditional compile and converge phases with a single phase. Unified mode simplies writing advanced resources and avoids confusing errors that often occur when mixing ruby and Chef Infra resources. Chef Infra Client 17.0 and later will begin warning that `unified_mode true` should be set in all resources to validate that they will continue to function in Chef Infra Client 18.0 (April 2022) when Unified Mode becomes the default.
22
+ # Chef Infra Client 15.3 and later include a new Unified Mode that simplifies the execution of resources by replace the traditional compile and converge phases with a single phase. Unified mode simplifies writing advanced resources and avoids confusing errors that often occur when mixing ruby and Chef Infra resources. Chef Infra Client 17.0 and later will begin warning that `unified_mode true` should be set in all resources to validate that they will continue to function in Chef Infra Client 18.0 (April 2022) when Unified Mode becomes the default.
23
23
  #
24
24
  # @example
25
25
  #
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: 2021, Chef Software, Inc.
4
+ # Author:: Tim Smith (<tsmith@chef.io>)
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module RuboCop
19
+ module Cop
20
+ module Chef
21
+ module Modernize
22
+ # In Chef Infra Client 12.9 and later it is no longer necessary to call the class_eval method on the action class block.
23
+ #
24
+ # @example
25
+ #
26
+ # #### incorrect
27
+ # action_class.class_eval do
28
+ # foo
29
+ # end
30
+ #
31
+ # #### correct
32
+ # action_class do
33
+ # foo
34
+ # end
35
+ #
36
+ class ClassEvalActionClass < Base
37
+ extend TargetChefVersion
38
+ extend AutoCorrector
39
+
40
+ minimum_target_chef_version '12.9'
41
+
42
+ MSG = 'In Chef Infra Client 12.9 and later it is no longer necessary to call the class_eval method on the action class block.'
43
+ RESTRICT_ON_SEND = [:include_recipe].freeze
44
+
45
+ def_node_matcher :class_eval_action_class?, <<-PATTERN
46
+ (block
47
+ (send
48
+ (send nil? :action_class) :class_eval)
49
+ (args)
50
+ ... )
51
+ PATTERN
52
+
53
+ def on_block(node)
54
+ class_eval_action_class?(node) do
55
+ add_offense(node, message: MSG, severity: :refactor) do |corrector|
56
+ corrector.replace(node, node.source.gsub('.class_eval', ''))
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Modernize
22
- # Chef Infra Client 15.5 and later include cloud helpers to make detecting instance that run on public and private clouds easier.
22
+ # Chef Infra Client 15.5 and later include cloud helpers to make detecting instances that run on public and private clouds easier.
23
23
  #
24
24
  # @example
25
25
  #
@@ -50,7 +50,7 @@ module RuboCop
50
50
  class UseChefLanguageCloudHelpers < Base
51
51
  extend AutoCorrector
52
52
 
53
- MSG = 'Chef Infra Client 15.5 and later include cloud helpers to make detecting instance that run on public and private clouds easier.'
53
+ MSG = 'Chef Infra Client 15.5 and later include cloud helpers to make detecting instances that run on public and private clouds easier.'
54
54
  RESTRICT_ON_SEND = [:==, :[]].freeze
55
55
  VALID_CLOUDS = %w(alibaba ec2 gce rackspace eucalyptus linode openstack azure digital_ocean softlayer).freeze
56
56
 
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Modernize
22
- # Chef Infra Client 15.5 and later include a large number of new helpers in the Chef Infra Language to simplify checking the system configuration in recipes and resources. These should be used when possible over more complex attribute or ENV var comparisons.
22
+ # Chef Infra Client 15.5 and later include a large number of new helpers in the Chef Infra Language to simplify checking the system configuration in recipes and resources. These should be used when possible over more complex attributes or ENV var comparisons.
23
23
  #
24
24
  # @example
25
25
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cookstyle
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.22.3
4
+ version: 7.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thom May
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-08-27 00:00:00.000000000 Z
12
+ date: 2021-09-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubocop
@@ -181,6 +181,7 @@ files:
181
181
  - lib/rubocop/cop/chef/modernize/chef_14_resources.rb
182
182
  - lib/rubocop/cop/chef/modernize/chef_15_resources.rb
183
183
  - lib/rubocop/cop/chef/modernize/chef_gem_nokogiri.rb
184
+ - lib/rubocop/cop/chef/modernize/class_eval_action_class.rb
184
185
  - lib/rubocop/cop/chef/modernize/compile_time_resources.rb
185
186
  - lib/rubocop/cop/chef/modernize/conditional_using_test.rb
186
187
  - lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb