cookstyle 8.1.3 → 8.2.1
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 +4 -4
- data/config/chefstyle.yml +18 -2
- data/config/cookstyle.yml +26 -10
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/execute_relative_creates_without_cwd.rb +1 -1
- data/lib/rubocop/cop/chef/deprecation/hwrp_without_provides.rb +4 -8
- data/lib/rubocop/cop/chef/deprecation/windows_package_installer_type_string.rb +1 -1
- data/lib/rubocop/cop/chef/modernize/libarchive_file.rb +1 -1
- data/lib/rubocop/cop/chef/style/simplify_platform_major_version_check.rb +1 -1
- data/lib/rubocop/cop/chef/style/unnecessary_platform_case_statement.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a112e54131a04e30238454352863d369ac970da0b4ef2ff85c0bb38ceaeec0d7
|
4
|
+
data.tar.gz: 65961294e7f5e942c1ad8867d72c95fb5e758f310eb517d38e8bbdfeac85d3cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40ed170a3026d9c516df5bdd6c9689556c2346f152a616e198a8c71b9ec3afbbff999298d3a62f644f8508a52edc9dd965fd69ebb182288977068163353a9269
|
7
|
+
data.tar.gz: 1274df60cb1b12de06ff21aa1fe58af6f80b7867db6d223c9d97fcd22640613bfee162c7ac4aa0af4c5ca4b757137cae78001ecc48467b7e52a7ec7693c7f4f7
|
data/config/chefstyle.yml
CHANGED
@@ -477,7 +477,7 @@ Layout/TrailingWhitespace:
|
|
477
477
|
Style/RedundantCapitalW:
|
478
478
|
Enabled: true
|
479
479
|
Style/RedundantInterpolation:
|
480
|
-
Enabled: false # buggy: https://github.com/rubocop
|
480
|
+
Enabled: false # buggy: https://github.com/rubocop/rubocop/issues/6099
|
481
481
|
#Style/RedundantPercentQ: # would like to enable this one but its buggy as of 0.35.1
|
482
482
|
# Enabled: true
|
483
483
|
Naming/VariableName:
|
@@ -613,7 +613,7 @@ Bundler/OrderedGems:
|
|
613
613
|
# is also perfectly descriptive even though its only 2 characters...).
|
614
614
|
Naming/HeredocDelimiterNaming:
|
615
615
|
Enabled: false
|
616
|
-
Naming/
|
616
|
+
Naming/PredicatePrefix:
|
617
617
|
Enabled: false
|
618
618
|
Naming/MethodParameterName:
|
619
619
|
Enabled: false
|
@@ -852,6 +852,22 @@ Style/RedundantFormat:
|
|
852
852
|
Lint/RedundantTypeConversion:
|
853
853
|
Enabled: true
|
854
854
|
|
855
|
+
# Don't use .flatten and then .join when you can use .join directly
|
856
|
+
Style/RedundantArrayFlatten:
|
857
|
+
Enabled: true
|
858
|
+
|
859
|
+
# Avoid the use of || when the left side will never be nil
|
860
|
+
Lint/UselessOr:
|
861
|
+
Enabled: true
|
862
|
+
|
863
|
+
# Warn when default values are passed that won't be used
|
864
|
+
Lint/UselessDefaultValueArgument:
|
865
|
+
Enabled: true
|
866
|
+
|
867
|
+
# use helpers like .any?, .none?, and .one? instead of using count on collections which is much slower
|
868
|
+
Style/CollectionQuerying:
|
869
|
+
Enabled: true
|
870
|
+
|
855
871
|
Chef/Deprecations/Ruby27KeywordArgumentWarnings:
|
856
872
|
Description: Pass options to shell_out helpers without the brackets to avoid Ruby 2.7 deprecation warnings.
|
857
873
|
Enabled: true
|
data/config/cookstyle.yml
CHANGED
@@ -171,7 +171,7 @@ Chef/Style/NegatingOnlyIf:
|
|
171
171
|
|
172
172
|
Chef/Style/IncludeRecipeWithParentheses:
|
173
173
|
Description: There is no need to wrap the recipe in parentheses when using the include_recipe helper
|
174
|
-
StyleGuide: '
|
174
|
+
StyleGuide: 'chef_style_includerecipewithparentheses'
|
175
175
|
VersionAdded: '6.11.0'
|
176
176
|
Enabled: true
|
177
177
|
Exclude:
|
@@ -208,7 +208,7 @@ Chef/Correctness/NodeNormal:
|
|
208
208
|
|
209
209
|
Chef/Correctness/NodeNormalUnless:
|
210
210
|
Description: Do not use the node.normal_unless method
|
211
|
-
StyleGuide: '
|
211
|
+
StyleGuide: 'chef_correctness_nodenormalunless'
|
212
212
|
Enabled: true
|
213
213
|
VersionAdded: '5.1.0'
|
214
214
|
Exclude:
|
@@ -402,7 +402,7 @@ Chef/Correctness/ChefApplicationFatal:
|
|
402
402
|
|
403
403
|
Chef/Correctness/PowershellScriptDeleteFile:
|
404
404
|
Description: Use the `file` or `directory` resources built into Chef Infra Client with the :delete action to remove files/directories instead of using Remove-Item in a powershell_script resource
|
405
|
-
StyleGuide: '
|
405
|
+
StyleGuide: 'chef_correctness_powershellscriptdeletefile'
|
406
406
|
Enabled: true
|
407
407
|
VersionAdded: '6.0.0'
|
408
408
|
Exclude:
|
@@ -599,7 +599,7 @@ Chef/Sharing/EmptyMetadataField:
|
|
599
599
|
|
600
600
|
Chef/Sharing/IncludePropertyDescriptions:
|
601
601
|
Description: Properties should include description fields to allow automated documentation. Requires Chef Infra Client 13.9 or later.
|
602
|
-
StyleGuide: '
|
602
|
+
StyleGuide: 'chef_sharing_includepropertydescriptions'
|
603
603
|
Enabled: false
|
604
604
|
VersionAdded: '6.1.0'
|
605
605
|
Include:
|
@@ -1082,7 +1082,7 @@ Chef/Deprecations/LogResourceNotifications:
|
|
1082
1082
|
|
1083
1083
|
Chef/Deprecations/HWRPWithoutProvides:
|
1084
1084
|
Description: In Chef Infra Client 16 and later a legacy HWRP resource must use `provides` to define how the resource is called in recipes or other resources. To maintain compatibility with Chef Infra Client < 16 use both `resource_name` and `provides`.
|
1085
|
-
StyleGuide: '
|
1085
|
+
StyleGuide: 'chef_deprecations_hwrpwithoutprovides'
|
1086
1086
|
Enabled: true
|
1087
1087
|
VersionAdded: '6.0.0'
|
1088
1088
|
VersionChanged: '6.8.0'
|
@@ -1173,7 +1173,7 @@ Chef/Deprecations/MacosUserdefaultsGlobalProperty:
|
|
1173
1173
|
|
1174
1174
|
Chef/Deprecations/CookbooksDependsOnSelf:
|
1175
1175
|
Description: A cookbook cannot depend on itself in Chef Infra Client 13 or later.
|
1176
|
-
StyleGuide: '
|
1176
|
+
StyleGuide: 'chef_deprecations_cookbooksdependsonself'
|
1177
1177
|
Enabled: true
|
1178
1178
|
VersionAdded: '5.2.0'
|
1179
1179
|
VersionChanged: '6.16.0'
|
@@ -1861,7 +1861,7 @@ Chef/Modernize/NodeRolesInclude:
|
|
1861
1861
|
|
1862
1862
|
Chef/Modernize/RespondToCompileTime:
|
1863
1863
|
Description: There is no need to check if the chef_gem resource supports compile_time as Chef Infra Client 12.1 and later support the compile_time property.
|
1864
|
-
StyleGuide: '
|
1864
|
+
StyleGuide: 'chef_modernize_respondtocompiletime'
|
1865
1865
|
Enabled: true
|
1866
1866
|
VersionAdded: '6.3.0'
|
1867
1867
|
Exclude:
|
@@ -2269,7 +2269,7 @@ Chef/Effortless/CookbookUsesDatabags:
|
|
2269
2269
|
# https://github.com/chef/cookstyle/issues/346
|
2270
2270
|
Chef/Effortless/ChefVaultUsed:
|
2271
2271
|
Description: Cookbook uses Chef Vault, which cannot be used in the Effortless Infra pattern
|
2272
|
-
StyleGuide: '
|
2272
|
+
StyleGuide: 'chef_effortless_chefvaultused'
|
2273
2273
|
Enabled: false
|
2274
2274
|
VersionAdded: '6.19'
|
2275
2275
|
Exclude:
|
@@ -2279,7 +2279,7 @@ Chef/Effortless/ChefVaultUsed:
|
|
2279
2279
|
# https://github.com/chef/cookstyle/issues/346
|
2280
2280
|
Chef/Effortless/DependsChefVault:
|
2281
2281
|
Description: Cookbook depends on Chef Vault, which cannot be used in the Effortless Infra pattern
|
2282
|
-
StyleGuide: '
|
2282
|
+
StyleGuide: 'chef_effortless_dependschefvault'
|
2283
2283
|
Enabled: false
|
2284
2284
|
VersionAdded: '6.19'
|
2285
2285
|
Include:
|
@@ -3019,7 +3019,7 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
3019
3019
|
Enabled: true
|
3020
3020
|
|
3021
3021
|
# returning at the top level with an arg is invalid
|
3022
|
-
# @TODO we can enable this once this is fixed: https://github.com/rubocop
|
3022
|
+
# @TODO we can enable this once this is fixed: https://github.com/rubocop/rubocop/issues/8462
|
3023
3023
|
# Lint/TopLevelReturnWithArgument:
|
3024
3024
|
# Enabled: true
|
3025
3025
|
|
@@ -3271,3 +3271,19 @@ Style/RedundantFormat:
|
|
3271
3271
|
# Don't convert types if we don't need to
|
3272
3272
|
Lint/RedundantTypeConversion:
|
3273
3273
|
Enabled: true
|
3274
|
+
|
3275
|
+
# Don't use .flatten and then .join when you can use .join directly
|
3276
|
+
Style/RedundantArrayFlatten:
|
3277
|
+
Enabled: true
|
3278
|
+
|
3279
|
+
# Avoid the use of || when the left side will never be nil
|
3280
|
+
Lint/UselessOr:
|
3281
|
+
Enabled: true
|
3282
|
+
|
3283
|
+
# Warn when default values are passed that won't be used
|
3284
|
+
Lint/UselessDefaultValueArgument:
|
3285
|
+
Enabled: true
|
3286
|
+
|
3287
|
+
# use helpers like .any?, .none?, and .one? instead of using count on collections which is much slower
|
3288
|
+
Style/CollectionQuerying:
|
3289
|
+
Enabled: true
|
data/lib/cookstyle/version.rb
CHANGED
@@ -45,7 +45,7 @@ module RuboCop
|
|
45
45
|
|
46
46
|
def on_block(node)
|
47
47
|
match_property_in_resource?(:execute, 'creates', node) do |offense|
|
48
|
-
return unless offense.arguments.
|
48
|
+
return unless offense.arguments.one? # we can only analyze simple string args
|
49
49
|
return unless offense.arguments.first.str_type? # we can only analyze simple string args
|
50
50
|
|
51
51
|
# skip any creates that are abs paths https://rubular.com/r/3TbDsgcAa1EaIF
|
@@ -117,17 +117,13 @@ module RuboCop
|
|
117
117
|
|
118
118
|
def has_provides?
|
119
119
|
provides_ast = provides(processed_source.ast)
|
120
|
-
return false if provides_ast.
|
120
|
+
return false if provides_ast.none?
|
121
121
|
|
122
122
|
resource_ast = resource_name(processed_source.ast)
|
123
123
|
|
124
|
-
if
|
125
|
-
|
126
|
-
|
127
|
-
# since we have a resource and provides make sure the there is a provides that
|
128
|
-
# matches the resource name
|
129
|
-
provides_ast.include?(resource_ast.first)
|
130
|
-
end
|
124
|
+
# if no resource ast then resource_name, but not provides
|
125
|
+
# else make sure the provides matches the resource name
|
126
|
+
resource_ast.none? || provides_ast.include?(resource_ast.first)
|
131
127
|
end
|
132
128
|
|
133
129
|
def indentation(node)
|
@@ -45,7 +45,7 @@ module RuboCop
|
|
45
45
|
|
46
46
|
def on_block(node)
|
47
47
|
match_property_in_resource?(:windows_package, 'installer_type', node) do |offense|
|
48
|
-
return unless offense.arguments.
|
48
|
+
return unless offense.arguments.one? # we can only analyze simple string args
|
49
49
|
return unless offense.arguments.first.str_type? # anything else is fine
|
50
50
|
|
51
51
|
add_offense(offense, severity: :warning) do |corrector|
|
@@ -49,7 +49,7 @@ module RuboCop
|
|
49
49
|
PATTERN
|
50
50
|
|
51
51
|
def on_send(node)
|
52
|
-
# The need for this goes away once https://github.com/rubocop
|
52
|
+
# The need for this goes away once https://github.com/rubocop/rubocop/pull/8365 is pulled into Cookstyle
|
53
53
|
if node.method?(:libarchive_file)
|
54
54
|
add_offense(node, severity: :refactor) do |corrector|
|
55
55
|
corrector.replace(node, node.source.gsub('libarchive_file', 'archive_file'))
|
@@ -50,7 +50,7 @@ module RuboCop
|
|
50
50
|
platform_version_check?(node) do
|
51
51
|
if parent_method_equals?(node, :[])
|
52
52
|
node = node.parent
|
53
|
-
if node&.arguments.
|
53
|
+
if node&.arguments.one? &&
|
54
54
|
node&.arguments&.first&.int_type? &&
|
55
55
|
node&.arguments&.first.source == '0'
|
56
56
|
add_offense_to_i_if_present(node)
|
@@ -55,7 +55,7 @@ module RuboCop
|
|
55
55
|
|
56
56
|
def on_case(node)
|
57
57
|
platform_case?(node) do |node_, type|
|
58
|
-
return unless node&.when_branches&.
|
58
|
+
return unless node&.when_branches&.one?
|
59
59
|
add_offense(node, severity: :refactor) do |corrector|
|
60
60
|
# we have at least one supermarket cookbook with an entirely empty platform case statement
|
61
61
|
# we can't actually fix that so let's do nothing here.
|
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: 8.1
|
4
|
+
version: 8.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thom May
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.77.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.77.0
|
27
27
|
email:
|
28
28
|
- thom@chef.io
|
29
29
|
- tsmith84@gmail.com
|
@@ -336,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
336
336
|
- !ruby/object:Gem::Version
|
337
337
|
version: '0'
|
338
338
|
requirements: []
|
339
|
-
rubygems_version: 3.6.
|
339
|
+
rubygems_version: 3.6.7
|
340
340
|
specification_version: 4
|
341
341
|
summary: Cookstyle is a code linting tool that helps you to write better Chef Infra
|
342
342
|
cookbooks by detecting and automatically correcting style, syntax, and logic mistakes
|