cookstyle 7.19.0 → 7.20.0

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: 61c40a5894885af02650005d23a37fd8409f68286e748b17d14e96ae0fe0243f
4
- data.tar.gz: 367b410c6654f7513e80138a389870d75810e7020feefe46b9586e76dd1821f3
3
+ metadata.gz: 1beeee72a35f1c32830c7c968ba50d7a277bed019de89697fb54e232d53cfa3d
4
+ data.tar.gz: 98a912f077a8d14033a03ace34622f1b651dec2b1aea69e3c7c8121f9c487423
5
5
  SHA512:
6
- metadata.gz: 2cced7f9b44a843941f8545bcbfa44996e5113227a6972be695f3acb86f2e7692c33f657f41617b12508a3523b3427612c55be6c071f56321819387efaf00a57
7
- data.tar.gz: f0bbf8ce69ae9165c47a781654bca44904d2261269771fe117276ed9b63e6e857fe03717015e52100fa545d7c49c2a5658ca355d64a090dfc484ea6811a77b21
6
+ metadata.gz: b7a79148cf57524f1df2f880fcaea77f82cff8d87f1b2e347c1f0ed39a6629bfd91436caa4c7a6b55d99da6d2429e8bea99d9feeb78bc29585458bddf739f4a1
7
+ data.tar.gz: 6793431fc22cb1de03923569fcf0d2fb57fe3e0b646df99579752fa999d1898956b799dd2734b1e0459bc156fb48081ba685ad0fbedd45204b3b45a9438a5101
data/config/cookstyle.yml CHANGED
@@ -490,7 +490,7 @@ Chef/Correctness/MetadataMalformedDepends:
490
490
  - '**/metadata.rb'
491
491
 
492
492
  Chef/Correctness/PowershellFileExists:
493
- Description: Use Ruby's built-in `File.exist?('C:\somefile') instead of executing PowerShell's `Test-Path` cmdlet, which takes longer to load.
493
+ Description: Use Ruby's built-in `File.exist?('C:\somefile')` method instead of executing PowerShell's `Test-Path` cmdlet, which takes longer to load.
494
494
  StyleGuide: 'chef_correctness_powershellfileexists'
495
495
  Enabled: true
496
496
  VersionAdded: '7.19'
@@ -1246,6 +1246,30 @@ Chef/Deprecations/DeprecatedSudoActions:
1246
1246
  - '**/Berksfile'
1247
1247
  - '**/Rakefile'
1248
1248
 
1249
+ Chef/Deprecations/DependsOnChefNginxCookbook:
1250
+ Description: Don't depend on the deprecated `chef_nginx` cookbook that was replaced by the `nginx` cookbook. The legacy chef_nginx cookbook may not be compatible with newer Chef Infra Client releases.
1251
+ StyleGuide: 'chef_deprecations_dependsonchefnginxcookbook'
1252
+ Enabled: true
1253
+ VersionAdded: '7.20.0'
1254
+ Include:
1255
+ - '**/metadata.rb'
1256
+
1257
+ Chef/Deprecations/DependsOnChefReportingCookbook:
1258
+ Description: Don't depend on the chef-reporting cookbook made obsolete by Chef Infra Client 11.6. This cookbook installs a gem that is not compatible with newer Chef Infra Client releases.
1259
+ StyleGuide: 'chef_deprecations_dependsonchefreportingcookbook'
1260
+ Enabled: true
1261
+ VersionAdded: '7.20.0'
1262
+ Include:
1263
+ - '**/metadata.rb'
1264
+
1265
+ Chef/Deprecations/DependsOnOmnibusUpdaterCookbook:
1266
+ Description: Don't depend on the EOL `omnibus_updater` cookbook. This cookbook no longer works with newer Chef Infra Client releases and has been replaced by with the more reliable `chef_client_updater` cookbook.
1267
+ StyleGuide: 'chef_deprecations_dependsonomnibusupdatercookbook'
1268
+ Enabled: true
1269
+ VersionAdded: '7.20.0'
1270
+ Include:
1271
+ - '**/metadata.rb'
1272
+
1249
1273
  ###############################
