cookstyle 5.4.13 → 5.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/config/cookstyle.yml +231 -129
  3. data/lib/cookstyle.rb +1 -0
  4. data/lib/cookstyle/version.rb +1 -1
  5. data/lib/rubocop/chef/cookbook_helpers.rb +67 -0
  6. data/lib/rubocop/cop/chef/correctness/block_guard_clause_string_only.rb +34 -31
  7. data/lib/rubocop/cop/chef/correctness/cb_depends_on_self.rb +16 -14
  8. data/lib/rubocop/cop/chef/correctness/default_maintainer_metadata.rb +22 -20
  9. data/lib/rubocop/cop/chef/correctness/insecure_cookbook_url.rb +32 -30
  10. data/lib/rubocop/cop/chef/correctness/invalid_license_string.rb +454 -453
  11. data/lib/rubocop/cop/chef/correctness/invalid_platform_metadata.rb +57 -57
  12. data/lib/rubocop/cop/chef/correctness/metadata_missing_name.rb +18 -16
  13. data/lib/rubocop/cop/chef/correctness/name_property_and_required.rb +61 -59
  14. data/lib/rubocop/cop/chef/correctness/node_normal.rb +29 -27
  15. data/lib/rubocop/cop/chef/correctness/node_normal_unless.rb +29 -27
  16. data/lib/rubocop/cop/chef/correctness/node_save.rb +46 -0
  17. data/lib/rubocop/cop/chef/correctness/ohai_default_recipe.rb +47 -0
  18. data/lib/rubocop/cop/chef/correctness/property_with_default_and_required.rb +35 -33
  19. data/lib/rubocop/cop/chef/correctness/property_with_name_attribute.rb +29 -27
  20. data/lib/rubocop/cop/chef/correctness/resource_sets_internal_properties.rb +52 -0
  21. data/lib/rubocop/cop/chef/correctness/resource_sets_name_property.rb +51 -0
  22. data/lib/rubocop/cop/chef/correctness/resource_with_none_action.rb +52 -0
  23. data/lib/rubocop/cop/chef/correctness/service_resource.rb +26 -24
  24. data/lib/rubocop/cop/chef/correctness/tmp_path.rb +30 -28
  25. data/lib/rubocop/cop/chef/deprecation/attribute_metadata.rb +22 -21
  26. data/lib/rubocop/cop/chef/deprecation/chef_rest.rb +56 -0
  27. data/lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb +58 -0
  28. data/lib/rubocop/cop/chef/deprecation/conflicts_metadata.rb +18 -16
  29. data/lib/rubocop/cop/chef/deprecation/depends_compat_resource.rb +21 -19
  30. data/lib/rubocop/cop/chef/deprecation/depends_partial_search.rb +17 -15
  31. data/lib/rubocop/cop/chef/deprecation/depends_poise.rb +17 -15
  32. data/lib/rubocop/cop/chef/deprecation/deprecated_mixins.rb +39 -37
  33. data/lib/rubocop/cop/chef/deprecation/easy_install.rb +15 -13
  34. data/lib/rubocop/cop/chef/deprecation/epic_fail.rb +24 -22
  35. data/lib/rubocop/cop/chef/deprecation/erl_call.rb +15 -13
  36. data/lib/rubocop/cop/chef/deprecation/launchd_deprecated_hash_property.rb +55 -0
  37. data/lib/rubocop/cop/chef/deprecation/legacy_yum_cookbook_recipes.rb +24 -22
  38. data/lib/rubocop/cop/chef/deprecation/locale_lc_all_property.rb +45 -0
  39. data/lib/rubocop/cop/chef/deprecation/long_description_metadata.rb +21 -19
  40. data/lib/rubocop/cop/chef/deprecation/node_methods_not_attributes.rb +55 -53
  41. data/lib/rubocop/cop/chef/deprecation/node_set.rb +27 -25
  42. data/lib/rubocop/cop/chef/deprecation/node_set_unless.rb +27 -25
  43. data/lib/rubocop/cop/chef/deprecation/provides_metadata.rb +18 -16
  44. data/lib/rubocop/cop/chef/deprecation/replaces_metadata.rb +18 -16
  45. data/lib/rubocop/cop/chef/deprecation/require_recipe.rb +23 -21
  46. data/lib/rubocop/cop/chef/deprecation/suggests_metadata.rb +18 -16
  47. data/lib/rubocop/cop/chef/deprecation/use_inline_resources.rb +56 -0
  48. data/lib/rubocop/cop/chef/deprecation/user_supports_property.rb +53 -0
  49. data/lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb +51 -0
  50. data/lib/rubocop/cop/chef/deprecation/yum_dnf_compat_recipe.rb +51 -0
  51. data/lib/rubocop/cop/chef/effortless/data_bags.rb +13 -11
  52. data/lib/rubocop/cop/chef/effortless/search_used.rb +13 -11
  53. data/lib/rubocop/cop/chef/modernize/apt_default_recipe.rb +22 -20
  54. data/lib/rubocop/cop/chef/modernize/berksfile_source.rb +31 -29
  55. data/lib/rubocop/cop/chef/modernize/build_essential.rb +25 -23
  56. data/lib/rubocop/cop/chef/modernize/chef_14_resources.rb +27 -25
  57. data/lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb +25 -23
  58. data/lib/rubocop/cop/chef/modernize/execute_apt_update.rb +19 -17
  59. data/lib/rubocop/cop/chef/modernize/includes_mixin_shellout.rb +27 -25
  60. data/lib/rubocop/cop/chef/modernize/libarchive_file.rb +41 -0
  61. data/lib/rubocop/cop/chef/modernize/minitest_handler_usage.rb +21 -19
  62. data/lib/rubocop/cop/chef/modernize/powershell_expand_archive.rb +48 -0
  63. data/lib/rubocop/cop/chef/modernize/powershell_install_package.rb +51 -0
  64. data/lib/rubocop/cop/chef/modernize/powershell_install_windowsfeature.rb +54 -0
  65. data/lib/rubocop/cop/chef/modernize/resource_set_or_return.rb +25 -23
  66. data/lib/rubocop/cop/chef/modernize/resource_with_allowed_actions.rb +77 -0
  67. data/lib/rubocop/cop/chef/modernize/resource_with_attributes.rb +37 -35
  68. data/lib/rubocop/cop/chef/modernize/respond_to_metadata.rb +54 -0
  69. data/lib/rubocop/cop/chef/modernize/respond_to_provides.rb +25 -23
  70. data/lib/rubocop/cop/chef/modernize/respond_to_resource_name.rb +26 -24
  71. data/lib/rubocop/cop/chef/{effortless/node_save.rb → modernize/seven_zip_archive.rb} +16 -16
  72. data/lib/rubocop/cop/chef/modernize/shellouts_to_chocolatey.rb +59 -0
  73. data/lib/rubocop/cop/chef/modernize/whyrun_supported_true.rb +20 -18
  74. data/lib/rubocop/cop/chef/modernize/windows_default_recipe.rb +23 -21
  75. data/lib/rubocop/cop/chef/modernize/windows_version_helper.rb +20 -18
  76. data/lib/rubocop/cop/chef/modernize/windows_zipfile.rb +15 -13
  77. data/lib/rubocop/cop/chef/style/attribute_keys.rb +59 -57
  78. data/lib/rubocop/cop/chef/style/comment_sentence_spacing.rb +14 -12
  79. data/lib/rubocop/cop/chef/style/comments_copyright_format.rb +65 -63
  80. data/lib/rubocop/cop/chef/style/comments_format.rb +48 -45
  81. data/lib/rubocop/cop/chef/style/file_mode.rb +32 -30
  82. metadata +24 -9
  83. data/lib/rubocop/cop/chef/deprecation/respond_to_metadata.rb +0 -53
  84. data/lib/rubocop/cop/chef/modernize/ohai_default_recipe.rb +0 -45
  85. data/lib/rubocop/cop/chef/modernize/resource_with_allowed_action.rb +0 -75
  86. data/lib/rubocop/cop/chef/modernize/use_inline_resources.rb +0 -54
  87. data/lib/rubocop/cop/chef/modernize/xml_ruby_recipe.rb +0 -49
  88. data/lib/rubocop/cop/chef/modernize/yum_dnf_compat_recipe.rb +0 -49
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05b57a23cb7a0dec58366d56a682cde9739ec6ffbf9f38f29b122df6ecbfa32c
4
- data.tar.gz: 3653be8038c0edfe6c554824f74be18727af1af7d43d20b7e6a3c9ee50b22b08
3
+ metadata.gz: 0322e55fbe3e8ec36d29d1cc23fccb0bb23c4025d46bcd629d476adb7bf40eba
4
+ data.tar.gz: 5962352d31f41fbb630963a0ae68d096afda0d6daae6b5f49fd426794e287232
5
5
  SHA512:
6
- metadata.gz: 32c2f00742dda59d0944b13a9a06b2eb0336c20d13be753781a794e23c6b2c454eb5d26e0eeaf94ea176ad6f3a25c2b6449acedc04ae2d4dc40dcdef231fcd7a
7
- data.tar.gz: 432baebc8013ff191096edb735abc1a90c8f9550f60931d34e15acb8eef372141cb008c3183665925610732a933301e92f6489948e25fa0511017b7103d6536c
6
+ metadata.gz: 8bd4f43082807bea03e36e319a9c71cbe49f92f250b4a8e14fc8dd99b2aeaaa687e3802a4abfc575556d691f8d888b94a23231cc7c89d8ffd669baf28ae3b243
7
+ data.tar.gz: 27dc56eb8c75ada36578b55a36c19d9ff1d8dfd96c0e95190581ffc5a80030918b475cd9d156219fa1559acd2d1f3d178351c009793030f0d2d70f9afa89e8d0
@@ -27,10 +27,10 @@ AllCops:
27
27
  - resources/.*\.rb
28
28
 
29
29
  ###############################
30
- # Making cookbooks look better
30
+ # ChefStyle: Making cookbooks look better
31
31
  ###############################
32
32
 
33
- Chef/AttributeKeys:
33
+ ChefStyle/AttributeKeys:
34
34
  Description: Check which style of keys are used to access node attributes.
35
35
  Enabled: true
36
36
  EnforcedStyle: strings
@@ -41,283 +41,390 @@ Chef/AttributeKeys:
41
41
  Exclude:
42
42
  - '**/metadata.rb'
43
43
 
44
- Chef/CopyrightCommentFormat:
44
+ ChefStyle/CopyrightCommentFormat:
45
45
  Description: Properly format copyright dates in comment blocks and ensure dates are up to date
46
46
  Enabled: false
47
47
  VersionAdded: '5.0.0'
48
48
 
49
- Chef/CommentSentenceSpacing:
49
+ ChefStyle/CommentSentenceSpacing:
50
50
  Description: Use a single space after sentences in comments
51
51
  Enabled: false
52
52
  VersionAdded: '5.1.0'
53
53
 
54
- Chef/CommentFormat:
54
+ ChefStyle/CommentFormat:
55
55
  Description: Use Chef's unique format for comment headers
56
56
  Enabled: true
57
57
  VersionAdded: '5.0.0'
58
58
 
59
- Chef/DefaultMetadataMaintainer:
60
- Description: Metadata contains default maintainer information from the cookbook generator. Add actual cookbook maintainer information to the metadata.rb.
61
- Enabled: true
62
- VersionAdded: '5.4.0'
63
- Include:
64
- - '**/metadata.rb'
65
-
66
- ###############################
67
- # Avoiding potential problems
68
- ###############################
69
-
70
- Chef/FileMode:
59
+ ChefStyle/FileMode:
71
60
  Description: Use strings to represent file modes in Chef resources
72
61
  Enabled: true
73
62
  VersionAdded: '5.0.0'
74
63
  Exclude:
75
64
  - '**/metadata.rb'
76
65
 
77
- Chef/ServiceResource:
66
+ ###############################
67
+ # ChefCorrectness: Avoiding potential problems
68
+ ###############################
69
+
70
+ ChefCorrectness/ServiceResource:
78
71
  Description: Use a service resource to start and stop services instead of execute resources
79
72
  Enabled: true
80
73
  VersionAdded: '5.0.0'
81
74
  Exclude:
82
75
  - '**/metadata.rb'
83
76
 
84
- Chef/NodeNormal:
77
+ ChefCorrectness/NodeNormal:
85
78
  Description: Do not use the node.normal method
86
79
  Enabled: true
87
80
  VersionAdded: '5.1.0'
88
81
  Exclude:
89
82
  - '**/metadata.rb'
90
83
 
91
- Chef/NodeNormalUnless:
84
+ ChefCorrectness/NodeNormalUnless:
92
85
  Description: Do not use the node.normal_unless method
93
86
  Enabled: true
94
87
  VersionAdded: '5.1.0'
95
88
  Exclude:
96
89
  - '**/metadata.rb'
97
90
 
98
- Chef/TmpPath:
91
+ ChefCorrectness/TmpPath:
99
92
  Description: Use file_cache_path rather than hard-coding tmp paths
100
93
  Enabled: true
101
94
  VersionAdded: '5.0.0'
102
95
  Exclude:
103
96
  - '**/metadata.rb'
104
97
 
105
- Chef/InsecureCookbookURL:
98
+ ChefCorrectness/InsecureCookbookURL:
106
99
  Description: Insecure http Github or Gitlab URLs for metadata source_url/issues_url fields
107
100
  Enabled: true
108
101
  VersionAdded: '5.1.0'
109
102
  Include:
110
103
  - '**/metadata.rb'
111
104
 
112
- Chef/NamePropertyIsRequired:
105
+ ChefCorrectness/NamePropertyIsRequired:
113
106
  Description: Resource properties marked as name properties should not also be required properties
114
107
  Enabled: true
115
108
  VersionAdded: '5.1.0'
116
109
 
117
- Chef/InvalidLicenseString:
110
+ ChefCorrectness/InvalidLicenseString:
118
111
  Description: Cookbook metadata.rb does not use a SPDX compliant license string or "all rights reserved"
119
112
  Enabled: true
120
113
  VersionAdded: '5.2.0'
121
114
  Include:
122
115
  - '**/metadata.rb'
123
116
 
124
- Chef/InvalidPlatformMetadata:
117
+ ChefCorrectness/InvalidPlatformMetadata:
125
118
  Description: metadata.rb "supports" platform is invalid
126
119
  Enabled: true
127
120
  VersionAdded: '5.2.0'
128
121
  Include:
129
122
  - '**/metadata.rb'
130
123
 
