cookstyle 7.25.6 → 7.25.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a67abdf6a42bec1022fc57e53a61a9aa6f371641e6afe429eee6a9489ff2355
4
- data.tar.gz: c3ff11c1e6ef1be4af29d034d662a6b662a731103082477b0d8d0e9e3a0455e2
3
+ metadata.gz: c878c6f71305a020ad727f7487803d5b2e669b98efa8c454507fcdbf1b5d7780
4
+ data.tar.gz: 5bf633217017d6fff058d1214f7f0f28fe87b99107cf5d768bce2e68a2d1398e
5
5
  SHA512:
6
- metadata.gz: 79074fc5f3c7ef245dbcb64a4739a49298cda263bc216333215599bbc7e052f0979981e67572eec6d77b33c8e620370087b32ad20f90d2c5f5ddcbfaf99182cc
7
- data.tar.gz: 116535d0ada1a04fd19bb9af708390402aeeb983a962af1a681d66e9f9fa81afc515450f1bcae187dcf8de83876a8fd5c9a091ea0d93313033821f34263f51a8
6
+ metadata.gz: f575ac4b8b913935583fa697f82bb9fc6387f135c1a78d0ef2782df47def871bb5bce54f2a3b2df9c187af18eee08791e6173f6cb7a284356cfecbd844e8644a
7
+ data.tar.gz: 49a470d1a612896c887cbd8b879ab5c31a1d5180e454245f3abcd431f0725d7d3d9553342f48fdddf68b36fca682d2f778f42c642baf6e2acb65685b18edb5fc
data/config/cookstyle.yml CHANGED
@@ -1941,6 +1941,15 @@ Chef/Modernize/UseChefLanguageSystemdHelper:
1941
1941
  - '**/metadata.rb'
1942
1942
  - '**/Berksfile'
1943
1943
 
1944
+ Chef/Modernize/DeclareActionClass:
1945
+ Description: In Chef Infra Client 12.9 and later `action_class` can be used instead of `declare_action_class`.
1946
+ StyleGuide: 'chef_modernize_declareactionclass'
1947
+ Enabled: true
1948
+ VersionAdded: '7.26.0'
1949
+ Include:
1950
+ - '**/resources/*.rb'
1951
+ - '**/libraries/*.rb'
1952
+
1944
1953
  ###############################
1945
1954
  # Chef/RedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
1946
1955
  ###############################
data/config/upstream.yml CHANGED
@@ -262,7 +262,7 @@ Gemspec/RequiredRubyVersion:
262
262
  Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
263
263
  Enabled: true
264
264
  VersionAdded: '0.52'
265
- VersionChanged: '0.89'
265
+ VersionChanged: '1.22'
266
266
  Include:
267
267
  - '**/*.gemspec'
268
268
 
@@ -2754,10 +2754,9 @@ Security/JSONLoad:
2754
2754
  Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
2755
2755
  Enabled: true
2756
2756
  VersionAdded: '0.43'
2757
- VersionChanged: '0.44'
2757
+ VersionChanged: '1.22'
2758
2758
  # Autocorrect here will change to a method that may cause crashes depending
2759
2759
  # on the value of the argument.
2760
- AutoCorrect: false
2761
2760
  SafeAutoCorrect: false
2762
2761
 
2763
2762
  Security/MarshalLoad:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Cookstyle
3
- VERSION = "7.25.6" # rubocop: disable Style/StringLiterals
4
- RUBOCOP_VERSION = '1.22.0'
3
+ VERSION = "7.25.8" # rubocop: disable Style/StringLiterals
4
+ RUBOCOP_VERSION = '1.22.2'
5
5
  end
@@ -40,7 +40,6 @@ module RuboCop
40
40
  minimum_target_chef_version '12.9'
41
41
 
42
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
43
 
45
44
  def_node_matcher :class_eval_action_class?, <<-PATTERN
46
45
  (block
@@ -0,0 +1,54 @@
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 `action_class` can be used instead of `declare_action_class`.
23
+ #
24
+ # @example
25
+ #
26
+ # #### incorrect
27
+ # declare_action_class do
28
+ # foo
29
+ # end
30
+ #
31
+ # #### correct
32
+ # action_class do
33
+ # foo
34
+ # end
35
+ #
36
+ class DeclareActionClass < 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 `action_class` can be used instead of `declare_action_class`.'
43
+ RESTRICT_ON_SEND = [:declare_action_class].freeze
44
+
45
+ def on_send(node)
46
+ add_offense(node, message: MSG, severity: :refactor) do |corrector|
47
+ corrector.replace(node, node.source.gsub('declare_action_class', 'action_class'))
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
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.25.6
4
+ version: 7.25.8
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-09-30 00:00:00.000000000 Z
12
+ date: 2021-10-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubocop
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 1.22.0
20
+ version: 1.22.2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 1.22.0
27
+ version: 1.22.2
28
28
  description:
29
29
  email:
30
30
  - thom@chef.io
@@ -188,6 +188,7 @@ files:
188
188
  - lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb
189
189
  - lib/rubocop/cop/chef/modernize/cron_manage_resource.rb
190
190
  - lib/rubocop/cop/chef/modernize/databag_helpers.rb
191
+ - lib/rubocop/cop/chef/modernize/declare_action_class.rb
191
192
  - lib/rubocop/cop/chef/modernize/default_action_initializer.rb
192
193
  - lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb
193
194
  - lib/rubocop/cop/chef/modernize/definitions.rb