1250
1274
  # Chef/Modernize: Cleaning up legacy code and using new built-in resources
1251
1275
  ###############################
@@ -1848,6 +1872,30 @@ Chef/Modernize/DependsOnKernelModuleCookbook:
1848
1872
  Include:
1849
1873
  - '**/metadata.rb'
1850
1874
 
1875
+ Chef/Modernize/DependsOnChefVaultCookbook:
1876
+ Description: Don't depend on the chef-vault cookbook made obsolete by Chef Infra Client 16.0. The chef-vault gem and helpers are now included in Chef Infra Client itself.
1877
+ StyleGuide: 'chef_modernize_dependsonchefvaultcookbook'
1878
+ Enabled: true
1879
+ VersionAdded: '7.20.0'
1880
+ Include:
1881
+ - '**/metadata.rb'
1882
+
1883
+ Chef/Modernize/DependsOnChocolateyCookbooks:
1884
+ Description: Don't depend on the chocolatey_source or chocolatey_config cookbooks made obsolete by Chef Infra Client 14.3. The chocolatey_source and chocolatey_config resources are now included in Chef Infra Client itself.
1885
+ StyleGuide: 'chef_modernize_dependsonchocolateycookbooks'
1886
+ Enabled: true
1887
+ VersionAdded: '7.20.0'
1888
+ Include:
1889
+ - '**/metadata.rb'
1890
+
1891
+ Chef/Modernize/DependsOnOpensslCookbook:
1892
+ Description: Don't depend on the openssl cookbook which was made obsolete by Chef Infra Client 14.4. All openssl resource are now included directly in Chef Infra Client.
1893
+ StyleGuide: 'chef_modernize_dependsonopensslcookbook'
1894
+ Enabled: true
1895
+ VersionAdded: '7.20.0'
1896
+ Include:
1897
+ - '**/metadata.rb'
1898
+
1851
1899
  ###############################
1852
1900
  # Chef/RedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
1853
1901
  ###############################
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Cookstyle
3
- VERSION = "7.19.0" # rubocop: disable Style/StringLiterals
3
+ VERSION = "7.20.0" # rubocop: disable Style/StringLiterals
4
4
  RUBOCOP_VERSION = '1.19.0'
5
5
  end
@@ -19,7 +19,7 @@ module RuboCop
19
19
  module Cop
20
20
  module Chef
21
21
  module Correctness
22
- # Use Ruby's built-in `File.exist?('C:\somefile') instead of executing PowerShell's `Test-Path` cmdlet, which takes longer to load.
22
+ # Use Ruby's built-in `File.exist?('C:\somefile')` method instead of executing PowerShell's `Test-Path` cmdlet, which takes longer to load.
23
23
  #
24
24
  # @example
25
25
  #
@@ -31,7 +31,7 @@ module RuboCop
31
31
  #
32
32
  class PowershellFileExists < Base
33
33
  RESTRICT_ON_SEND = [:powershell_out, :powershell_out!].freeze
34
- MSG = "Use Ruby's built-in `File.exist?('C:\somefile') instead of executing PowerShell's `Test-Path` cmdlet, which takes longer to load."
34
+ MSG = "Use Ruby's built-in `File.exist?('C:\\somefile')` method instead of executing PowerShell's `Test-Path` cmdlet, which takes longer to load."
35
35
 
36
36
  def_node_matcher :powershell_out_exists?, <<-PATTERN
37
37
  (send nil? {:powershell_out :powershell_out!} (str $_))