124
+ ChefCorrectness/CookbookUsesNodeSave:
125
+ Description: Don't use node.save to save partial node data to the Chef Infra Server mid-run unless it's absolutely necessary. Node.save can result in failed Chef Infra runs appearing in search and increases load on the Chef Infra Server.
126
+ Enabled: true
127
+ VersionAdded: '5.5.0'
128
+ Exclude:
129
+ - '**/metadata.rb'
130
+
131
+ ChefCorrectness/DefaultMetadataMaintainer:
132
+ Description: Metadata contains default maintainer information from the cookbook generator. Add actual cookbook maintainer information to the metadata.rb.
133
+ Enabled: true
134
+ VersionAdded: '5.4.0'
135
+ Include:
136
+ - '**/metadata.rb'
137
+
138
+ ChefCorrectness/PropertyWithNameAttribute:
139
+ Description: Resource property sets name_attribute not name_property
140
+ Enabled: true
141
+ VersionAdded: '5.1.0'
142
+ Include:
143
+ - '**/resources/*.rb'
144
+ - '**/libraries/*.rb'
145
+
146
+ ChefCorrectness/PropertyWithRequiredAndDefault:
147
+ Description: Resource property should not be both required and have a default value
148
+ Enabled: true
149
+ VersionAdded: '5.1.0'
150
+ Include:
151
+ - '**/resources/*.rb'
152
+ - '**/libraries/*.rb'
153
+
154
+ ChefCorrectness/CookbooksDependsOnSelf:
155
+ Description: A cookbook cannot depend on itself
156
+ Enabled: true
157
+ VersionAdded: '5.2.0'
158
+ Include:
159
+ - '**/metadata.rb'
160
+
161
+ ChefCorrectness/MetadataMissingName:
162
+ Description: MetadataMissingName
163
+ Enabled: true
164
+ VersionAdded: '5.2.0'
165
+ Include:
166
+ - '**/metadata.rb'
167
+
168
+ ChefCorrectness/BlockGuardWithOnlyString:
169
+ Description: A resource guard (not_if/only_if) that is a string should not be wrapped in {}. Wrapping a guard string in {} causes it be executed as Ruby code which will always returns true instead of a shell command that will actually run.
170
+ Enabled: true
171
+ VersionAdded: '5.2.0'
172
+ Exclude:
173
+ - '**/metadata.rb'
174
+
175
+ ChefCorrectness/ResourceSetsInternalProperties:
176
+ Description: Do not set properties used internally by Chef Infra Client to track the system state.
177
+ Enabled: true
178
+ VersionAdded: '5.5.0'
179
+ Exclude:
180
+ - '**/metadata.rb'
181
+
182
+ ChefCorrectness/ResourceSetsNameProperty:
183
+ Description: Resource sets the name property in the resource instead of using a name_property.
184
+ Enabled: true
185
+ VersionAdded: '5.5.0'
186
+ Exclude:
187
+ - '**/metadata.rb'
188
+
189
+ ChefCorrectness/ResourceWithNoneAction:
190
+ Description: Resource uses the nonexistent :none action instead of the :nothing action
191
+ Enabled: true
192
+ VersionAdded: '5.5.0'
193
+ Exclude:
194
+ - '**/metadata.rb'
195
+
196
+ ChefCorrectness/IncludingOhaiDefaultRecipe:
197
+ Description: Use the ohai_plugin resource to ship custom Ohai plugins instead of using the ohai::default recipe. If you're not shipping custom Ohai plugins, then you can remove this recipe entirely.
198
+ Enabled: true
199
+ VersionAdded: '5.4.0'
200
+ Exclude:
201
+ - '**/metadata.rb'
202
+
131
203
  ###############################
132
- # Resolving Deprecations
204
+ # ChefDeprecations: Resolving Deprecations that block upgrading Chef Infra Client
133
205
  ###############################
134
206
 
135
- Chef/NodeSet:
207
+ ChefDeprecations/NodeSet:
136
208
  Description: Do not use the deprecated node.set method
137
209
  Enabled: true
138
210
  VersionAdded: '5.0.0'
139
211
  Exclude:
140
212
  - '**/metadata.rb'
141
213
 
142
- Chef/NodeSetUnless:
214
+ ChefDeprecations/NodeSetUnless:
143
215
  Description: Do not use the deprecated node.set_unless method
144
216
  Enabled: true
145
217
  VersionAdded: '5.1.0'
146
218
  Exclude:
147
219
  - '**/metadata.rb'
148
220
 
149
- Chef/EpicFail:
221
+ ChefDeprecations/EpicFail:
150
222
  Description: Use ignore_failure method instead of the deprecated epic_fail method
151
223
  Enabled: true
152
224
  VersionAdded: '5.1.0'
153
225
  Exclude:
154
226
  - '**/metadata.rb'
155
227
 
156
- Chef/CookbookDependsOnPoise:
228
+ ChefDeprecations/CookbookDependsOnPoise:
157
229
  Description: Cookbooks should not depend on the deprecated Poise framework
158
230
  Enabled: true
159
231
  VersionAdded: '5.1.0'
160
232
  Include:
161
233
  - '**/metadata.rb'
162
234
 
163
- Chef/ConflictsMetadata:
235
+ ChefDeprecations/ConflictsMetadata:
164
236
  Description: Don't use the deprecated 'conflicts' metadata value
165
237
  Enabled: true
166
238
  VersionAdded: '5.1.0'
167
239
  Include:
168
240
  - '**/metadata.rb'
169
241
 
170
- Chef/SuggestsMetadata:
242
+ ChefDeprecations/SuggestsMetadata:
171
243
  Description: Don't use the deprecated 'suggests' metadata value
172
244
  Enabled: true
173
245
  VersionAdded: '5.1.0'
174
246
  Include:
175
247
  - '**/metadata.rb'
176
248
 
177
- Chef/ProvidesMetadata:
249
+ ChefDeprecations/ProvidesMetadata:
178
250
  Description: Don't use the deprecated 'provides' metadata value
179
251
  Enabled: true
