cookstyle 7.12.5 → 7.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff64e11eb7d5b6204670539ac299648679a0271191f3f8781193787fec6c5be2
4
- data.tar.gz: 2ac49d8b00ad274279648597dc3f4f524eedf8f5124638649e54018536d6d7dd
3
+ metadata.gz: af99d51e19e15818c6e7abfc5568ad41eb3177b22a12b100a3504dbc0eeb7a93
4
+ data.tar.gz: 9aa6ba0fed844a339352cbd3f7df53f33a6a8de9dc43b4efd9fee5b4e5306ed6
5
5
  SHA512:
6
- metadata.gz: 11e829e19400ed6a27dd1befd3b7ff5b393d8f98659301746e24680d6d8d9a8758c4b963c98774217c70ebb747dfd47de23eb0aac68174165ad2c9806d2e07c3
7
- data.tar.gz: d1acb2e46834f72ae79337de8abec6f6547d64b6f131d8234a7c65978e23cb490de310ada247a95f86fd013934ee2dc7ceeec20fc252e7d8677b503435d71816
6
+ metadata.gz: 495d1fe5dd18b8af274968bbb5a191314f1b36489376b7190fd225a43bd496e77ec8a176e035200f66f8c2489a5cdf2a283eb9a8a49fdcd4a900aa46de403f5e
7
+ data.tar.gz: b8f3bdc192e31b5bfd62e890a417c3b87e194197f4d8ab17381e5751a1ff6d1a0e2debf9af867dd36ece02cb0d07dcfabe0691922cbc4f0483fdc2d048615ce1
data/config/cookstyle.yml CHANGED
@@ -3,8 +3,8 @@ AllCops:
3
3
  TargetRubyVersion: 2.5
4
4
  TargetChefVersion: ~
5
5
  Exclude:
6
- - '/**/files/**/*'
7
- - '/**/vendor/**/*'
6
+ - '**/files/**/*'
7
+ - '**/vendor/**/*'
8
8
  - Guardfile
9
9
 
10
10
  ###############################
@@ -1208,6 +1208,14 @@ Chef/Deprecations/ResourceWithoutUnifiedTrue:
1208
1208
  Exclude:
1209
1209
  - '**/spec/**/*.rb'
1210
1210
 
1211
+ Chef/Deprecations/PolicyfileCommunitySource:
1212
+ Description: The Policyfile source of `:community` has been replaced with `:supermarket`
1213
+ StyleGuide: 'chef_deprecations_policyfilecommunitysource'
1214
+ Enabled: true
1215
+ VersionAdded: '7.15.0'
1216
+ Include:
1217
+ - '**/Policyfile.rb'
1218
+
1211
1219
  ###############################
1212
1220
  # Chef/Modernize: Cleaning up legacy code and using new built-in resources
1213
1221
  ###############################
@@ -2080,6 +2088,27 @@ Chef/Effortless/Berksfile:
2080
2088
  Include:
2081
2089
  - '**/Berksfile'
2082
2090
 
2091
+ #### InSpec cops
2092
+
2093
+ InSpec/Deprecations:
2094
+ StyleGuideBaseURL: https://docs.chef.io/workstation/cookstyle/
2095
+
2096
+ InSpec/Deprecations/AttributeHelper:
2097
+ Description: InSpec attributes have been renamed to inputs. Use the `input` method not the deprecation `attribute` method to access these values.
2098
+ StyleGuide: 'inspec_deprecations_attributehelper'
2099
+ Enabled: true
2100
+ VersionAdded: '7.14.0'
2101
+ Include:
2102
+ - '**/controls/*.rb'
2103
+
2104
+ InSpec/Deprecations/AttributeDefault:
2105
+ Description: The InSpec inputs `default` option has been replaced with the `value` option.
2106
+ StyleGuide: 'inspec_deprecations_attributedefaults'
2107
+ Enabled: true
2108
+ VersionAdded: '7.14.0'
2109
+ Include:
2110
+ - '**/controls/*.rb'
2111
+
2083
2112
  #### The base rubocop 0.37 enabled.yml file we started with ####
