cookstyle 7.21.0 → 7.22.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/cookstyle.yml +12 -2
- data/config/disable_all.yml +2 -0
- data/config/upstream.yml +24 -2
- data/cookstyle.gemspec +1 -1
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/chef_sugar_helpers.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/hwrp_without_unified_mode_true.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/resource_without_unified_mode_true.rb +1 -1
- data/lib/rubocop/cop/chef/modernize/use_chef_language_cloud_helpers.rb +22 -18
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f991818edd484753a75e2c0ae4e0d363f48b9213189cd4240bda17b08e260d4
|
4
|
+
data.tar.gz: fa69ed0eb47f5276d723b7f75acd6c08f21e8c57391f6c1b8c71f2e74c023880
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f5a09a0805b0b184e1fe10e90bbdd0270a537b4c823560f74f1b4cfd6e6ea332fc62fc6695595b92cf35733db3871d94a037b4747681572bd0925525c7a3da9
|
7
|
+
data.tar.gz: 5118bf5677557d03e0e730de31670c7defcd943d5d356147f40eed1c86118f463f29083f081d4af0e622c7375db9415c5b9e57da933291c441c500ee658d6265
|
data/config/cookstyle.yml
CHANGED
@@ -979,7 +979,7 @@ Chef/Deprecations/DeprecatedPlatformMethods:
|
|
979
979
|
- '**/providers/*.rb'
|
980
980
|
|
981
981
|
Chef/Deprecations/DeprecatedChefSpecPlatform:
|
982
|
-
Description: Use currently supported platforms in ChefSpec listed at https://github.com/chefspec/fauxhai/blob/
|
982
|
+
Description: Use currently supported platforms in ChefSpec listed at https://github.com/chefspec/fauxhai/blob/main/PLATFORMS.md. Fauxhai / ChefSpec will perform fuzzy matching on platform version so it's always best to be less specific ie. 10 instead of 10.3
|
983
983
|
StyleGuide: 'chef_deprecations_deprecatedchefspecplatform'
|
984
984
|
Enabled: true
|
985
985
|
VersionAdded: '5.20.0'
|
@@ -1198,7 +1198,7 @@ Chef/Deprecations/DeprecatedYumRepositoryActions:
|
|
1198
1198
|
- '**/Rakefile'
|
1199
1199
|
|
1200
1200
|
Chef/Deprecations/ChefSugarHelpers:
|
1201
|
-
Description: Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/
|
1201
|
+
Description: Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/main/chef-utils#getting-started
|
1202
1202
|
StyleGuide: 'chef_deprecations_chefsugarhelpers'
|
1203
1203
|
Enabled: true
|
1204
1204
|
VersionAdded: '7.3.0'
|
@@ -1906,6 +1906,16 @@ Chef/Modernize/UseChefLanguageEnvHelpers:
|
|
1906
1906
|
- '**/providers/*.rb'
|
1907
1907
|
- '**/recipes/*.rb'
|
1908
1908
|
|
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.
|
1911
|
+
StyleGuide: 'chef_modernize_usecheflanguagecloudhelpers'
|
1912
|
+
Enabled: true
|
1913
|
+
VersionAdded: '7.22.0'
|
1914
|
+
Include:
|
1915
|
+
- '**/resources/*.rb'
|
1916
|
+
- '**/providers/*.rb'
|
1917
|
+
- '**/recipes/*.rb'
|
1918
|
+
|
1909
1919
|
###############################
|
1910
1920
|
# Chef/RedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
|
1911
1921
|
###############################
|
data/config/disable_all.yml
CHANGED
data/config/upstream.yml
CHANGED
@@ -174,6 +174,20 @@ Bundler/GemComment:
|
|
174
174
|
IgnoredGems: []
|
175
175
|
OnlyFor: []
|
176
176
|
|
177
|
+
Bundler/GemFilename:
|
178
|
+
Description: 'Enforces the filename for managing gems.'
|
179
|
+
Enabled: true
|
180
|
+
VersionAdded: '1.20'
|
181
|
+
EnforcedStyle: 'Gemfile'
|
182
|
+
SupportedStyles:
|
183
|
+
- 'Gemfile'
|
184
|
+
- 'gems.rb'
|
185
|
+
Include:
|
186
|
+
- '**/Gemfile'
|
187
|
+
- '**/gems.rb'
|
188
|
+
- '**/Gemfile.lock'
|
189
|
+
- '**/gems.locked'
|
190
|
+
|
177
191
|
Bundler/GemVersion:
|
178
192
|
Description: 'Requires or forbids specifying gem versions.'
|
179
193
|
Enabled: false
|
@@ -1519,6 +1533,11 @@ Lint/Debugger:
|
|
1519
1533
|
Capybara:
|
1520
1534
|
- save_and_open_page
|
1521
1535
|
- save_and_open_screenshot
|
1536
|
+
debug.rb:
|
1537
|
+
- binding.b
|
1538
|
+
- binding.break
|
1539
|
+
- Kernel.binding.b
|
1540
|
+
- Kernel.binding.break
|
1522
1541
|
Pry:
|
1523
1542
|
- binding.pry
|
1524
1543
|
- binding.remote_pry
|
@@ -1527,6 +1546,8 @@ Lint/Debugger:
|
|
1527
1546
|
Rails:
|
1528
1547
|
- debugger
|
1529
1548
|
- Kernel.debugger
|
1549
|
+
RubyJard:
|
1550
|
+
- jard
|
1530
1551
|
WebConsole:
|
1531
1552
|
- binding.console
|
1532
1553
|
|
@@ -3149,7 +3170,7 @@ Style/CommentAnnotation:
|
|
3149
3170
|
StyleGuide: '#annotate-keywords'
|
3150
3171
|
Enabled: true
|
3151
3172
|
VersionAdded: '0.10'
|
3152
|
-
VersionChanged: '1.
|
3173
|
+
VersionChanged: '1.20'
|
3153
3174
|
Keywords:
|
3154
3175
|
- TODO
|
3155
3176
|
- FIXME
|
@@ -4692,8 +4713,9 @@ Style/StructInheritance:
|
|
4692
4713
|
Description: 'Checks for inheritance from Struct.new.'
|
4693
4714
|
StyleGuide: '#no-extend-struct-new'
|
4694
4715
|
Enabled: true
|
4716
|
+
SafeAutoCorrect: false
|
4695
4717
|
VersionAdded: '0.29'
|
4696
|
-
VersionChanged: '
|
4718
|
+
VersionChanged: '1.20'
|
4697
4719
|
|
4698
4720
|
Style/SwapValues:
|
4699
4721
|
Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
|
data/cookstyle.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.metadata = {
|
24
24
|
'homepage_uri' => 'https://github.com/chef/cookstyle',
|
25
|
-
'changelog_uri' => 'https://github.com/chef/cookstyle/blob/
|
25
|
+
'changelog_uri' => 'https://github.com/chef/cookstyle/blob/main/CHANGELOG.md',
|
26
26
|
'source_code_uri' => 'https://github.com/chef/cookstyle',
|
27
27
|
'documentation_uri' => 'https://docs.chef.io/workstation/cookstyle/',
|
28
28
|
'bug_tracker_uri' => 'https://github.com/chef/cookstyle/issues',
|
data/lib/cookstyle/version.rb
CHANGED
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
module Cop
|
20
20
|
module Chef
|
21
21
|
module Deprecations
|
22
|
-
# Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/
|
22
|
+
# Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/main/chef-utils#getting-started
|
23
23
|
#
|
24
24
|
# @example
|
25
25
|
#
|
@@ -42,7 +42,7 @@ module RuboCop
|
|
42
42
|
# opensolaris?
|
43
43
|
#
|
44
44
|
class ChefSugarHelpers < Base
|
45
|
-
MSG = 'Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/
|
45
|
+
MSG = 'Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/main/chef-utils#getting-started'
|
46
46
|
RESTRICT_ON_SEND = [:vagrant_key?, :vagrant_domain?, :vagrant_user?, :require_chef_gem, :best_ip_for, :nexus?, :ios_xr?, :ruby_20?, :ruby_19?, :includes_recipe?, :wrlinux?, :dev_null, :nexentacore_platform?, :opensolaris_platform?, :nexentacore?, :opensolaris?].freeze
|
47
47
|
|
48
48
|
def on_send(node)
|
@@ -19,7 +19,7 @@ module RuboCop
|
|
19
19
|
module Cop
|
20
20
|
module Chef
|
21
21
|
module Deprecations
|
22
|
-
# Use currently supported platforms in ChefSpec listed at https://github.com/chefspec/fauxhai/blob/
|
22
|
+
# Use currently supported platforms in ChefSpec listed at https://github.com/chefspec/fauxhai/blob/main/PLATFORMS.md. Fauxhai / ChefSpec will perform fuzzy matching on platform version values so it's always best to be less specific ie. 10 instead of 10.3
|
23
23
|
#
|
24
24
|
# @example
|
25
25
|
#
|
@@ -29,7 +29,7 @@ module RuboCop
|
|
29
29
|
include RuboCop::Chef::CookbookHelpers
|
30
30
|
extend AutoCorrector
|
31
31
|
|
32
|
-
MSG = "Use currently supported platforms in ChefSpec listed at https://github.com/chefspec/fauxhai/blob/
|
32
|
+
MSG = "Use currently supported platforms in ChefSpec listed at https://github.com/chefspec/fauxhai/blob/main/PLATFORMS.md. Fauxhai / ChefSpec will perform fuzzy matching on platform version so it's always best to be less specific ie. 10 instead of 10.3"
|
33
33
|
|
34
34
|
DEPRECATED_MAPPING = {
|
35
35
|
'amazon' => {
|
@@ -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
|
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
|
#
|
@@ -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
|
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.
|
23
23
|
#
|
24
24
|
# @example
|
25
25
|
#
|
@@ -24,17 +24,33 @@ module RuboCop
|
|
24
24
|
# @example
|
25
25
|
#
|
26
26
|
# #### incorrect
|
27
|
-
#
|
28
|
-
#
|
27
|
+
# node['cloud']['provider'] == 'alibaba'
|
28
|
+
# node['cloud']['provider'] == 'ec2'
|
29
|
+
# node['cloud']['provider'] == 'gce'
|
30
|
+
# node['cloud']['provider'] == 'rackspace'
|
31
|
+
# node['cloud']['provider'] == 'eucalyptus'
|
32
|
+
# node['cloud']['provider'] == 'linode'
|
33
|
+
# node['cloud']['provider'] == 'openstack'
|
34
|
+
# node['cloud']['provider'] == 'azure'
|
35
|
+
# node['cloud']['provider'] == 'digital_ocean'
|
36
|
+
# node['cloud']['provider'] == 'softlayer'
|
29
37
|
#
|
30
38
|
# #### correct
|
31
|
-
#
|
32
|
-
#
|
39
|
+
# alibaba?
|
40
|
+
# ec2?
|
41
|
+
# gce?
|
42
|
+
# rackspace?
|
43
|
+
# eucalyptus?
|
44
|
+
# linode?
|
45
|
+
# openstack?
|
46
|
+
# azure?
|
47
|
+
# digital_ocean?
|
48
|
+
# softlayer?
|
33
49
|
#
|
34
50
|
class UseChefLanguageCloudHelpers < Base
|
35
51
|
extend AutoCorrector
|
36
52
|
|
37
|
-
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 instance that run on public and private clouds easier.'
|
38
54
|
RESTRICT_ON_SEND = [:==, :[]].freeze
|
39
55
|
VALID_CLOUDS = %w(alibaba ec2 gce rackspace eucalyptus linode openstack azure digital_ocean softlayer).freeze
|
40
56
|
|
@@ -48,12 +64,6 @@ module RuboCop
|
|
48
64
|
(str $_))
|
49
65
|
PATTERN
|
50
66
|
|
51
|
-
def_node_matcher :node_check?, <<-PATTERN
|
52
|
-
(send
|
53
|
-
(send nil? :node) :[]
|
54
|
-
(str ${"ec2"}))
|
55
|
-
PATTERN
|
56
|
-
|
57
67
|
def_node_matcher :node_cloud?, <<-PATTERN
|
58
68
|
(send
|
59
69
|
(send nil? :node) :[]
|
@@ -61,19 +71,13 @@ module RuboCop
|
|
61
71
|
PATTERN
|
62
72
|
|
63
73
|
def on_send(node)
|
64
|
-
node_check?(node) do |cloud_name|
|
65
|
-
add_offense(node, message: MSG, severity: :refactor) do |corrector|
|
66
|
-
corrector.replace(node, "#{cloud_name}?")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
74
|
provider_comparison?(node) do |cloud_name|
|
71
75
|
# skip it if someone was checking for a bogus cloud provider
|
72
76
|
next unless VALID_CLOUDS.include?(cloud_name)
|
73
77
|
|
74
78
|
# if they were checking for node['cloud'] and the provider replace it all
|
75
79
|
node = node.parent if node.parent.and_type? && node_cloud?(node.left_sibling)
|
76
|
-
|
80
|
+
|
77
81
|
add_offense(node, message: MSG, severity: :refactor) do |corrector|
|
78
82
|
corrector.replace(node, "#{cloud_name}?")
|
79
83
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookstyle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.22.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thom May
|
8
8
|
- Tim Smith
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-08-
|
12
|
+
date: 2021-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubocop
|
@@ -17,15 +17,15 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
20
|
+
version: 1.20.0
|
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.
|
28
|
-
description:
|
27
|
+
version: 1.20.0
|
28
|
+
description:
|
29
29
|
email:
|
30
30
|
- thom@chef.io
|
31
31
|
- tsmith@chef.io
|
@@ -305,11 +305,11 @@ licenses:
|
|
305
305
|
- Apache-2.0
|
306
306
|
metadata:
|
307
307
|
homepage_uri: https://github.com/chef/cookstyle
|
308
|
-
changelog_uri: https://github.com/chef/cookstyle/blob/
|
308
|
+
changelog_uri: https://github.com/chef/cookstyle/blob/main/CHANGELOG.md
|
309
309
|
source_code_uri: https://github.com/chef/cookstyle
|
310
310
|
documentation_uri: https://docs.chef.io/workstation/cookstyle/
|
311
311
|
bug_tracker_uri: https://github.com/chef/cookstyle/issues
|
312
|
-
post_install_message:
|
312
|
+
post_install_message:
|
313
313
|
rdoc_options: []
|
314
314
|
require_paths:
|
315
315
|
- lib
|
@@ -324,8 +324,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
324
324
|
- !ruby/object:Gem::Version
|
325
325
|
version: '0'
|
326
326
|
requirements: []
|
327
|
-
rubygems_version: 3.
|
328
|
-
signing_key:
|
327
|
+
rubygems_version: 3.1.4
|
328
|
+
signing_key:
|
329
329
|
specification_version: 4
|
330
330
|
summary: Cookstyle is a code linting tool that helps you to write better Chef Infra
|
331
331
|
cookbooks by detecting and automatically correcting style, syntax, and logic mistakes
|