180
252
  VersionAdded: '5.1.0'
181
253
  Include:
182
254
  - '**/metadata.rb'
183
255
 
184
- Chef/ReplacesMetadata:
256
+ ChefDeprecations/ReplacesMetadata:
185
257
  Description: Don't use the deprecated 'replaces' metadata value
186
258
  Enabled: true
187
259
  VersionAdded: '5.1.0'
188
260
  Include:
189
261
  - '**/metadata.rb'
190
262
 
191
- Chef/AttributeMetadata:
263
+ ChefDeprecations/AttributeMetadata:
192
264
  Description: Don't use the deprecated 'attribute' metadata value
193
265
  Enabled: true
194
266
  VersionAdded: '5.1.0'
195
267
  Include:
196
268
  - '**/metadata.rb'
197
269
 
198
- Chef/LongDescriptionMetadata:
270
+ ChefDeprecations/LongDescriptionMetadata:
199
271
  Description: The long_description metadata.rb method is not used and is unnecessary in cookbooks
200
272
  Enabled: true
201
273
  VersionAdded: '5.2.0'
202
274
  Include:
203
275
  - '**/metadata.rb'
204
276
 
205
- Chef/CookbookDependsOnCompatResource:
277
+ ChefDeprecations/CookbookDependsOnCompatResource:
206
278
  Description: Don't depend on the deprecated compat_resource cookbook made obsolete by Chef 12.19+
207
279
  Enabled: true
208
280
  VersionAdded: '5.1.0'
209
281
  Include:
210
282
  - '**/metadata.rb'
211
283
 
212
- Chef/CookbookDependsOnPartialSearch:
284
+ ChefDeprecations/CookbookDependsOnPartialSearch:
213
285
  Description: Don't depend on the deprecated partial_search cookbook made obsolete by Chef 13+
214
286
  Enabled: true
215
287
  VersionAdded: '5.1.0'
216
288
  Include:
217
289
  - '**/metadata.rb'
218
290
 
219
- Chef/EasyInstallResource:
291
+ ChefDeprecations/EasyInstallResource:
220
292
  Description: Don't use the deprecated easy_install resource resource removed in Chef 13
221
293
  Enabled: true
222
294
  VersionAdded: '5.1.0'
223
295
  Exclude:
224
296
  - '**/metadata.rb'
225
297
 
226
- Chef/ErlCallResource:
298
+ ChefDeprecations/ErlCallResource:
227
299
  Description: Don't use the deprecated erl_call resource removed in Chef 13
228
300
  Enabled: true
229
301
  VersionAdded: '5.1.0'
230
302
  Exclude:
231
303
  - '**/metadata.rb'
232
304
 
233
- Chef/RequireRecipe:
305
+ ChefDeprecations/RequireRecipe:
234
306
  Description: Use include_recipe instead of the require_recipe method
235
307
  Enabled: true
236
308
  VersionAdded: '5.2.0'
237
309
  Exclude:
238
310
  - '**/metadata.rb'
239
311
 
240
- Chef/NodeMethodsInsteadofAttributes:
312
+ ChefDeprecations/NodeMethodsInsteadofAttributes:
241
313
  Description: Use node attributes to access Ohai data instead of node methods, which were deprecated in Chef Infra Client 13.
242
314
  Enabled: true
243
315
  VersionAdded: '5.4.0'
244
316
  Exclude:
245
317
  - '**/metadata.rb'
246
318
 
247
- Chef/UsesDeprecatedMixins:
319
+ ChefDeprecations/UsesDeprecatedMixins:
248
320
  Description: Don't use deprecated Mixins no longer included in Chef Infra Client 14 and later.
249
321
  Enabled: true
250
322
  VersionAdded: '5.4.0'
251
323
  Include:
252
324
  - '**/libraries/*.rb'
253
325
  - '**/providers/*.rb'
326
+ - '**/resources/*.rb'
254
327
 
255
- Chef/IncludingMixinShelloutInResources:
256
- Description: There is no need to include Chef::Mixin::ShellOut in resources or providers as this is already done by Chef Infra Client.
328
+ ChefDeprecations/IncludingXMLRubyRecipe:
329
+ Description: The xml::ruby recipe installs nokogiri which is included in Chef Infra Client 12 and later.
257
330
  Enabled: true
258
331
  VersionAdded: '5.4.0'
259
- Include:
260
- - '**/resources/*.rb'
261
- - '**/providers/*.rb'
332
+ Exclude:
333
+ - '**/metadata.rb'
262
334
 
263
- Chef/LegacyYumCookbookRecipes:
335
+ ChefDeprecations/LegacyYumCookbookRecipes:
264
336
  Description: The elrepo, epel, ius, remi, and repoforge recipes were split into their own cookbooks and the yum recipe was renamed to be default with the release of yum cookbook 3.0 (Dec 2013).
265
337
  Enabled: true
266
338
  VersionAdded: '5.4.0'
267
339
  Exclude:
268
340
  - '**/metadata.rb'
269
341
 
270
- ###############################
271
- # Cleaning up Legacy Code
272
- ###############################
342
+ ChefDeprecations/UsesChefRESTHelpers:
343
+ Description: Don't use the helpers in Chef::REST which were removed in Chef Infra Client 13
344
+ Enabled: true
345
+ VersionAdded: '5.5.0'
346
+ Exclude:
347
+ - '**/metadata.rb'
273
348
 