2084
2113
 
2085
2114
  Layout/AccessModifierIndentation:
@@ -123,6 +123,8 @@ Layout/LeadingCommentSpace:
123
123
  Enabled: false
124
124
  Layout/LeadingEmptyLines:
125
125
  Enabled: false
126
+ Layout/LineEndStringConcatenationIndentation:
127
+ Enabled: false
126
128
  Layout/LineLength:
127
129
  Enabled: false
128
130
  Layout/MultilineArrayBraceLayout:
@@ -275,6 +277,8 @@ Lint/EmptyExpression:
275
277
  Enabled: false
276
278
  Lint/EmptyFile:
277
279
  Enabled: false
280
+ Lint/EmptyInPattern:
281
+ Enabled: false
278
282
  Lint/EmptyInterpolation:
279
283
  Enabled: false
280
284
  Lint/EmptyWhen:
@@ -485,6 +489,8 @@ Naming/HeredocDelimiterCase:
485
489
  Enabled: false
486
490
  Naming/HeredocDelimiterNaming:
487
491
  Enabled: false
492
+ Naming/InclusiveLanguage:
493
+ Enabled: false
488
494
  Naming/MemoizedInstanceVariableName:
489
495
  Enabled: false
490
496
  Naming/MethodName:
@@ -667,6 +673,8 @@ Style/IfWithSemicolon:
667
673
  Enabled: false
668
674
  Style/ImplicitRuntimeError:
669
675
  Enabled: false
676
+ Style/InPatternThen:
677
+ Enabled: false
670
678
  Style/InfiniteLoop:
671
679
  Enabled: false
672
680
  Style/InverseMethods:
@@ -687,6 +695,8 @@ Style/MethodCallWithoutArgsParentheses:
687
695
  Enabled: false
688
696
  Style/MethodCallWithArgsParentheses:
689
697
  Enabled: false
698
+ Style/MultilineInPatternThen:
699
+ Enabled: false
690
700
  Style/RedundantAssignment:
691
701
  Enabled: false
692
702
  Style/RedundantFetchBlock:
@@ -787,6 +797,8 @@ Style/PreferredHashMethods:
787
797
  Enabled: false
788
798
  Style/Proc:
789
799
  Enabled: false
800
+ Style/QuotedSymbols:
801
+ Enabled: false
790
802
  Style/RaiseArgs:
791
803
  Enabled: false
792
804
  Style/RandomWithOffset:
@@ -883,6 +895,8 @@ Style/SymbolProc:
883
895
  Enabled: false
884
896
  Style/TernaryParentheses:
885
897
  Enabled: false
898
+ Style/TopLevelMethodDefinition:
899
+ Enabled: false
886
900
  Style/TrailingBodyOnClass:
887
901
  Enabled: false
888
902
  Style/TrailingBodyOnMethodDefinition:
@@ -933,3 +947,7 @@ Security/Open:
933
947
  Enabled: false
934
948
  Security/YAMLLoad:
935
949
  Enabled: false
950
+ InSpec/Deprecations/AttributeDefault:
951
+ Enabled: false
952
+ InSpec/Deprecations/AttributeHelper:
953
+ Enabled: false
data/config/upstream.yml CHANGED
@@ -270,8 +270,8 @@ Layout/AccessModifierIndentation:
270
270
  SupportedStyles:
271
271
  - outdent
272
272
  - indent
273
- # By default, the indentation width from Layout/IndentationWidth is used
274
- # But it can be overridden by setting this parameter
273
+ # By default the indentation width from `Layout/IndentationWidth` is used,
274
+ # but it can be overridden by setting this parameter.
275
275
  IndentationWidth: ~
276
276
 
277
277
  Layout/ArgumentAlignment:
@@ -299,8 +299,8 @@ Layout/ArgumentAlignment:
299
299
  SupportedStyles:
300
300
  - with_first_argument