@@ -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 Deprecations
22
+ # Don't depend on the deprecated `chef_nginx` cookbook that was replaced by the `nginx` cookbook. The legacy chef_nginx cookbook may not be compatible with newer Chef Infra Client releases.
23
+ #
24
+ # @example
25
+ #
26
+ # #### incorrect
27
+ # depends 'chef_nginx'
28
+ #
29
+ # #### correct
30
+ # depends 'nginx'
31
+ #
32
+ class DependsOnChefNginxCookbook < Base
33
+ include RangeHelp
34
+ extend AutoCorrector
35
+
36
+ MSG = "Don't depend on the deprecated `chef_nginx` cookbook that was replaced by the `nginx` cookbook."
37
+ RESTRICT_ON_SEND = [:depends].freeze
38
+
39
+ def_node_matcher :depends_compat_resource?, <<-PATTERN
40
+ (send nil? :depends (str {"chef_nginx"}))
41
+ PATTERN
42
+
43
+ def on_send(node)
44
+ depends_compat_resource?(node) do
45
+ add_offense(node, message: MSG, severity: :warning) do |corrector|
46
+ corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,51 @@
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 Deprecations
22
+ # Don't depend on the chef-reporting cookbook made obsolete by Chef Infra Client 11.6. This cookbook installs a gem that is not compatible with newer Chef Infra Client releases.
23
+ #
24
+ # @example
25
+ #
26
+ # #### incorrect
27
+ # depends 'chef-reporting'
28
+ #
29
+ class DependsOnChefReportingCookbook < Base
30
+ extend AutoCorrector
31
+ include RangeHelp
32
+
33
+ MSG = "Don't depend on the chef-reporting cookbook made obsolete by Chef Infra Client 11.6. This cookbook installs a gem that is not compatible with newer Chef Infra Client releases."
34
+ RESTRICT_ON_SEND = [:depends].freeze
35
+
36
+ def_node_matcher :legacy_depends?, <<-PATTERN
37
+ (send nil? :depends (str "chef-reporting") ... )
38
+ PATTERN
39
+
40
+ def on_send(node)
41
+ legacy_depends?(node) do
42
+ add_offense(node, message: MSG, severity: :warning) do |corrector|
43
+ corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -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 Deprecations
22
+ # Don't depend on the EOL `omnibus_updater` cookbook. This cookbook no longer works with newer Chef Infra Client releases and has been replaced by with the more reliable `chef_client_updater` cookbook.
23
+ #
24
+ # @example
25
+ #
26
+ # #### incorrect
27
+ # depends 'omnibus_updater'
28
+ #
29
+ # #### correct
30
+ # depends 'chef_client_updater'
31
+ #
32
+ class DependsOnOmnibusUpdaterCookbook < Base
33
+ extend AutoCorrector
34
+ include RangeHelp
35
+
36
+ MSG = "Don't depend on the EOL `omnibus_updater` cookbook. This cookbook no longer works with newer Chef Infra Client releases and has been replaced by with the more reliable `chef_client_updater` cookbook."
37
+ RESTRICT_ON_SEND = [:depends].freeze
38
+
39
+ def_node_matcher :legacy_depends?, <<-PATTERN
40
+ (send nil? :depends (str "omnibus_updater") ... )
41
+ PATTERN
42
+
43
+ def on_send(node)
44
+ legacy_depends?(node) do
45
+ add_offense(node, message: MSG, severity: :warning) do |corrector|
46
+ corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -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
+ # Don't depend on the chef-vault cookbook made obsolete by Chef Infra Client 16.0. The chef-vault gem and helpers are now included in Chef Infra Client itself.
23
+ #
24
+ # @example
25
+ #
26
+ # #### incorrect
27
+ # depends 'chef-vault'
28
+ #
29
+ class DependsOnChefVaultCookbook < Base
30
+ extend AutoCorrector
31
+ extend TargetChefVersion
32
+ include RangeHelp
33
+
34
+ minimum_target_chef_version '16.0'
35
+
36
+ MSG = "Don't depend on the chef-vault cookbook made obsolete by Chef Infra Client 16.0. The chef-vault gem and helpers are now included in Chef Infra Client itself."
37
+ RESTRICT_ON_SEND = [:depends].freeze
38
+
39
+ def_node_matcher :legacy_depends?, <<-PATTERN
40
+ (send nil? :depends (str "chef-vault") ... )
41
+ PATTERN
42
+
43
+ def on_send(node)
44
+ legacy_depends?(node) do
45
+ add_offense(node, message: MSG, severity: :refactor) do |corrector|
46
+ corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,55 @@
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
+ # Don't depend on the chocolatey_source or chocolatey_config cookbooks made obsolete by Chef Infra Client 14.3. The chocolatey_source and chocolatey_config resources are now included in Chef Infra Client itself.
23
+ #
24
+ # @example
25
+ #
26
+ # #### incorrect
27
+ # depends 'chocolatey_source'
28
+ # depends 'chocolatey_config'
29
+ #
30
+ class DependsOnChocolateyCookbooks < Base
31
+ extend AutoCorrector
32
+ extend TargetChefVersion
33
+ include RangeHelp
34
+
35
+ minimum_target_chef_version '14.3'
36
+
37
+ MSG = "Don't depend on the chocolatey_source or chocolatey_config cookbooks made obsolete by Chef Infra Client 14.3. The chocolatey_source and chocolatey_config resources are now included in Chef Infra Client itself."
38
+ RESTRICT_ON_SEND = [:depends].freeze
39
+
40
+ def_node_matcher :legacy_depends?, <<-PATTERN
41
+ (send nil? :depends (str {"chocolatey_source" "chocolatey_config"}) ... )
42
+ PATTERN
43
+
44
+ def on_send(node)
45
+ legacy_depends?(node) do
46
+ add_offense(node, message: MSG, severity: :refactor) do |corrector|
47
+ corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -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
+ # Don't depend on the openssl cookbook which was made obsolete by Chef Infra Client 14.4. All openssl resource are now included directly in Chef Infra Client.
23
+ #
24
+ # @example
25
+ #
26
+ # #### incorrect
27
+ # depends 'openssl'
28
+ #
29
+ class DependsOnOpensslCookbook < Base
30
+ extend AutoCorrector
31
+ extend TargetChefVersion
32
+ include RangeHelp
33
+
34
+ minimum_target_chef_version '14.4'
35
+
36
+ MSG = "Don't depend on the openssl cookbook which was made obsolete by Chef Infra Client 14.4. All openssl resource are now included directly in Chef Infra Client."
37
+ RESTRICT_ON_SEND = [:depends].freeze
38
+
39
+ def_node_matcher :legacy_depends?, <<-PATTERN
40
+ (send nil? :depends (str "openssl") ... )
41
+ PATTERN
42
+
43
+ def on_send(node)
44
+ legacy_depends?(node) do
45
+ add_offense(node, message: MSG, severity: :refactor) do |corrector|
46
+ corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
47
+ end
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.19.0
4
+ version: 7.20.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-18 00:00:00.000000000 Z
12
+ date: 2021-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubocop
@@ -100,7 +100,10 @@ files:
100
100
  - lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb
101
101
  - lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb
102
102
  - lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb
103
+ - lib/rubocop/cop/chef/deprecation/depends_chef_nginx_cookbook.rb
104
+ - lib/rubocop/cop/chef/deprecation/depends_chef_reporting_cookbook.rb
103
105
  - lib/rubocop/cop/chef/deprecation/depends_compat_resource.rb
106
+ - lib/rubocop/cop/chef/deprecation/depends_omnibus_updater_cookbook.rb
104
107
  - lib/rubocop/cop/chef/deprecation/depends_partial_search.rb
105
108
  - lib/rubocop/cop/chef/deprecation/depends_poise.rb
106
109
  - lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb
@@ -186,8 +189,11 @@ files:
186
189
  - lib/rubocop/cop/chef/modernize/default_action_initializer.rb
187
190
  - lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb
188
191
  - lib/rubocop/cop/chef/modernize/definitions.rb
192
+ - lib/rubocop/cop/chef/modernize/depends_chef_vault_cookbook.rb
193
+ - lib/rubocop/cop/chef/modernize/depends_chocolatey_cookbooks.rb
189
194
  - lib/rubocop/cop/chef/modernize/depends_kernel_module_cookbook.rb
190
195
  - lib/rubocop/cop/chef/modernize/depends_locale_cookbook.rb
196
+ - lib/rubocop/cop/chef/modernize/depends_openssl_cookbook.rb
191
197
  - lib/rubocop/cop/chef/modernize/depends_timezone_lwrp_cookbook.rb
192
198
  - lib/rubocop/cop/chef/modernize/depends_windows_firewall_cookbook.rb
193
199
  - lib/rubocop/cop/chef/modernize/depends_zypper_cookbook.rb