274
- Chef/LegacyBerksfileSource:
275
- Description: Do not use legacy Berksfile community sources. Use Chef Supermarket instead.
349
+ ChefDeprecations/ChocolateyPackageUninstallAction:
350
+ Description: Use the :remove action in the chocolatey_package resource instead of :uninstall which was removed in Chef Infra Client 14+
276
351
  Enabled: true
277
- VersionAdded: '5.1.0'
278
- Include:
279
- - '**/Berksfile'
352
+ VersionAdded: '5.5.0'
353
+ Exclude:
354
+ - '**/metadata.rb'
280
355
 
281
- Chef/WhyRunSupportedTrue:
282
- Description: whyrun_supported? no longer needs to be set to true as it is the default in Chef 13+
356
+ ChefDeprecations/LaunchdDeprecatedHashProperty:
357
+ Description: The launchd resource's hash property was renamed to plist_hash in Chef Infra Client 13+ to avoid conflicts with Ruby's hash class.
283
358
  Enabled: true
284
- VersionAdded: '5.1.0'
359
+ VersionAdded: '5.5.0'
360
+ Exclude:
361
+ - '**/metadata.rb'
362
+
363
+ ChefDeprecations/LocaleDeprecatedLcAllProperty:
364
+ Description: The local resource's lc_all property has been deprecated and will be removed in Chef Infra Client 16
365
+ Enabled: true
366
+ VersionAdded: '5.5.0'
367
+ Exclude:
368
+ - '**/metadata.rb'
369
+
370
+ ChefDeprecations/UserDeprecatedSupportsProperty:
371
+ Description: The supports property was removed in Chef Infra Client 13 in favor of individual 'manage_home' and 'non_unique' properties.
372
+ Enabled: true
373
+ VersionAdded: '5.5.0'
374
+ Exclude:
375
+ - '**/metadata.rb'
376
+
377
+ ChefDeprecations/UseInlineResourcesDefined:
378
+ Description: use_inline_resources is now the default for resources in Chef Infra Client 13+ and does not need to be specified.
379
+ Enabled: true
380
+ VersionAdded: '5.4.0'
285
381
  Include:
286
- - '**/resources/*.rb'
287
- - '**/providers/*.rb'
288
382
  - '**/libraries/*.rb'
383
+ - '**/providers/*.rb'
384
+ - '**/resources/*.rb'
289
385
 
290
- Chef/PropertyWithNameAttribute:
291
- Description: Resource property sets name_attribute not name_property
386
+ ChefDeprecations/IncludingYumDNFCompatRecipe:
387
+ Description: Do not include the yum::dnf_yum_compat default recipe to install yum on dnf systems. Chef Infra Client now includes built in support for DNF.
388
+ Enabled: true
389
+ VersionAdded: '5.3.0'
390
+ Exclude:
391
+ - '**/metadata.rb'
392
+
393
+ ###############################
394
+ # ChefModernize: Cleaning up legacy code and using new built-in resources
395
+ ###############################
396
+
397
+ ChefModernize/LegacyBerksfileSource:
398
+ Description: Do not use legacy Berksfile community sources. Use Chef Supermarket instead.
292
399
  Enabled: true
293
400
  VersionAdded: '5.1.0'
294
401
  Include:
295
- - '**/resources/*.rb'
296
- - '**/libraries/*.rb'
402
+ - '**/Berksfile'
297
403
 
298
- Chef/PropertyWithRequiredAndDefault:
299
- Description: Resource property should not be both required and have a default value
404
+ ChefModernize/WhyRunSupportedTrue:
405
+ Description: whyrun_supported? no longer needs to be set to true as it is the default in Chef 13+
300
406
  Enabled: true
301
407
  VersionAdded: '5.1.0'
302
408
  Include:
303
409
  - '**/resources/*.rb'
410
+ - '**/providers/*.rb'
304
411
  - '**/libraries/*.rb'
305
412
 
306
- Chef/UnnecessaryDependsChef14:
413
+ ChefModernize/UnnecessaryDependsChef14:
307
414
  Description: Don't depend on cookbooks made obsolete by Chef 14
308
415
  Enabled: true
309
416
  VersionAdded: '5.1.0'
310
417
  Include:
311
418
  - '**/metadata.rb'
312
419
 
313
- Chef/RespondToInMetadata:
420
+ ChefModernize/RespondToInMetadata:
314
421
  Description: It is no longer necessary to use respond_to? in metadata.rb in Chef 12.15 and later
315
422
  Enabled: true
316
423
  VersionAdded: '5.2.0'
317
424
  Include:
318
425
  - '**/metadata.rb'
319
426
 
320
- Chef/RespondToResourceName:
427
+ ChefModernize/RespondToResourceName:
321
428
  Description: respond_to?(:resource_name) in resources is no longer necessary in Chef Infra Client 12.5+
322
429
  Enabled: true
323
430
  VersionAdded: '5.2.0'
@@ -325,7 +432,7 @@ Chef/RespondToResourceName:
325
432
  - '**/resources/*.rb'
326
433
  - '**/libraries/*.rb'