301
301
  - with_fixed_indentation
302
- # By default, the indentation width from Layout/IndentationWidth is used
303
- # But it can be overridden by setting this parameter
302
+ # By default the indentation width from `Layout/IndentationWidth` is used,
303
+ # but it can be overridden by setting this parameter.
304
304
  IndentationWidth: ~
305
305
 
306
306
  Layout/ArrayAlignment:
@@ -328,8 +328,8 @@ Layout/ArrayAlignment:
328
328
  SupportedStyles:
329
329
  - with_first_element
330
330
  - with_fixed_indentation
331
- # By default, the indentation width from Layout/IndentationWidth is used
332
- # But it can be overridden by setting this parameter
331
+ # By default the indentation width from `Layout/IndentationWidth` is used,
332
+ # but it can be overridden by setting this parameter.
333
333
  IndentationWidth: ~
334
334
 
335
335
  Layout/AssignmentIndentation:
@@ -339,8 +339,8 @@ Layout/AssignmentIndentation:
339
339
  Enabled: true
340
340
  VersionAdded: '0.49'
341
341
  VersionChanged: '0.77'
342
- # By default, the indentation width from `Layout/IndentationWidth` is used
343
- # But it can be overridden by setting this parameter
342
+ # By default the indentation width from `Layout/IndentationWidth` is used,
343
+ # but it can be overridden by setting this parameter.
344
344
  IndentationWidth: ~
345
345
 
346
346
  Layout/BeginEndAlignment:
@@ -377,18 +377,19 @@ Layout/BlockEndNewline:
377
377
  VersionAdded: '0.49'
378
378
 
379
379
  Layout/CaseIndentation:
380
- Description: 'Indentation of when in a case/when/[else/]end.'
380
+ Description: 'Indentation of when in a case/(when|in)/[else/]end.'
381
381
  StyleGuide: '#indent-when-to-case'
382
382
  Enabled: true
383
383
  VersionAdded: '0.49'
384
+ VersionChanged: '1.16'
384
385
  EnforcedStyle: case
385
386
  SupportedStyles:
386
387
  - case
387
388
  - end
388
389
  IndentOneStep: false
389
- # By default, the indentation width from `Layout/IndentationWidth` is used.
390
- # But it can be overridden by setting this parameter.
391
- # This only matters if `IndentOneStep` is `true`
390
+ # By default the indentation width from `Layout/IndentationWidth` is used,
391
+ # but it can be overridden by setting this parameter.
392
+ # This only matters if `IndentOneStep` is `true`.
392
393
  IndentationWidth: ~
393
394
 
394
395
  Layout/ClassStructure:
@@ -665,8 +666,8 @@ Layout/FirstArgumentIndentation:
665
666
  # Same as `special_for_inner_method_call` except that the special rule only
666
667
  # applies if the outer method call encloses its arguments in parentheses.
667
668
  - special_for_inner_method_call_in_parentheses
668
- # By default, the indentation width from `Layout/IndentationWidth` is used
669
- # But it can be overridden by setting this parameter
669
+ # By default the indentation width from `Layout/IndentationWidth` is used,
670
+ # but it can be overridden by setting this parameter.
670
671
  IndentationWidth: ~
671
672
 
672
673
  Layout/FirstArrayElementIndentation:
@@ -692,8 +693,8 @@ Layout/FirstArrayElementIndentation:
692
693
  - special_inside_parentheses
693
694
  - consistent
694
695
  - align_brackets
695
- # By default, the indentation width from `Layout/IndentationWidth` is used
696
- # But it can be overridden by setting this parameter
696
+ # By default the indentation width from `Layout/IndentationWidth` is used,
697
+ # but it can be overridden by setting this parameter.
697
698
  IndentationWidth: ~
698
699
 
699
700
  Layout/FirstArrayElementLineBreak:
@@ -724,8 +725,8 @@ Layout/FirstHashElementIndentation:
724
725
  - special_inside_parentheses
725
726
  - consistent
