-
Notifications
You must be signed in to change notification settings - Fork 54
/
cookstyle.yml
3131 lines (2771 loc) · 103 KB
/
cookstyle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
AllCops:
SuggestExtensions: false
NewCops: disable
DisabledByDefault: true
TargetRubyVersion: 2.5
TargetChefVersion: ~
inherit_mode:
merge:
- Include
Include:
- '**/.delivery/project.toml' # required by Chef/Deprecations/Delivery
- '**/.delivery/config.json' # required by Chef/Deprecations/Delivery
- '**/.foodcritic'
Exclude:
- '**/files/**/*'
- '**/vendor/**/*'
- Guardfile
Layout:
Exclude:
- '**/.delivery/project.toml'
- '**/.delivery/config.json'
Lint:
Exclude:
- '**/.delivery/project.toml'
- '**/.delivery/config.json'
Style:
Exclude:
- '**/.delivery/project.toml'
- '**/.delivery/config.json'
###############################
# Chef/Style: Making cookbooks look better
###############################
Chef/Style:
Enabled: true
StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/
Exclude:
- '**/.delivery/project.toml'
- '**/.delivery/config.json'
Chef/Style/AttributeKeys:
Description: Check which style of keys are used to access node attributes.
StyleGuide: 'chef_style_attributekeys'
Enabled: true
EnforcedStyle: strings
VersionAdded: '5.0.0'
SupportedStyles:
- strings
- symbols
Exclude:
- '**/metadata.rb'
Chef/Style/CopyrightCommentFormat:
Description: Properly format copyright dates in comment blocks and ensure dates are up to date
StyleGuide: 'chef_style_copyrightcommentformat'
Enabled: false
VersionAdded: '5.0.0'
Chef/Style/CommentSentenceSpacing:
Description: Use a single space after sentences in comments
StyleGuide: 'chef_style_commentsentencespacing'
Enabled: false
VersionAdded: '5.1.0'
Chef/Style/CommentFormat:
Description: Use Chef's unique format for comment headers
StyleGuide: 'chef_style_commentformat'
Enabled: true
VersionAdded: '5.0.0'
Exclude:
- '**/Berksfile'
Chef/Style/FileMode:
Description: Use strings to represent file modes to avoid confusion between octal and base 10 integer formats.
StyleGuide: 'chef_style_filemode'
Enabled: true
VersionAdded: '5.0.0'
Exclude:
- '**/attributes/*'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Style/UsePlatformHelpers:
Description: Use platform? and platform_family? helpers to check node platform in resources and recipes
StyleGuide: 'chef_style_useplatformhelpers'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
- '**/libraries/*'
- '**/Berksfile'
Chef/Style/SimplifyPlatformMajorVersionCheck:
Description: Use node['platform_version'].to_i instead of node['platform_version'].split('.').first or node['platform_version'].split('.')[0]
StyleGuide: 'chef_style_simplifyplatformmajorversioncheck'
Enabled: true
VersionAdded: '5.8.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Style/DefaultCopyrightComments:
Description: Cookbook copyright comment headers should be updated for a real person or organization.
StyleGuide: 'chef_style_defaultcopyrightcomments'
Enabled: true
VersionAdded: '5.12.0'
Chef/Style/UnnecessaryPlatformCaseStatement:
Description: Use the platform?() and platform_family?() helpers instead of a case statement that only includes a single when statement.
StyleGuide: 'chef_style_unnecessaryplatformcasestatement'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Style/ImmediateNotificationTiming:
Description: Use :immediately instead of :immediate for resource notification timing.
StyleGuide: 'chef_style_immediatenotificationtiming'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Style/TrueClassFalseClassResourceProperties:
Description: When setting the allowed types for a resource to accept either true or false values it's much simpler to use true and false instead of TrueClass and FalseClass.
StyleGuide: 'chef_style_trueclassfalseclassresourceproperties'
Enabled: true
VersionAdded: '5.16.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
Chef/Style/OverlyComplexSupportsDependsMetadata:
Description: Don't loop over an array to set cookbook dependencies or supported platforms if you have fewer than three values to set.
StyleGuide: 'chef_style_overcomplexsupportsdependsmetadata'
Enabled: true
VersionAdded: '5.19.0'
Include:
- '**/metadata.rb'
Chef/Style/ChefWhaaat:
Description: Do you mean Chef (the company) or a Chef product (e.g. Chef Infra, Chef InSpec, etc)?
StyleGuide: 'chef_style_chefwhaaat'
Enabled: false
VersionAdded: '5.20.0'
Chef/Style/UnnecessaryOSCheck:
Description: Use the platform_family?() helpers instead of node['os] == 'foo' for platform_families that match 1:1 with OS values. These helpers are easier to read and can accept multiple platform arguments, which greatly simplifies complex platform logic.
StyleGuide: 'chef_style_unnecessaryoscheck'
Enabled: true
VersionAdded: '5.21.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Style/NegatingOnlyIf:
Description: Use not_if instead of only_if that negates the Ruby statement with a !
StyleGuide: 'chef_style_negatingonlyif'
VersionAdded: '6.2.0'
Enabled: true
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Style/IncludeRecipeWithParentheses:
Description: There is no need to wrap the recipe in parentheses when using the include_recipe helper
StyleGuide: '#includerecipewithparentheses'
VersionAdded: '6.11.0'
Enabled: true
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
###############################
# Chef/Correctness: Avoiding potential problems
###############################
Chef/Correctness:
Enabled: true
StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/
Chef/Correctness/ServiceResource:
Description: Use a service resource to start and stop services instead of execute resources
StyleGuide: 'chef_correctness_serviceresource'
Enabled: true
VersionAdded: '5.0.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/NodeNormal:
Description: Do not use the node.normal method
StyleGuide: 'chef_correctness_nodenormal'
Enabled: true
VersionAdded: '5.1.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/NodeNormalUnless:
Description: Do not use the node.normal_unless method
StyleGuide: 'chef_correctness_chernodenormalunless'
Enabled: true
VersionAdded: '5.1.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/TmpPath:
Description: Use file_cache_path rather than hard-coding tmp paths
StyleGuide: 'chef_correctness_tmppath'
Enabled: true
VersionAdded: '5.0.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/InvalidPlatformMetadata:
Description: metadata.rb "supports" platform is invalid
StyleGuide: 'chef_correctness_invalidplatformmetadata'
Enabled: true
VersionAdded: '5.2.0'
Include:
- '**/metadata.rb'
Chef/Correctness/CookbookUsesNodeSave:
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.
StyleGuide: 'chef_correctness_cookbookusesnodesave'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/MetadataMissingName:
Description: The metadata.rb file is missing the name field which is required by Chef Infra Client 12 and later
StyleGuide: 'chef_correctness_metadatamissingname'
Enabled: true
VersionAdded: '5.2.0'
Include:
- '**/metadata.rb'
Chef/Correctness/BlockGuardWithOnlyString:
Description: A resource guard (not_if/only_if) that is a string should not be wrapped in {}. Wrapping a guard string in {} causes it to be executed as Ruby code which will always return true instead of a shell command that will actually run.
StyleGuide: 'chef_correctness_blockguardwithonlystring'
Enabled: true
VersionAdded: '5.2.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/ResourceSetsInternalProperties:
Description: Do not set properties used internally by Chef Infra Client to track the system state.
StyleGuide: 'chef_correctness_resourcesetsinternalproperties'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/ResourceSetsNameProperty:
Description: Resource sets the name property in the resource instead of using a name_property.
StyleGuide: 'chef_correctness_resourcesetsnameproperty'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/ResourceWithNoneAction:
Description: Resource uses the nonexistent :none action instead of the :nothing action
StyleGuide: 'chef_correctness_resourcewithnoneaction'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/InvalidVersionMetadata:
Description: Cookbook metadata.rb version field should follow X.Y.Z version format.
StyleGuide: 'chef_correctness_invalidversionmetadata'
Enabled: true
VersionAdded: '5.8.0'
Include:
- '**/metadata.rb'
Chef/Correctness/NotifiesActionNotSymbol:
Description: When notifying or subscribing an action within a resource the action should always be a symbol. In Chef Infra Client releases before 14.0 this may result in double notification.
StyleGuide: 'chef_correctness_notifiesactionnotsymbol'
Enabled: true
VersionAdded: '5.10.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/IncorrectLibraryInjection:
Description: Libraries should be injected into the Chef::DSL::Recipe or Chef::DSL::Resource classes and not Recipe/Resource/Provider classes directly.
StyleGuide: 'chef_correctness_incorrectlibraryinjection'
Enabled: true
VersionAdded: '5.10.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/InvalidPlatformHelper:
Description: Pass valid platforms to the platform? helper.
StyleGuide: 'chef_correctness_invalidplatformhelper'
Enabled: true
VersionAdded: '5.15.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/InvalidPlatformFamilyHelper:
Description: Pass valid platform families to the platform_family? helper.
StyleGuide: 'chef_correctness_invalidplatformfamilyhelper'
Enabled: true
VersionAdded: '5.15.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/ScopedFileExist:
Description: Scope file exist to access the correct File class by using ::File.exist? not File.exist?.
StyleGuide: 'chef_correctness_scopedfileexist'
Enabled: true
VersionAdded: '5.15.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/InvalidPlatformValueForPlatformFamilyHelper:
Description: Pass valid platforms families to the value_for_platform_family helper.
StyleGuide: 'chef_correctness_invalidplatformvalueforplatformfamilyhelper'
Enabled: true
VersionAdded: '5.15.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/InvalidPlatformValueForPlatformHelper:
Description: Pass valid platforms to the value_for_platform helper.
StyleGuide: 'chef_correctness_invalidplatformvalueforplatformhelper'
Enabled: true
VersionAdded: '5.15.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/InvalidNotificationTiming:
Description: Valid notification timings are :immediately, :immediate (alias for :immediately), :delayed, and :before.
StyleGuide: 'chef_correctness_invalidnotificationtiming'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/MalformedPlatformValueForPlatformHelper:
Description: When using the value_for_platform helper you must include a hash of possible platforms where each platform contains a hash of versions and potential values. If you don't wish to match on a particular version you can instead use the key 'default'.
StyleGuide: 'chef_correctness_malformedplatformvalueforplatformhelper'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/DnfPackageAllowDowngrades:
Description: dnf_package does not support the allow_downgrades property
StyleGuide: 'chef_correctness_dnfpackageallowdowngrades'
Enabled: true
VersionAdded: '5.16.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/ChefApplicationFatal:
Description: Use raise to force Chef Infra Client to fail instead of using Chef::Application.fatal
StyleGuide: 'chef_correctness_chefapplicationfatal'
Enabled: true
VersionAdded: '6.0.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/PowershellScriptDeleteFile:
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
StyleGuide: 'chef_correctness_powershellscriptdeletefiles'
Enabled: true
VersionAdded: '6.0.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/ConditionalRubyShellout:
Description: Don't use Ruby to shellout in an only_if / not_if conditional when you can shellout directly by wrapping the command in quotes.
StyleGuide: 'chef_correctness_conditionalrubyshellout'
Enabled: true
VersionAdded: '6.1.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/LazyEvalNodeAttributeDefaults:
Description: When setting a node attribute as a default value for a custom resource property, make sure to wrap the node attribute in `lazy {}` so that the node attribute is available when the resource executes.
StyleGuide: 'chef_correctness_lazyevalnodeattributedefaults'
Enabled: true
VersionAdded: '6.6.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
Chef/Correctness/OpenSSLPasswordHelpers:
Description: The secure_password helper from the openssl cookbooks Opscode::OpenSSL::Password class should not be used to generate passwords.
StyleGuide: 'chef_correctness_opensslpasswordhelpers'
Enabled: true
VersionAdded: '6.6.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/InvalidPlatformFamilyInCase:
Description: Use valid platform family values in case statements.
StyleGuide: 'chef_correctness_invalidplatformfamilyincase'
Enabled: true
VersionAdded: '6.6.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/InvalidPlatformInCase:
Description: Use valid platform values in case statements.
StyleGuide: 'chef_correctness_invalidplatformincase'
Enabled: true
VersionAdded: '6.6.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/InvalidDefaultAction:
Description: Default actions in resources should be a symbol or an array of symbols.
StyleGuide: 'chef_correctness_invaliddefaultaction'
Enabled: true
VersionAdded: '6.13.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
Chef/Correctness/SupportsMustBeFloat:
Description: Versions used in metadata.rb supports calls should be floats not integers.
StyleGuide: 'chef_correctness_supportsmustbefloat'
Enabled: true
VersionAdded: '6.13.0'
Include:
- '**/metadata.rb'
Chef/Correctness/MacosUserdefaultsInvalidType:
Description: The macos_userdefaults resource prior to Chef Infra Client 16.3 would silently continue if invalid types were passed resulting in unexpected behavior. Valid values are 'array', 'bool', 'dict', 'float', 'int', and 'string'.
StyleGuide: 'chef_correctness_macosuserdefaultsinvalidtype'
Enabled: true
VersionAdded: '6.14.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/LazyInResourceGuard:
Description: Using `lazy {}` within a resource guard (not_if/only_if) will cause failures and is unnecessary as resource guards are always lazily evaluated.
StyleGuide: 'chef_correctness_lazyinresourceguard'
Enabled: true
VersionAdded: '6.18.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/PropertyWithoutType:
Description: Custom resource properties or attributes should always define a type to help users understand the correct allowed values.
StyleGuide: 'chef_correctness_propertywithouttype'
Enabled: true
VersionAdded: '6.18.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
Chef/Correctness/OctalModeAsString:
Description: Don't represent file modes as strings containing octal values. Use standard base 10 file modes instead.
StyleGuide: 'chef_correctness_octalmodeasstring'
Enabled: true
VersionAdded: '6.21.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/MetadataMalformedDepends:
Description: metadata.rb cookbook dependencies and version constraints should be comma separated.
StyleGuide: 'chef_correctness_metadatamalformeddepends'
Enabled: true
VersionAdded: '7.16'
Include:
- '**/metadata.rb'
Chef/Correctness/PowershellFileExists:
Description: Use Ruby's built-in `File.exist?('C:\somefile')` method instead of executing PowerShell's `Test-Path` cmdlet, which takes longer to load.
StyleGuide: 'chef_correctness_powershellfileexists'
Enabled: true
VersionAdded: '7.19'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Correctness/MetadataMissingVersion:
Description: metadata.rb should define a version for the cookbook.
StyleGuide: 'chef_correctness_metadatamissingversion'
Enabled: true
VersionAdded: '7.25'
Include:
- '**/metadata.rb'
Chef/Correctness/InvalidCookbookName:
Description: Cookbook names should not contain invalid characters such as periods.
StyleGuide: 'chef_correctness_invalidcookbookname'
Enabled: true
VersionAdded: '7.27'
Include:
- '**/metadata.rb'
Chef/Correctness/InvalidNotificationResource:
Description: The resource to notify when calling `notifies` or `subscribes` must be a string.
StyleGuide: 'chef_correctness_invalidnotificationresource'
Enabled: true
VersionAdded: '7.28'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
###############################
# Chef/Sharing: Issues that prevent sharing code with other teams or with the Chef community in general
###############################
Chef/Sharing:
Enabled: true
StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/
Chef/Sharing/InsecureCookbookURL:
Description: Insecure http Github or Gitlab URLs for metadata source_url/issues_url fields
StyleGuide: 'chef_sharing_insecurecookbookurl'
Enabled: true
VersionAdded: '5.1.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
Chef/Sharing/InvalidLicenseString:
Description: Cookbook metadata.rb does not use a SPDX compliant license string or "all rights reserved"
StyleGuide: 'chef_sharing_invalidlicensestring'
Enabled: true
VersionAdded: '5.2.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
Chef/Sharing/DefaultMetadataMaintainer:
Description: Metadata contains default maintainer information from the cookbook generator. Add actual cookbook maintainer information to the metadata.rb.
StyleGuide: 'chef_sharing_defaultmetadatamaintainer'
Enabled: true
VersionAdded: '5.4.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
Chef/Sharing/EmptyMetadataField:
Description: metadata.rb should not include fields with an empty string. Either don't include the field or add a value.
StyleGuide: 'chef_sharing_emptymetadatafield'
Enabled: true
VersionAdded: '5.8.0'
VersionChanged: '5.15.0'
Include:
- '**/metadata.rb'
Chef/Sharing/IncludePropertyDescriptions:
Description: Properties should include description fields to allow automated documentation. Requires Chef Infra Client 13.9 or later.
StyleGuide: 'chef_sharing_includepropetydescriptions'
Enabled: false
VersionAdded: '6.1.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
Chef/Sharing/IncludeResourceDescriptions:
Description: Resources should include description fields to allow automated documentation. Requires Chef Infra Client 13.9 or later.
StyleGuide: 'chef_sharing_includeresourcedescriptions'
Enabled: false
VersionAdded: '6.1.0'
Include:
- '**/resources/*.rb'
Chef/Sharing/IncludeResourceExamples:
Description: Resources should include examples field to allow automated documentation. Requires Chef Infra Client 13.9 or later.
StyleGuide: 'chef_sharing_includeresourceexamples'
Enabled: false
VersionAdded: '6.10.0'
Include:
- '**/resources/*.rb'
###############################
# Chef/Deprecations: Resolving Deprecations that block upgrading Chef Infra Client
###############################
Chef/Deprecations:
Enabled: true
StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/
Chef/Deprecations/NodeDeepFetch:
Description: Do not use the deprecated chef-sugar node.deep_fetch methods
StyleGuide: 'chef_deprecations_nodedeepfetch'
Enabled: true
VersionAdded: '5.12.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Deprecations/NodeSet:
Description: Do not use the deprecated node.set method
StyleGuide: 'chef_deprecations_nodeset'
Enabled: true
VersionAdded: '5.0.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Deprecations/NodeSetUnless:
Description: Do not use the deprecated node.set_unless method
StyleGuide: 'chef_deprecations_nodesetunless'
Enabled: true
VersionAdded: '5.1.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Deprecations/EpicFail:
Description: Use `ignore_failure` in resources to continue when failures occur instead of the deprecated `epic_fail` property
StyleGuide: 'chef_deprecations_epicfail'
Enabled: true
VersionAdded: '5.1.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Deprecations/CookbookDependsOnPoise:
Description: Cookbooks should not depend on the deprecated Poise framework
StyleGuide: 'chef_deprecations_cookbookdependsonpoise'
Enabled: true
VersionAdded: '5.1.0'
Include:
- '**/metadata.rb'
Chef/Deprecations/CookbookDependsOnCompatResource:
Description: Don't depend on the deprecated compat_resource cookbook made obsolete by Chef Infra Client 12.19+
StyleGuide: 'chef_deprecations_cookbookdependsoncompatresource'
Enabled: true
VersionAdded: '5.1.0'
Include:
- '**/metadata.rb'
Chef/Deprecations/CookbookDependsOnPartialSearch:
Description: Don't depend on the deprecated partial_search cookbook made obsolete by Chef Infra Client 13+
StyleGuide: 'chef_deprecations_cookbookdependsonpartialsearch'
Enabled: true
VersionAdded: '5.1.0'
Include:
- '**/metadata.rb'
Chef/Deprecations/EasyInstallResource:
Description: Don't use the deprecated easy_install resource resource removed in Chef Infra Client 13
StyleGuide: 'chef_deprecations_easyinstallresource'
Enabled: true
VersionAdded: '5.1.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Deprecations/ErlCallResource:
Description: Don't use the deprecated erl_call resource removed in Chef Infra Client 13
StyleGuide: 'chef_deprecations_erlcallresource'
Enabled: true
VersionAdded: '5.1.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Deprecations/RequireRecipe:
Description: Use include_recipe instead of the require_recipe method
StyleGuide: 'chef_deprecations_requirerecipe'
Enabled: true
VersionAdded: '5.2.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Deprecations/NodeMethodsInsteadofAttributes:
Description: Use node attributes to access Ohai data instead of node methods, which were deprecated in Chef Infra Client 13.
StyleGuide: 'chef_deprecations_nodemethodsinsteadofattributes'
Enabled: true
VersionAdded: '5.4.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
Chef/Deprecations/UsesDeprecatedMixins:
Description: Don't use deprecated Mixins no longer included in Chef Infra Client 14 and later.
StyleGuide: 'chef_deprecations_usesdeprecatedmixins'
Enabled: true
VersionAdded: '5.4.0'
Include:
- '**/libraries/*.rb'
- '**/providers/*.rb'
- '**/resources/*.rb'
Chef/Deprecations/IncludingXMLRubyRecipe:
Description: The xml::ruby recipe installs nokogiri which is included in Chef Infra Client 12 and later.
StyleGuide: 'chef_deprecations_includingxmlrubyrecipe'
Enabled: true
VersionAdded: '5.4.0'
Exclude:
- '**/attributes/*.rb'
- '**/metadata.rb'
- '**/Berksfile'
Chef/Deprecations/LegacyYumCookbookRecipes:
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).
StyleGuide: 'chef_deprecations_legacyyumcookbookrecipes'
Enabled: true
VersionAdded: '5.4.0'
Exclude:
- '**/metadata.rb'
Chef/Deprecations/UsesChefRESTHelpers:
Description: Don't use the helpers in Chef::REST which were removed in Chef Infra Client 13
StyleGuide: 'chef_deprecations_useschefresthelpers'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
Chef/Deprecations/ChocolateyPackageUninstallAction:
Description: Use the :remove action in the chocolatey_package resource instead of :uninstall which was removed in Chef Infra Client 14+
StyleGuide: 'chef_deprecations_chocolateypackageuninstallaction'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
Chef/Deprecations/LaunchdDeprecatedHashProperty:
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.
StyleGuide: 'chef_deprecations_launchddeprecatedhashproperty'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
Chef/Deprecations/LocaleDeprecatedLcAllProperty:
Description: The local resource's lc_all property has been deprecated and will be removed in Chef Infra Client 16
StyleGuide: 'chef_deprecations_localedeprecatedlcallproperty'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
Chef/Deprecations/UserDeprecatedSupportsProperty:
Description: The supports property was removed in Chef Infra Client 13 in favor of individual 'manage_home' and 'non_unique' properties.
StyleGuide: 'chef_deprecations_userdeprecatedsupportsproperty'
Enabled: true
VersionAdded: '5.5.0'
Exclude:
- '**/metadata.rb'
Chef/Deprecations/UseInlineResourcesDefined:
Description: use_inline_resources is now the default for resources in Chef Infra Client 13+ and does not need to be specified.
StyleGuide: 'chef_deprecations_useinlineresourcesdefined'
Enabled: true
VersionAdded: '5.4.0'
Include:
- '**/libraries/*.rb'
- '**/providers/*.rb'
- '**/resources/*.rb'
Chef/Deprecations/IncludingYumDNFCompatRecipe:
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.
StyleGuide: 'chef_deprecations_includingyumdnfcompatrecipe'
Enabled: true
VersionAdded: '5.3.0'
Exclude:
- '**/metadata.rb'
Chef/Deprecations/WindowsTaskChangeAction:
Description: The :change action in the windows_task resource was removed when windows_task was added to Chef Infra Client 13+. The default action of :create should can now be used to create an update tasks.
StyleGuide: 'chef_deprecations_windowstaskchangeaction'
Enabled: true
VersionAdded: '5.6.0'
Exclude:
- '**/metadata.rb'
Chef/Deprecations/ResourceOverridesProvidesMethod:
Description: Don't override the provides? method in a resource provider. Use provides :SOME_PROVIDER_NAME instead. This will cause failures in Chef Infra Client 13 and later.
StyleGuide: 'chef_deprecations_resourceoverridesprovidesmethod'
Enabled: true
VersionAdded: '5.7.0'
Include:
- '**/libraries/*.rb'
- '**/providers/*.rb'
- '**/resources/*.rb'
Chef/Deprecations/ResourceUsesDslNameMethod:
Description: Use resource_name instead of the dsl_name method in resources. This will cause failures in Chef Infra Client 13 and later.
StyleGuide: 'chef_deprecations_resourceusesdslnamemethod'
Enabled: true
VersionAdded: '5.7.0'
Include:
- '**/libraries/*.rb'
- '**/providers/*.rb'
- '**/resources/*.rb'
Chef/Deprecations/ResourceUsesUpdatedMethod:
Description: Don't use updated = true/false to update resource state. This will cause failures in Chef Infra Client 13 and later.
StyleGuide: 'chef_deprecations_resourceusesupdatedmethod'
Enabled: false # has a high potential for false positives
VersionAdded: '5.7.0'
Include:
- '**/libraries/*.rb'
- '**/providers/*.rb'
- '**/resources/*.rb'
Chef/Deprecations/NamePropertyWithDefaultValue:
Description: A resource property can't be marked as a name_property and also have a default value. This will fail in Chef Infra Client 13 or later.
StyleGuide: 'chef_deprecations_namepropertywithdefaultvalue'
Enabled: true
VersionAdded: '5.7.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
Chef/Deprecations/ResourceUsesProviderBaseMethod:
Description: Don't use the deprecated provider_base method in a resource to specify the provider module to use. Instead, the provider should call provides to register itself, or the resource should call provider to specify the provider to use. This will cause failures in Chef Infra Client 13 and later.
StyleGuide: 'chef_deprecations_resourceusesproviderbasemethod'
Enabled: true
VersionAdded: '5.7.0'
Include:
- '**/libraries/*.rb'
- '**/resources/*.rb'
Chef/Deprecations/ChefSpecCoverageReport:
Description: Don't use the deprecated ChefSpec coverage report functionality in your specs.
StyleGuide: 'chef_deprecations_chefspeccoveragereport'
Enabled: true
VersionAdded: '5.8.0'
Include:
- '**/spec/*.rb'
Chef/Deprecations/ChefSpecLegacyRunner:
Description: Use ChefSpec::SoloRunner or ChefSpec::ServerRunner instead of the deprecated ChefSpec::Runner.
StyleGuide: 'chef_deprecations_chefspeclegacyrunner'
Enabled: true
VersionAdded: '5.8.0'
Include:
- '**/spec/*.rb'
Chef/Deprecations/UsesRunCommandHelper:
Description: Use 'shell_out!' instead of the legacy 'run_command' helper for shelling out. The run_command helper was removed in Chef Infra Client 13.
StyleGuide: 'chef_deprecations_usesruncommandhelper'
Enabled: true
VersionAdded: '5.9.0'
Exclude:
- '**/metadata.rb'
- '**/Berksfile'
- '**/Rakefile'
Chef/Deprecations/ChefHandlerUsesSupports:
Description: Use the type property instead of the deprecated supports property in the chef_handler resource. The supports property was removed in chef_handler cookbook version 3.0 (June 2017) and Chef Infra Client 14.0.
StyleGuide: 'chef_deprecations_chefhandlerusessupports'
Enabled: true
VersionAdded: '5.9.0'
Exclude:
- '**/metadata.rb'
Chef/Deprecations/DeprecatedYumRepositoryProperties:
Description: With the release of Chef Infra Client 12.14 and the yum cookbook 3.0 several properties in the yum_repository resource were renamed. url -> baseurl, keyurl -> gpgkey, and mirrorexpire -> mirror_expire.
StyleGuide: 'chef_deprecations_deprecatedyumrepositoryproperties'
Enabled: true
VersionAdded: '5.10.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
Chef/Deprecations/EOLAuditModeUsage:
Description: The beta Audit Mode feature in Chef Infra Client was removed in Chef Infra Client 15.0.
StyleGuide: 'chef_deprecations_eolauditmodeusage'
Enabled: true
VersionAdded: '5.10.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
Chef/Deprecations/ResourceInheritsFromCompatResource:
Description: HWRP style resource should inherit from the 'Chef::Resource' class and not the 'ChefCompat::Resource' class from the deprecated compat_resource cookbook.
StyleGuide: 'chef_deprecations_resourceinheritsfromcompatresource'
Enabled: true
VersionAdded: '5.10.0'
Include:
- '**/libraries/*.rb'
Chef/Deprecations/VerifyPropertyUsesFileExpansion:
Description: Use the 'path' variable in the verify property and not the 'file' variable which was removed in Chef Infra Client 13.
StyleGuide: 'chef_deprecations_verifypropertyusesfileexpansion'
Enabled: true
VersionAdded: '5.10.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
Chef/Deprecations/PoiseArchiveUsage:
Description: The poise_archive resource in the deprecated poise-archive should be replaced with the archive_file resource found in Chef Infra Client 15+.
StyleGuide: 'chef_deprecations_poisearchiveusage'
Enabled: true
VersionAdded: '5.11.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
Chef/Deprecations/PartialSearchHelperUsage:
Description: Legacy partial_search usage should be updated to use :filter_result in the search helper instead.
StyleGuide: 'chef_deprecations_partialsearchhelperusage'
Enabled: true
VersionAdded: '5.11.0'
Exclude:
- '**/metadata.rb'
Chef/Deprecations/SearchUsesPositionalParameters:
Description: Don't use deprecated positional parameters in cookbook search queries.
StyleGuide: 'chef_deprecations_searchusespositionalparameters'
Enabled: true
VersionAdded: '5.11.0'
Exclude:
- '**/metadata.rb'
Chef/Deprecations/PartialSearchClassUsage:
Description: Legacy Chef::PartialSearch class usage should be updated to use the search helper instead with the filter_result key.
StyleGuide: 'chef_deprecations_partialsearchclassusage'
Enabled: true
VersionAdded: '5.11.0'
Exclude:
- '**/metadata.rb'
Chef/Deprecations/Cheffile:
Description: The Librarian-Chef depsolving project is no longer maintained and should not be used for cookbook depsolving. Consider using Policyfiles instead.
StyleGuide: 'chef_deprecations_cheffile'
Enabled: true
VersionAdded: '5.12.0'
Include:
- '**/Cheffile'
Chef/Deprecations/LegacyNotifySyntax:
Description: Use the new-style notification syntax which allows you to notify resources defined later in a recipe or resource.
StyleGuide: 'chef_deprecations_legacynotifysyntax'
Enabled: true
VersionAdded: '5.13.0'
Exclude:
- '**/metadata.rb'
- '**/attributes/*.rb'
- '**/Berksfile'
Chef/Deprecations/NodeSetWithoutLevel:
Description: When setting a node attribute in Chef Infra Client 11 and later you must specify the precedence level.