327
434
 
328
- Chef/RespondToProvides:
435
+ ChefModernize/RespondToProvides:
329
436
  Description: respond_to?(:provides) in resources is no longer necessary in Chef Infra Client 12+
330
437
  Enabled: true
331
438
  VersionAdded: '5.2.0'
@@ -333,7 +440,7 @@ Chef/RespondToProvides:
333
440
  - '**/providers/*.rb'
334
441
  - '**/libraries/*.rb'
335
442
 
336
- Chef/SetOrReturnInResources:
443
+ ChefModernize/SetOrReturnInResources:
337
444
  Description: Do not use set_or_return within a method to define a property for a resource. Use the property method instead, which supports validation, reporting, and documentation functionality.
338
445
  Enabled: true
339
446
  VersionAdded: '5.2.0'
@@ -341,141 +448,136 @@ Chef/SetOrReturnInResources:
341
448
  - '**/resources/*.rb'
342
449
  - '**/libraries/*.rb'
343
450
 
344
- Chef/CustomResourceWithAttributes:
451
+ ChefModernize/CustomResourceWithAttributes:
345
452
  Description: Custom Resources should contain properties not attributes.
346
453
  Enabled: true
347
454
  VersionAdded: '5.2.0'
348
455
  Include:
349
456
  - '**/resources/*.rb'
350
457
 
351
- Chef/CustomResourceWithAllowedActions:
458
+ ChefModernize/CustomResourceWithAllowedActions:
352
459
  Description: Custom Resources don't need to define the allowed actions with allowed_actions or actions methods
353
460
  Enabled: true
354
461
  VersionAdded: '5.2.0'
355
462
  Include:
356
463
  - '**/resources/*.rb'
357
464
 
358
- Chef/IncludingAptDefaultRecipe:
465
+ ChefModernize/IncludingAptDefaultRecipe:
359
466
  Description: Do not include the Apt default recipe to update package cache. Instead use the apt_update resource, which is built into Chef Infra Client 12.7 and later.
360
467
  Enabled: true
361
468
  VersionAdded: '5.3.0'
362
469
  Exclude:
363
470
  - '**/metadata.rb'
364
471
 
365
- Chef/IncludingWindowsDefaultRecipe:
472
+ ChefModernize/IncludingWindowsDefaultRecipe:
366
473
  Description: Do not include the Windows default recipe, which only installs win32 gems already included in Chef Infra Client
367
474
  Enabled: true
368
475
  VersionAdded: '5.3.0'
369
476
  Exclude:
370
477
  - '**/metadata.rb'
371
478
 
372
- Chef/IncludingYumDNFCompatRecipe:
373
- Description: Do not include the yum::dnf_yum_compat default recipe to install yum on dnf systems. Chef Infra Client now includes built in support for DNF.
374
- Enabled: true
375
- VersionAdded: '5.3.0'
376
- Exclude:
377
- - '**/metadata.rb'
378
-
379
- Chef/DefinesChefSpecMatchers:
479
+ ChefModernize/DefinesChefSpecMatchers:
380
480
  Description: ChefSpec matchers are now auto generated by ChefSpec 7.1+ and do not need to be defined in a cookbook
381
481
  Enabled: true
382
482
  VersionAdded: '5.3.0'
383
483
  Include:
384
484
  - '**/libraries/*.rb'
385
485
 
386
- Chef/ExecuteAptUpdate:
486
+ ChefModernize/ExecuteAptUpdate:
387
487
  Description: Use the apt_update resource instead of the execute resource to run an apt-get update package cache update
388
488
  Enabled: true
389
489
  VersionAdded: '5.3.0'
390
490
  Exclude:
391
491
  - '**/metadata.rb'
392
492
 
393
- Chef/WindowsZipfileUsage:
394
- Description: Use the archive_file resource built into Chef Infra Client 15+ instead of the windows_zipfile from the Windows cookbook
395
- Enabled: true
396
- VersionAdded: '5.4.0'
397
- Exclude:
398
- - '**/metadata.rb'
399
-
400
- Chef/WindowsVersionHelper:
493
+ ChefModernize/WindowsVersionHelper:
401
494
  Description: Use node['platform_version'] data instead of the Windows::VersionHelper helper from the Windows cookbook.
402
495
  Enabled: true
403
496
  VersionAdded: '5.4.0'
404
497
  Exclude:
405
498
  - '**/metadata.rb'
406
499
 
407
- Chef/MinitestHandlerUsage:
500
+ ChefModernize/MinitestHandlerUsage:
408
501
  Description: Use Chef InSpec for testing instead of the Minitest Handler cookbook pattern.
409
502
  Enabled: true
410
503
  VersionAdded: '5.4.0'
411
504
  Include:
412
505
  - '**/metadata.rb'
413
506
 
414
- Chef/IncludingOhaiDefaultRecipe:
415
- Description: Use the ohai_plugin resource to ship custom Ohai plugins instead of using the ohai::default recipe. If you're not shipping custom Ohai plugins, then you can remove this recipe entirely.
507
+ ChefModernize/IncludingMixinShelloutInResources:
508
+ Description: There is no need to include Chef::Mixin::ShellOut in resources or providers as this is already done by Chef Infra Client.
416
509
  Enabled: true