726
727
  - align_braces
727
- # By default, the indentation width from `Layout/IndentationWidth` is used
728
- # But it can be overridden by setting this parameter
728
+ # By default the indentation width from `Layout/IndentationWidth` is used,
729
+ # but it can be overridden by setting this parameter.
729
730
  IndentationWidth: ~
730
731
 
731
732
  Layout/FirstHashElementLineBreak:
@@ -760,8 +761,8 @@ Layout/FirstParameterIndentation:
760
761
  SupportedStyles:
761
762
  - consistent
762
763
  - align_parentheses
763
- # By default, the indentation width from `Layout/IndentationWidth` is used
764
- # But it can be overridden by setting this parameter
764
+ # By default the indentation width from `Layout/IndentationWidth` is used,
765
+ # but it can be overridden by setting this parameter.
765
766
  IndentationWidth: ~
766
767
 
767
768
  Layout/HashAlignment:
@@ -771,7 +772,7 @@ Layout/HashAlignment:
771
772
  Enabled: true
772
773
  AllowMultipleStyles: true
773
774
  VersionAdded: '0.49'
774
- VersionChanged: '0.77'
775
+ VersionChanged: '1.16'
775
776
  # Alignment of entries using hash rocket as separator. Valid values are:
776
777
  #
777
778
  # key - left alignment of keys
@@ -882,8 +883,8 @@ Layout/IndentationStyle:
882
883
  Enabled: true
883
884
  VersionAdded: '0.49'
884
885
  VersionChanged: '0.82'
885
- # By default, the indentation width from Layout/IndentationWidth is used
886
- # But it can be overridden by setting this parameter
886
+ # By default the indentation width from `Layout/IndentationWidth` is used,
887
+ # but it can be overridden by setting this parameter.
887
888
  # It is used during auto-correction to determine how many spaces should
888
889
  # replace each tab.
889
890
  IndentationWidth: ~
@@ -922,6 +923,20 @@ Layout/LeadingEmptyLines:
922
923
  VersionAdded: '0.57'
923
924
  VersionChanged: '0.77'
924
925
 
926
+ Layout/LineEndStringConcatenationIndentation:
927
+ Description: >-
928
+ Checks the indentation of the next line after a line that
929
+ ends with a string literal and a backslash.
930
+ Enabled: pending
931
+ VersionAdded: '1.18'
932
+ EnforcedStyle: aligned
933
+ SupportedStyles:
934
+ - aligned
935
+ - indented
936
+ # By default the indentation width from `Layout/IndentationWidth` is used,
937
+ # but it can be overridden by setting this parameter.
938
+ IndentationWidth: ~
939
+
925
940
  Layout/LineLength:
926
941
  Description: 'Checks that line length does not exceed the configured limit.'
927
942
  StyleGuide: '#max-line-length'
@@ -1052,8 +1067,8 @@ Layout/MultilineMethodCallIndentation:
1052
1067
  - aligned
1053
1068
  - indented
1054
1069
  - indented_relative_to_receiver
1055
- # By default, the indentation width from Layout/IndentationWidth is used
1056
- # But it can be overridden by setting this parameter
1070
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1071
+ # but it can be overridden by setting this parameter.
1057
1072
  IndentationWidth: ~
1058
1073
 
1059
1074
  Layout/MultilineMethodDefinitionBraceLayout:
@@ -1082,8 +1097,8 @@ Layout/MultilineOperationIndentation:
1082
1097
  SupportedStyles:
1083
1098
  - aligned
1084
1099
  - indented
1085
- # By default, the indentation width from `Layout/IndentationWidth` is used
1086
- # But it can be overridden by setting this parameter
1100
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1101
+ # but it can be overridden by setting this parameter.
1087
1102
  IndentationWidth: ~
1088
1103
 
1089
1104
  Layout/ParameterAlignment:
@@ -1111,8 +1126,8 @@ Layout/ParameterAlignment:
1111
1126
  SupportedStyles:
1112
1127
  - with_first_parameter
1113
1128
  - with_fixed_indentation
1114
- # By default, the indentation width from Layout/IndentationWidth is used
1115
- # But it can be overridden by setting this parameter
1129
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1130
+ # but it can be overridden by setting this parameter.
1116
1131
  IndentationWidth: ~
1117
1132
 
1118
1133
  Layout/RedundantLineBreak:
@@ -1612,7 +1627,7 @@ Lint/EmptyBlock:
1612
1627
  Description: 'This cop checks for blocks without a body.'
1613
1628
  Enabled: pending
1614
1629
  VersionAdded: '1.1'
1615
- VersionChanged: '1.3'
1630
+ VersionChanged: '1.15'
1616
1631
  AllowComments: true
1617
1632
  AllowEmptyLambdas: true
1618
1633
 
@@ -1645,6 +1660,12 @@ Lint/EmptyFile:
1645
1660
  AllowComments: true
1646
1661
  VersionAdded: '0.90'
1647
1662
 
1663
+ Lint/EmptyInPattern:
1664
+ Description: 'Checks for the presence of `in` pattern branches without a body.'
1665
+ Enabled: pending
1666
+ AllowComments: true
1667
+ VersionAdded: '1.16'
1668
+
1648
1669
  Lint/EmptyInterpolation:
1649
1670
  Description: 'Checks for empty string interpolation.'
1650
1671
  Enabled: true
@@ -1788,7 +1809,7 @@ Lint/MissingCopEnableDirective:
1788
1809
  Lint/MissingSuper:
1789
1810
  Description: >-
1790
1811
  This cop checks for the presence of constructors and lifecycle callbacks
1791
- without calls to `super`'.
1812
+ without calls to `super`.
1792
1813
  Enabled: true
1793
1814
  VersionAdded: '0.89'
1794
1815
  VersionChanged: '1.4'
@@ -2092,6 +2113,7 @@ Lint/SymbolConversion:
2092
2113
  Description: 'Checks for unnecessary symbol conversions.'
2093
2114
  Enabled: pending
2094
2115
  VersionAdded: '1.9'
2116
+ VersionChanged: '1.16'
2095
2117
  EnforcedStyle: strict
2096
2118
  SupportedStyles:
2097
2119
  - strict
@@ -2512,6 +2534,31 @@ Naming/HeredocDelimiterNaming:
2512
2534
  ForbiddenDelimiters:
2513
2535
  - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
2514
2536
 
2537
+ Naming/InclusiveLanguage:
2538
+ Description: 'Recommend the use of inclusive language instead of problematic terms.'
2539
+ Enabled: pending
2540
+ VersionAdded: '1.18'
2541
+ CheckIdentifiers: true
2542
+ CheckConstants: true
2543
+ CheckVariables: true
2544
+ CheckStrings: false
2545
+ CheckSymbols: true
2546
+ CheckComments: true
2547
+ CheckFilepaths: true
2548
+ FlaggedTerms:
2549
+ whitelist:
2550
+ Regex: !ruby/regexp '/white[-_\s]?list/'
2551
+ Suggestions:
2552
+ - allowlist
2553
+ - permit
2554
+ blacklist:
2555
+ Regex: !ruby/regexp '/black[-_\s]?list/'
2556
+ Suggestions:
2557
+ - denylist
2558
+ - block
2559
+ slave:
2560
+ Suggestions: ['replica', 'secondary', 'follower']
2561
+
2515
2562
  Naming/MemoizedInstanceVariableName:
2516
2563
  Description: >-
2517
2564
  Memoized method name should match memo instance variable name.
@@ -3103,6 +3150,7 @@ Style/CommentAnnotation:
3103
3150
  - HACK
3104
3151
  - REVIEW
3105
3152
  - NOTE
3153
+ RequireColon: true
3106
3154
 
3107
3155
  Style/CommentedKeyword:
3108
3156
  Description: 'Do not place comments on the same line as certain keywords.'