417
510
  VersionAdded: '5.4.0'
511
+ Include:
512
+ - '**/resources/*.rb'
513
+ - '**/providers/*.rb'
514
+
515
+ ChefModernize/UseBuildEssentialResource:
516
+ Description: Use the build_essential resource instead of the legacy build-essential recipe. This resource ships in the build-essential cookbook v5.0+ and is built into Chef Infra Client 14+
517
+ Enabled: true
518
+ VersionAdded: '5.1.0'
418
519
  Exclude:
419
520
  - '**/metadata.rb'
420
521
 
421
- Chef/IncludingXMLRubyRecipe:
422
- Description: The xml::ruby recipe installs nokogiri which is included in Chef Infra Client 12 and later.
522
+ ChefModernize/WindowsZipfileUsage:
523
+ Description: Use the archive_file resource built into Chef Infra Client 15+ instead of the windows_zipfile from the Windows cookbook
423
524
  Enabled: true
424
525
  VersionAdded: '5.4.0'
425
526
  Exclude:
426
527
  - '**/metadata.rb'
427
528
 
428
- Chef/UseInlineResourcesDefined:
429
- Description: use_inline_resources is now the default for resources in Chef Infra Client 13+ and does not need to be specified.
529
+ ChefModernize/SevenZipArchiveResource:
530
+ Description: Use the archive_file resource built into Chef Infra Client 15+ instead of the seven_zip_archive
430
531
  Enabled: true
431
- VersionAdded: '5.4.0'
432
- Include:
433
- - '**/libraries/*.rb'
434
- - '**/providers/*.rb'
435
- - '**/resources/*.rb'
436
-
437
- ###############################
438
- # Detecting code that breaks Chef
439
- ###############################
532
+ VersionAdded: '5.5.0'
533
+ Exclude:
534
+ - '**/metadata.rb'
440
535
 
441
- Chef/CookbooksDependsOnSelf:
442
- Description: A cookbook cannot depend on itself
536
+ ChefModernize/LibarchiveFileResource:
537
+ Description: Use the archive_file resource built into Chef Infra Client 15+ instead of the libarchive file resource
443
538
  Enabled: true
444
- VersionAdded: '5.2.0'
445
- Include:
539
+ VersionAdded: '5.5.0'
540
+ Exclude:
446
541
  - '**/metadata.rb'
447
542
 
448
- Chef/MetadataMissingName:
449
- Description: MetadataMissingName
543
+ ChefModernize/PowershellScriptExpandArchive:
544
+ Description: Use the archive_file resource built into Chef Infra Client 15+ instead of using Expand-Archive in a powershell_script resource
450
545
  Enabled: true
451
- VersionAdded: '5.2.0'
452
- Include:
546
+ VersionAdded: '5.5.0'
547
+ Exclude:
453
548
  - '**/metadata.rb'
454
549
 
455
- Chef/BlockGuardWithOnlyString:
456
- Description: A resource guard (not_if/only_if) that is a string should not be wrapped in {}. Wrapping a guard string in {} causes it be executed as Ruby code which will always returns true instead of a shell command that will actually run.
550
+ ChefModernize/PowershellInstallPackage:
551
+ Description: Use the package resource built into Chef Infra Client instead of using Install-Package in a powershell_script resource
457
552
  Enabled: true
458
- VersionAdded: '5.2.0'
553
+ VersionAdded: '5.5.0'
554
+ Exclude:
555
+ - '**/metadata.rb'
459
556
 
460
- ###############################
461
- # Utilize new built-in resources
462
- ###############################
557
+ ChefModernize/PowershellInstallWindowsFeature:
558
+ Description: Use the windows_feature resource built into Chef Infra Client 13+ instead of using Install-WindowsFeature or Add-WindowsFeature in a powershell_script resource
559
+ Enabled: true
560
+ VersionAdded: '5.5.0'
561
+ Exclude:
562
+ - '**/metadata.rb'
463
563
 
464
- Chef/UseBuildEssentialResource:
465
- Description: Use the build_essential resource instead of the legacy build-essential recipe. This resource ships in the build-essential cookbook v5.0+ and is built into Chef Infra Client 14+
564
+ ChefModernize/ShellOutToChocolatey:
565
+ Description: Use the Chocolatey resources built into Chef Infra Client instead of shelling out to the choco command
466
566
  Enabled: true
467
- VersionAdded: '5.1.0'
567
+ VersionAdded: '5.5.0'
568
+ Exclude:
569
+ - '**/metadata.rb'
468
570
 
469
571
  ###############################
470
572
  # Migrating to new patterns
471
573
  ###############################
472
574
 
473
- Chef/CookbookUsesSearch:
575
+ ChefEffortless/CookbookUsesSearch:
474
576
  Description: Cookbook uses search, which cannot be used in the Effortless Infra pattern
475
577
  Enabled: false
476
578
  VersionAdded: '5.1.0'
477
579
 
478
- Chef/CookbookUsesDatabags:
580
+ ChefEffortless/CookbookUsesDatabags:
479
581
  Description: Cookbook uses data bags, which cannot be used in the Effortless Infra pattern
480
582
  Enabled: false
481
583
  VersionAdded: '5.1.0'