@@ -3480,6 +3528,7 @@ Style/HashAsLastArrayItem:
3480
3528
 
3481
3529
  Style/HashConversion:
3482
3530
  Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3531
+ StyleGuide: '#avoid-hash-constructor'
3483
3532
  Enabled: pending
3484
3533
  VersionAdded: '1.10'
3485
3534
  VersionChanged: '1.11'
@@ -3489,8 +3538,10 @@ Style/HashEachMethods:
3489
3538
  Description: 'Use Hash#each_key and Hash#each_value.'
3490
3539
  StyleGuide: '#hash-each'
3491
3540
  Enabled: true
3492
- VersionAdded: '0.80'
3493
3541
  Safe: false
3542
+ VersionAdded: '0.80'
3543
+ VersionChanged: '1.16'
3544
+ AllowedReceivers: []
3494
3545
 
3495
3546
  Style/HashExcept:
3496
3547
  Description: >-
@@ -3553,6 +3604,7 @@ Style/IdenticalConditionalBranches:
3553
3604
  out of the conditional.
3554
3605
  Enabled: true
3555
3606
  VersionAdded: '0.36'
3607
+ VersionChanged: '1.16'
3556
3608
 
3557
3609
  Style/IfInsideElse:
3558
3610
  Description: 'Finds if nodes inside else, which can be converted to elsif.'
@@ -3599,6 +3651,12 @@ Style/ImplicitRuntimeError:
3599
3651
  Enabled: false
3600
3652
  VersionAdded: '0.41'
3601
3653
 
3654
+ Style/InPatternThen:
3655
+ Description: 'Checks for `in;` uses in `case` expressions.'
3656
+ StyleGuide: '#no-in-pattern-semicolons'
3657
+ Enabled: pending
3658
+ VersionAdded: '1.16'
3659
+
3602
3660
  Style/InfiniteLoop:
3603
3661
  Description: >-
3604
3662
  Use Kernel#loop for infinite loops.
@@ -3827,6 +3885,12 @@ Style/MultilineIfThen:
3827
3885
  VersionAdded: '0.9'
3828
3886
  VersionChanged: '0.26'
3829
3887
 
3888
+ Style/MultilineInPatternThen:
3889
+ Description: 'Do not use `then` for multi-line `in` statement.'
3890
+ StyleGuide: '#no-then'
3891
+ Enabled: pending
3892
+ VersionAdded: '1.16'
3893
+
3830
3894
  Style/MultilineMemoization:
3831
3895
  Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
3832
3896
  Enabled: true
@@ -3998,6 +4062,7 @@ Style/NilLambda:
3998
4062
  Description: 'Prefer `-> {}` to `-> { nil }`.'
3999
4063
  Enabled: pending
4000
4064
  VersionAdded: '1.3'
4065
+ VersionChanged: '1.15'
4001
4066
 
4002
4067
  Style/NonNilCheck:
4003
4068
  Description: 'Checks for redundant nil checks.'
@@ -4184,6 +4249,16 @@ Style/Proc:
4184
4249
  VersionAdded: '0.9'
4185
4250
  VersionChanged: '0.18'
4186
4251
 
4252
+ Style/QuotedSymbols:
4253
+ Description: 'Use a consistent style for quoted symbols.'
4254
+ Enabled: pending
4255
+ VersionAdded: '1.16'
4256
+ EnforcedStyle: same_as_string_literals
4257
+ SupportedStyles:
4258
+ - same_as_string_literals
4259
+ - single_quotes
4260
+ - double_quotes
4261
+
4187
4262
  Style/RaiseArgs:
4188
4263
  Description: 'Checks the arguments passed to raise/fail.'
4189
4264
  StyleGuide: '#exception-class-messages'
@@ -4541,7 +4616,8 @@ Style/StringConcatenation:
4541
4616
  Enabled: true
4542
4617
  Safe: false
4543
4618
  VersionAdded: '0.89'
4544
- VersionChanged: '1.6'
4619
+ VersionChanged: '1.18'
4620
+ Mode: aggressive
4545
4621
 
4546
4622
  Style/StringHashKeys:
4547
4623
  Description: 'Prefer symbols instead of strings as hash keys.'
@@ -4651,6 +4727,12 @@ Style/TernaryParentheses:
4651
4727
  - require_parentheses_when_complex
4652
4728
  AllowSafeAssignment: true
4653
4729
 
4730
+ Style/TopLevelMethodDefinition:
4731
+ Description: 'This cop looks for top-level method definitions.'
4732
+ StyleGuide: '#top-level-methods'
4733
+ Enabled: false
4734
+ VersionAdded: '1.15'
4735
+
4654
4736
  Style/TrailingBodyOnClass:
4655
4737
  Description: 'Class body goes below class statement.'
4656
4738
  Enabled: true
@@ -4737,7 +4819,7 @@ Style/TrivialAccessors:
4737
4819
  StyleGuide: '#attr_family'
4738
4820
  Enabled: true
4739
4821
  VersionAdded: '0.9'
4740
- VersionChanged: '0.77'
4822
+ VersionChanged: '1.15'
4741
4823
  # When set to `false` the cop will suggest the use of accessor methods
4742
4824
  # in situations like:
4743
4825
  #
@@ -4756,7 +4838,7 @@ Style/TrivialAccessors:
4756
4838
  # on_exception :restart
4757
4839
  #
4758
4840
  # Commonly used in DSLs
4759
- AllowDSLWriters: false
4841
+ AllowDSLWriters: true
4760
4842
  IgnoreClassMethods: false
4761
4843
  AllowedMethods:
4762
4844
  - to_ary
data/lib/cookstyle.rb CHANGED
@@ -46,7 +46,7 @@ require_relative 'rubocop/chef/cookbook_only'
46
46
  require_relative 'rubocop/cop/target_chef_version'
47
47
 
48
48
  # Chef Infra specific cops
49
- Dir.glob(__dir__ + '/rubocop/cop/chef/**/*.rb') do |file|
49
+ Dir.glob(__dir__ + '/rubocop/cop/**/*.rb') do |file|
50
50
  next if File.directory?(file)
51
51
 
52
52
  require_relative file # not actually relative but require_relative is faster
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Cookstyle
3
- VERSION = "7.12.5" # rubocop: disable Style/StringLiterals
4
- RUBOCOP_VERSION = '1.14.0'
3
+ VERSION = "7.15.1" # rubocop: disable Style/StringLiterals
4
+ RUBOCOP_VERSION = '1.18.3'
5
5
  end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: 2021, Chef Software, Inc.
4
+ # Author:: Tim Smith (<tsmith@chef.io>)
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module RuboCop
19
+ module Cop
20
+ module Chef
21
+ module Deprecations
22
+ # The Policyfile source of `:community` has been replaced with `:supermarket`
23
+ #
24
+ # @example
25
+ #
26
+ # #### incorrect
27
+ # default_source :community
28
+ #
29
+ # #### correct
30
+ # default_source :supermarket
31
+ #
32
+ class PolicyfileCommunitySource < Base
33
+ extend AutoCorrector
34
+
35
+ MSG = 'The Policyfile source of `:community` has been replaced with `:supermarket`.'
36
+ RESTRICT_ON_SEND = [:default_source].freeze
37
+
38
+ def_node_matcher :community_source?, <<-PATTERN
39
+ (send nil? :default_source (:sym :community))
40
+ PATTERN
41
+
42
+ def on_send(node)
43
+ community_source?(node) do
44
+ add_offense(node, message: MSG, severity: :warning) do |corrector|
45
+ corrector.replace(node, 'default_source :supermarket')
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: 2021, Chef Software Inc.
4
+ # Author:: Tim Smith (<tsmith@chef.io>)
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module RuboCop
19
+ module Cop
20
+ module InSpec
21
+ module Deprecations
22
+ # The InSpec inputs `default` option has been replaced with the `value` option.
23
+ #
24
+ # @example
25
+ #
26
+ # #### incorrect
27
+ # login_defs_umask = input('login_defs_umask', default: '077', description: 'Default umask to set in login.defs')
28
+ #
29
+ # #### correct
30
+ # login_defs_umask = input('login_defs_umask', value: '077', description: 'Default umask to set in login.defs')
31
+ #
32
+ class AttributeDefault < Base
33
+ extend AutoCorrector
34
+
35
+ MSG = 'The InSpec inputs `default` option has been replaced with the `value` option.'
36
+ RESTRICT_ON_SEND = [:attribute, :input].freeze
37
+
38
+ def_node_matcher :default?, <<-PATTERN
39
+ (send nil? {:attribute :input} _ (hash <(pair $(sym :default) ...) ...>) )
40
+ PATTERN
41
+
42
+ def on_send(node)
43
+ default?(node) do |n|
44
+ add_offense(n, message: MSG, severity: :warning) do |corrector|
45
+ corrector.replace(n, 'value')
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: 2021, Chef Software Inc.
4
+ # Author:: Tim Smith (<tsmith@chef.io>)
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module RuboCop
19
+ module Cop
20
+ module InSpec
21
+ module Deprecations
22
+ # InSpec attributes have been renamed to inputs. Use the `input` method not the deprecation `attribute` method to access these values.
23
+ #
24
+ # @example
25
+ #
26
+ # #### incorrect
27
+ # login_defs_umask = attribute('login_defs_umask', value: '077', description: 'Default umask to set in login.defs')
28
+ #
29
+ # #### correct
30
+ # login_defs_umask = input('login_defs_umask', value: '077', description: 'Default umask to set in login.defs')
31
+ #
32
+ class AttributeHelper < Base
33
+ extend AutoCorrector
34
+
35
+ MSG = 'InSpec attributes have been renamed to inputs. Use the `input` method not the deprecation `attribute` method to access these values.'
36
+ RESTRICT_ON_SEND = [:attribute].freeze
37
+
38
+ def on_send(node)
39
+ add_offense(node, message: MSG, severity: :warning) do |corrector|
40
+ corrector.replace(node.loc.expression, node.loc.expression.source.gsub(/^attribute/, 'input'))
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cookstyle
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.12.5
4
+ version: 7.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thom May
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-05-17 00:00:00.000000000 Z
12
+ date: 2021-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubocop
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 1.14.0
20
+ version: 1.18.3
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.14.0
27
+ version: 1.18.3
28
28
  description:
29
29
  email:
30
30
  - thom@chef.io
@@ -134,6 +134,7 @@ files:
134
134
  - lib/rubocop/cop/chef/deprecation/partial_search_class_usage.rb
135
135
  - lib/rubocop/cop/chef/deprecation/partial_search_helper_usage.rb
136
136
  - lib/rubocop/cop/chef/deprecation/poise_archive.rb
137
+ - lib/rubocop/cop/chef/deprecation/policyfile_community_source.rb
137
138
  - lib/rubocop/cop/chef/deprecation/powershell_cookbook_helpers.rb
138
139
  - lib/rubocop/cop/chef/deprecation/require_recipe.rb
139
140
  - lib/rubocop/cop/chef/deprecation/resource_overrides_provides_method.rb
@@ -275,6 +276,8 @@ files:
275
276
  - lib/rubocop/cop/chef/style/unnecessary_os_check.rb
276
277
  - lib/rubocop/cop/chef/style/unnecessary_platform_case_statement.rb
277
278
  - lib/rubocop/cop/chef/style/use_platform_helpers.rb
279
+ - lib/rubocop/cop/inspec/deprecation/attribute_default.rb
280
+ - lib/rubocop/cop/inspec/deprecation/attribute_helper.rb
278
281
  - lib/rubocop/cop/target_chef_version.rb
279
282
  - lib/rubocop/monkey_patches/base.rb
280
283
  - lib/rubocop/monkey_patches/config.rb