cookstyle 7.2.1 → 7.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +0 -5
- data/config/cookstyle.yml +42 -7
- data/config/disable_all.yml +10 -0
- data/config/upstream.yml +118 -17
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/chef_sugar_helpers.rb +56 -0
- data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +2 -3
- data/lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_actions.rb +67 -0
- data/lib/rubocop/cop/chef/redundant/unnecessary_name_property.rb +14 -24
- data/lib/rubocop/cop/chef/sharing/include_resource_descriptions.rb +1 -1
- data/lib/rubocop/cop/chef/sharing/include_resource_examples.rb +1 -1
- data/lib/rubocop/cop/chef/style/comment_sentence_spacing.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09bd4a16aa09542c2df43aea566946fa82e055c07e39fcc1ad61c999e1948dbd'
|
4
|
+
data.tar.gz: 02ee442d6f3f6556ce929742c3c0de146641f6c89bd8440ed8f653397e8e64d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feb49d90a15d0a8d60d9cf8aa96dd3e02624cdb6c12ce3f400a6861b2b9f64c32851930c4e6d759d46b1d4cfcaaec2c35db66edabccd57f0bddd3ed68d34eccf
|
7
|
+
data.tar.gz: cb84765767138a0c95de14f140d45db6f795528303ca0a69bfe73a68804712a9a265efcdafcf2746090ea04ae4957523fa4befce8a2edfb5f6b1fe57e65b1ece
|
data/Gemfile
CHANGED
@@ -11,8 +11,6 @@ group :debug do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
group :docs do
|
14
|
-
gem 'github-markup'
|
15
|
-
gem 'redcarpet'
|
16
14
|
gem 'yard'
|
17
15
|
end
|
18
16
|
|
@@ -29,6 +27,3 @@ group :development do
|
|
29
27
|
gem 'rake'
|
30
28
|
gem 'rspec', '>= 3.4'
|
31
29
|
end
|
32
|
-
|
33
|
-
# pin until we drop ruby 2.4 and then remove this entirely
|
34
|
-
gem 'parallel', '< 1.20'
|
data/config/cookstyle.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
+
SuggestExtensions: false
|
2
3
|
TargetRubyVersion: 2.4
|
3
4
|
TargetChefVersion: ~
|
4
5
|
Exclude:
|
@@ -819,7 +820,8 @@ Chef/Deprecations/UsesRunCommandHelper:
|
|
819
820
|
VersionAdded: '5.9.0'
|
820
821
|
Exclude:
|
821
822
|
- '**/metadata.rb'
|
822
|
-
- '
|
823
|
+
- '**/Berksfile'
|
824
|
+
- '**/Rakefile'
|
823
825
|
|
824
826
|
Chef/Deprecations/ChefHandlerUsesSupports:
|
825
827
|
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.
|
@@ -836,6 +838,8 @@ Chef/Deprecations/DeprecatedYumRepositoryProperties:
|
|
836
838
|
VersionAdded: '5.10.0'
|
837
839
|
Exclude:
|
838
840
|
- '**/metadata.rb'
|
841
|
+
- '**/attributes/*.rb'
|
842
|
+
- '**/Berksfile'
|
839
843
|
|
840
844
|
Chef/Deprecations/EOLAuditModeUsage:
|
841
845
|
Description: The beta Audit Mode feature in Chef Infra Client was removed in Chef Infra Client 15.0. Users should instead use InSpec and the audit cookbook. See https://www.inspec.io/ for more informmation.
|
@@ -844,6 +848,8 @@ Chef/Deprecations/EOLAuditModeUsage:
|
|
844
848
|
VersionAdded: '5.10.0'
|
845
849
|
Exclude:
|
846
850
|
- '**/metadata.rb'
|
851
|
+
- '**/attributes/*.rb'
|
852
|
+
- '**/Berksfile'
|
847
853
|
|
848
854
|
Chef/Deprecations/ResourceInheritsFromCompatResource:
|
849
855
|
Description: HWRP style resource should inherit from the 'Chef::Resource' class and not the 'ChefCompat::Resource' class from the deprecated compat_resource cookbook.
|
@@ -860,12 +866,18 @@ Chef/Deprecations/VerifyPropertyUsesFileExpansion:
|
|
860
866
|
VersionAdded: '5.10.0'
|
861
867
|
Exclude:
|
862
868
|
- '**/metadata.rb'
|
869
|
+
- '**/attributes/*.rb'
|
870
|
+
- '**/Berksfile'
|
863
871
|
|
864
872
|
Chef/Deprecations/PoiseArchiveUsage:
|
865
873
|
Description: The poise_archive resource in the deprecated poise-archive should be replaced with the archive_file resource found in Chef Infra Client 15+.
|
866
874
|
StyleGuide: '#chefdeprecationspoisearchiveusage'
|
867
875
|
Enabled: true
|
868
876
|
VersionAdded: '5.11.0'
|
877
|
+
Exclude:
|
878
|
+
- '**/metadata.rb'
|
879
|
+
- '**/attributes/*.rb'
|
880
|
+
- '**/Berksfile'
|
869
881
|
|
870
882
|
Chef/Deprecations/PartialSearchHelperUsage:
|
871
883
|
Description: Legacy partial_search usage should be updated to use :filter_result in the search helper instead.
|
@@ -906,6 +918,8 @@ Chef/Deprecations/LegacyNotifySyntax:
|
|
906
918
|
VersionAdded: '5.13.0'
|
907
919
|
Exclude:
|
908
920
|
- '**/metadata.rb'
|
921
|
+
- '**/attributes/*.rb'
|
922
|
+
- '**/Berksfile'
|
909
923
|
|
910
924
|
Chef/Deprecations/NodeSetWithoutLevel:
|
911
925
|
Description: When setting a node attribute in Chef Infra Client 11 and later you must specify the precedence level.
|
@@ -1154,6 +1168,27 @@ Chef/Deprecations/FoodcriticTesting:
|
|
1154
1168
|
- '**/Rakefile'
|
1155
1169
|
- '**/Gemfile'
|
1156
1170
|
|
1171
|
+
Chef/Deprecations/DeprecatedYumRepositoryActions:
|
1172
|
+
Description: With the release of Chef Infra Client 12.14 and the yum cookbook 3.0 several actions in the yum_repository resource actions were renamed. The `add` action became `create` and `delete` became `remove` to better match other resources in Chef Infra Client.
|
1173
|
+
StyleGuide: '#chefdeprecationsdeprecatedyumrepositoryactions'
|
1174
|
+
Enabled: true
|
1175
|
+
VersionAdded: '7.3.0'
|
1176
|
+
Exclude:
|
1177
|
+
- '**/metadata.rb'
|
1178
|
+
- '**/attributes/*.rb'
|
1179
|
+
- '**/Berksfile'
|
1180
|
+
- '**/Rakefile'
|
1181
|
+
|
1182
|
+
Chef/Deprecations/ChefSugarHelpers:
|
1183
|
+
Description: Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/master/chef-utils#getting-started
|
1184
|
+
StyleGuide: '#chefdeprecationschefsugarhelpers'
|
1185
|
+
Enabled: true
|
1186
|
+
VersionAdded: '7.3.0'
|
1187
|
+
Exclude:
|
1188
|
+
- '**/metadata.rb'
|
1189
|
+
- '**/Berksfile'
|
1190
|
+
- '**/Rakefile'
|
1191
|
+
|
1157
1192
|
###############################
|
1158
1193
|
# Chef/Modernize: Cleaning up legacy code and using new built-in resources
|
1159
1194
|
###############################
|
@@ -1211,6 +1246,7 @@ Chef/Modernize/RespondToProvides:
|
|
1211
1246
|
VersionAdded: '5.2.0'
|
1212
1247
|
Include:
|
1213
1248
|
- '**/providers/*.rb'
|
1249
|
+
- '**/resources/*.rb'
|
1214
1250
|
- '**/libraries/*.rb'
|
1215
1251
|
|
1216
1252
|
Chef/Modernize/SetOrReturnInResources:
|
@@ -1714,7 +1750,6 @@ Chef/Modernize/ActionMethodInResource:
|
|
1714
1750
|
Include:
|
1715
1751
|
- '**/resources/*.rb'
|
1716
1752
|
- '**/providers/*.rb'
|
1717
|
-
- '**/libraries/*.rb'
|
1718
1753
|
|
1719
1754
|
###############################
|
1720
1755
|
# Chef/RedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
|
@@ -2096,6 +2131,7 @@ Style/EmptyElse:
|
|
2096
2131
|
Enabled: true
|
2097
2132
|
Layout/EmptyLineBetweenDefs:
|
2098
2133
|
Enabled: true
|
2134
|
+
AllowAdjacentOneLineDefs: true
|
2099
2135
|
Layout/EmptyLines:
|
2100
2136
|
Enabled: true
|
2101
2137
|
Layout/EmptyLinesAroundAccessModifier:
|
@@ -2288,7 +2324,7 @@ Style/SymbolLiteral:
|
|
2288
2324
|
Enabled: true
|
2289
2325
|
Layout/IndentationStyle:
|
2290
2326
|
Enabled: true
|
2291
|
-
Layout/
|
2327
|
+
Layout/TrailingEmptyLines:
|
2292
2328
|
Enabled: true
|
2293
2329
|
Style/TrailingCommaInArguments:
|
2294
2330
|
Enabled: true
|
@@ -2439,10 +2475,9 @@ Metrics/BlockNesting:
|
|
2439
2475
|
Metrics/ParameterLists:
|
2440
2476
|
Enabled: false
|
2441
2477
|
|
2442
|
-
#
|
2443
|
-
# Chef::Recipe.send(:include, ::Apt::Helpers) -> Chef::Recipe.include ::Apt::Helpers
|
2478
|
+
# The warning message from this is misleading and can lead to wrong but syntactically valid code.
|
2444
2479
|
Lint/SendWithMixinArgument:
|
2445
|
-
Enabled:
|
2480
|
+
Enabled: false
|
2446
2481
|
|
2447
2482
|
# this migrates old # rubocop: comments to use the latest namespaces, which prevents a ton of spam during cookstyle runs
|
2448
2483
|
Migration/DepartmentName:
|
@@ -2767,4 +2802,4 @@ Lint/RedundantSafeNavigation:
|
|
2767
2802
|
|
2768
2803
|
# Avoid using blocks to remove nils from a Hash/Array
|
2769
2804
|
Style/CollectionCompact:
|
2770
|
-
Enabled: true
|
2805
|
+
Enabled: true
|
data/config/disable_all.yml
CHANGED
@@ -169,6 +169,8 @@ Layout/SpaceAroundOperators:
|
|
169
169
|
Enabled: false
|
170
170
|
Layout/SpaceBeforeBlockBraces:
|
171
171
|
Enabled: false
|
172
|
+
Layout/SpaceBeforeBrackets:
|
173
|
+
Enabled: false
|
172
174
|
Layout/SpaceBeforeComma:
|
173
175
|
Enabled: false
|
174
176
|
Layout/SpaceBeforeComment:
|
@@ -201,6 +203,8 @@ Layout/TrailingEmptyLines:
|
|
201
203
|
Enabled: false
|
202
204
|
Layout/TrailingWhitespace:
|
203
205
|
Enabled: false
|
206
|
+
Lint/AmbiguousAssignment:
|
207
|
+
Enabled: false
|
204
208
|
Lint/AmbiguousBlockAssociation:
|
205
209
|
Enabled: false
|
206
210
|
Lint/AmbiguousOperator:
|
@@ -393,6 +397,8 @@ Lint/TrailingCommaInAttributeDeclaration:
|
|
393
397
|
Enabled: false
|
394
398
|
Lint/UnderscorePrefixedVariableName:
|
395
399
|
Enabled: false
|
400
|
+
Lint/UnexpectedBlockArity:
|
401
|
+
Enabled: false
|
396
402
|
Lint/UnifiedInteger:
|
397
403
|
Enabled: false
|
398
404
|
Lint/UnmodifiedReduceAccumulator:
|
@@ -611,6 +617,8 @@ Style/HashAsLastArrayItem:
|
|
611
617
|
Enabled: false
|
612
618
|
Style/HashEachMethods:
|
613
619
|
Enabled: false
|
620
|
+
Style/HashExcept:
|
621
|
+
Enabled: false
|
614
622
|
Style/HashLikeCase:
|
615
623
|
Enabled: false
|
616
624
|
Style/HashSyntax:
|
@@ -755,6 +763,8 @@ Style/RaiseArgs:
|
|
755
763
|
Enabled: false
|
756
764
|
Style/RandomWithOffset:
|
757
765
|
Enabled: false
|
766
|
+
Style/RedundantArgument:
|
767
|
+
Enabled: false
|
758
768
|
Style/RedundantBegin:
|
759
769
|
Enabled: false
|
760
770
|
Style/RedundantCapitalW:
|
data/config/upstream.yml
CHANGED
@@ -139,6 +139,16 @@ AllCops:
|
|
139
139
|
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
|
140
140
|
# use the oldest officially supported Ruby version (currently Ruby 2.4).
|
141
141
|
TargetRubyVersion: ~
|
142
|
+
# Determines if a notification for extension libraries should be shown when
|
143
|
+
# rubocop is run. Keys are the name of the extension, and values are an array
|
144
|
+
# of gems in the Gemfile that the extension is suggested for, if not already
|
145
|
+
# included.
|
146
|
+
SuggestExtensions:
|
147
|
+
rubocop-rails: [rails]
|
148
|
+
rubocop-rspec: [rspec, rspec-rails]
|
149
|
+
rubocop-minitest: [minitest]
|
150
|
+
rubocop-sequel: [sequel]
|
151
|
+
rubocop-rake: [rake]
|
142
152
|
|
143
153
|
#################### Bundler ###############################
|
144
154
|
|
@@ -459,10 +469,14 @@ Layout/EmptyLineAfterMultilineCondition:
|
|
459
469
|
- https://github.com/airbnb/ruby#multiline-if-newline
|
460
470
|
|
461
471
|
Layout/EmptyLineBetweenDefs:
|
462
|
-
Description: 'Use empty lines between defs.'
|
472
|
+
Description: 'Use empty lines between class/module/method defs.'
|
463
473
|
StyleGuide: '#empty-lines-between-methods'
|
464
474
|
Enabled: true
|
465
475
|
VersionAdded: '0.49'
|
476
|
+
VersionChanged: '1.7'
|
477
|
+
EmptyLineBetweenMethodDefs: true
|
478
|
+
EmptyLineBetweenClassDefs: true
|
479
|
+
EmptyLineBetweenModuleDefs: true
|
466
480
|
# If `true`, this parameter means that single line method definitions don't
|
467
481
|
# need an empty line between them.
|
468
482
|
AllowAdjacentOneLineDefs: false
|
@@ -891,8 +905,8 @@ Layout/LineLength:
|
|
891
905
|
StyleGuide: '#max-line-length'
|
892
906
|
Enabled: true
|
893
907
|
VersionAdded: '0.25'
|
894
|
-
VersionChanged: '1.
|
895
|
-
AutoCorrect:
|
908
|
+
VersionChanged: '1.4'
|
909
|
+
AutoCorrect: true
|
896
910
|
Max: 120
|
897
911
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
898
912
|
# containing a URI to be longer than Max.
|
@@ -1178,6 +1192,13 @@ Layout/SpaceBeforeBlockBraces:
|
|
1178
1192
|
- no_space
|
1179
1193
|
VersionChanged: '0.52'
|
1180
1194
|
|
1195
|
+
Layout/SpaceBeforeBrackets:
|
1196
|
+
Description: 'Checks for receiver with a space before the opening brackets.'
|
1197
|
+
StyleGuide: '#space-in-brackets-access'
|
1198
|
+
Enabled: pending
|
1199
|
+
VersionAdded: '1.7'
|
1200
|
+
Safe: false
|
1201
|
+
|
1181
1202
|
Layout/SpaceBeforeComma:
|
1182
1203
|
Description: 'No spaces before commas.'
|
1183
1204
|
Enabled: true
|
@@ -1340,6 +1361,11 @@ Layout/TrailingWhitespace:
|
|
1340
1361
|
#################### Lint ##################################
|
1341
1362
|
### Warnings
|
1342
1363
|
|
1364
|
+
Lint/AmbiguousAssignment:
|
1365
|
+
Description: 'Checks for mistyped shorthand assignments.'
|
1366
|
+
Enabled: pending
|
1367
|
+
VersionAdded: '1.7'
|
1368
|
+
|
1343
1369
|
Lint/AmbiguousBlockAssociation:
|
1344
1370
|
Description: >-
|
1345
1371
|
Checks for ambiguous block association with method when param passed without
|
@@ -1382,6 +1408,7 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
1382
1408
|
Enabled: true
|
1383
1409
|
Safe: false
|
1384
1410
|
VersionAdded: '0.89'
|
1411
|
+
VersionChanged: '1.7'
|
1385
1412
|
|
1386
1413
|
Lint/BooleanSymbol:
|
1387
1414
|
Description: 'Check for `:true` and `:false` symbols.'
|
@@ -1458,6 +1485,9 @@ Lint/DuplicateBranch:
|
|
1458
1485
|
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
1459
1486
|
Enabled: pending
|
1460
1487
|
VersionAdded: '1.3'
|
1488
|
+
VersionChanged: '1.7'
|
1489
|
+
IgnoreLiteralBranches: false
|
1490
|
+
IgnoreConstantBranches: false
|
1461
1491
|
|
1462
1492
|
Lint/DuplicateCaseCondition:
|
1463
1493
|
Description: 'Do not repeat values in case conditionals.'
|
@@ -1684,6 +1714,7 @@ Lint/MissingSuper:
|
|
1684
1714
|
without calls to `super`'.
|
1685
1715
|
Enabled: true
|
1686
1716
|
VersionAdded: '0.89'
|
1717
|
+
VersionChanged: '1.4'
|
1687
1718
|
|
1688
1719
|
Lint/MixedRegexpCaptureTypes:
|
1689
1720
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
@@ -1827,6 +1858,8 @@ Lint/RedundantSplatExpansion:
|
|
1827
1858
|
Description: 'Checks for splat unnecessarily being called on literals.'
|
1828
1859
|
Enabled: true
|
1829
1860
|
VersionAdded: '0.76'
|
1861
|
+
VersionChanged: '1.7'
|
1862
|
+
AllowPercentLiteralArrayArgument: true
|
1830
1863
|
|
1831
1864
|
Lint/RedundantStringCoercion:
|
1832
1865
|
Description: 'Checks for Object#to_s usage in string interpolation.'
|
@@ -1993,6 +2026,23 @@ Lint/UnderscorePrefixedVariableName:
|
|
1993
2026
|
VersionAdded: '0.21'
|
1994
2027
|
AllowKeywordBlockArguments: false
|
1995
2028
|
|
2029
|
+
Lint/UnexpectedBlockArity:
|
2030
|
+
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
|
2031
|
+
Enabled: pending
|
2032
|
+
Safe: false
|
2033
|
+
VersionAdded: '1.5'
|
2034
|
+
Methods:
|
2035
|
+
chunk_while: 2
|
2036
|
+
each_with_index: 2
|
2037
|
+
each_with_object: 2
|
2038
|
+
inject: 2
|
2039
|
+
max: 2
|
2040
|
+
min: 2
|
2041
|
+
minmax: 2
|
2042
|
+
reduce: 2
|
2043
|
+
slice_when: 2
|
2044
|
+
sort: 2
|
2045
|
+
|
1996
2046
|
Lint/UnifiedInteger:
|
1997
2047
|
Description: 'Use Integer instead of Fixnum or Bignum.'
|
1998
2048
|
Enabled: true
|
@@ -2002,6 +2052,7 @@ Lint/UnmodifiedReduceAccumulator:
|
|
2002
2052
|
Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
|
2003
2053
|
Enabled: pending
|
2004
2054
|
VersionAdded: '1.1'
|
2055
|
+
VersionChanged: '1.5'
|
2005
2056
|
|
2006
2057
|
Lint/UnreachableCode:
|
2007
2058
|
Description: 'Unreachable code.'
|
@@ -2012,6 +2063,11 @@ Lint/UnreachableLoop:
|
|
2012
2063
|
Description: 'This cop checks for loops that will have at most one iteration.'
|
2013
2064
|
Enabled: true
|
2014
2065
|
VersionAdded: '0.89'
|
2066
|
+
VersionChanged: '1.7'
|
2067
|
+
IgnoredPatterns:
|
2068
|
+
# RSpec uses `times` in its message expectations
|
2069
|
+
# eg. `exactly(2).times`
|
2070
|
+
- !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
|
2015
2071
|
|
2016
2072
|
Lint/UnusedBlockArgument:
|
2017
2073
|
Description: 'Checks for unused block arguments.'
|
@@ -2105,21 +2161,23 @@ Metrics/AbcSize:
|
|
2105
2161
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
2106
2162
|
Enabled: true
|
2107
2163
|
VersionAdded: '0.27'
|
2108
|
-
VersionChanged: '
|
2164
|
+
VersionChanged: '1.5'
|
2109
2165
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
2110
2166
|
# a Float.
|
2111
2167
|
IgnoredMethods: []
|
2168
|
+
CountRepeatedAttributes: true
|
2112
2169
|
Max: 17
|
2113
2170
|
|
2114
2171
|
Metrics/BlockLength:
|
2115
2172
|
Description: 'Avoid long blocks with many lines.'
|
2116
2173
|
Enabled: true
|
2117
2174
|
VersionAdded: '0.44'
|
2118
|
-
VersionChanged: '
|
2175
|
+
VersionChanged: '1.5'
|
2119
2176
|
CountComments: false # count full line comments?
|
2120
2177
|
Max: 25
|
2121
2178
|
CountAsOne: []
|
2122
|
-
ExcludedMethods:
|
2179
|
+
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2180
|
+
IgnoredMethods:
|
2123
2181
|
# By default, exclude the `#refine` method, as it tends to have larger
|
2124
2182
|
# associated blocks.
|
2125
2183
|
- refine
|
@@ -2160,11 +2218,12 @@ Metrics/MethodLength:
|
|
2160
2218
|
StyleGuide: '#short-methods'
|
2161
2219
|
Enabled: true
|
2162
2220
|
VersionAdded: '0.25'
|
2163
|
-
VersionChanged: '
|
2221
|
+
VersionChanged: '1.5'
|
2164
2222
|
CountComments: false # count full line comments?
|
2165
2223
|
Max: 10
|
2166
2224
|
CountAsOne: []
|
2167
|
-
ExcludedMethods: []
|
2225
|
+
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2226
|
+
IgnoredMethods: []
|
2168
2227
|
|
2169
2228
|
Metrics/ModuleLength:
|
2170
2229
|
Description: 'Avoid modules longer than 100 lines of code.'
|
@@ -2180,8 +2239,10 @@ Metrics/ParameterLists:
|
|
2180
2239
|
StyleGuide: '#too-many-params'
|
2181
2240
|
Enabled: true
|
2182
2241
|
VersionAdded: '0.25'
|
2242
|
+
VersionChanged: '1.5'
|
2183
2243
|
Max: 5
|
2184
2244
|
CountKeywordArgs: true
|
2245
|
+
MaxOptionalParameters: 3
|
2185
2246
|
|
2186
2247
|
Metrics/PerceivedComplexity:
|
2187
2248
|
Description: >-
|
@@ -2451,7 +2512,7 @@ Naming/VariableNumber:
|
|
2451
2512
|
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
|
2452
2513
|
Enabled: true
|
2453
2514
|
VersionAdded: '0.50'
|
2454
|
-
VersionChanged: '1.
|
2515
|
+
VersionChanged: '1.4'
|
2455
2516
|
EnforcedStyle: normalcase
|
2456
2517
|
SupportedStyles:
|
2457
2518
|
- snake_case
|
@@ -2459,7 +2520,13 @@ Naming/VariableNumber:
|
|
2459
2520
|
- non_integer
|
2460
2521
|
CheckMethodNames: true
|
2461
2522
|
CheckSymbols: true
|
2462
|
-
AllowedIdentifiers:
|
2523
|
+
AllowedIdentifiers:
|
2524
|
+
- capture3 # Open3.capture3
|
2525
|
+
- iso8601 # Time#iso8601
|
2526
|
+
- rfc1123_date # CGI.rfc1123_date
|
2527
|
+
- rfc822 # Time#rfc822
|
2528
|
+
- rfc2822 # Time#rfc2822
|
2529
|
+
- rfc3339 # DateTime.rfc3339
|
2463
2530
|
|
2464
2531
|
#################### Security ##############################
|
2465
2532
|
|
@@ -2851,7 +2918,7 @@ Style/CollectionMethods:
|
|
2851
2918
|
StyleGuide: '#map-find-select-reduce-include-size'
|
2852
2919
|
Enabled: false
|
2853
2920
|
VersionAdded: '0.9'
|
2854
|
-
VersionChanged: '
|
2921
|
+
VersionChanged: '1.7'
|
2855
2922
|
Safe: false
|
2856
2923
|
# Mapping from undesired method to desired method
|
2857
2924
|
# e.g. to use `detect` over `find`:
|
@@ -2866,6 +2933,11 @@ Style/CollectionMethods:
|
|
2866
2933
|
detect: 'find'
|
2867
2934
|
find_all: 'select'
|
2868
2935
|
member?: 'include?'
|
2936
|
+
# Methods in this array accept a final symbol as an implicit block
|
2937
|
+
# eg. `inject(:+)`
|
2938
|
+
MethodsAcceptingSymbol:
|
2939
|
+
- inject
|
2940
|
+
- reduce
|
2869
2941
|
|
2870
2942
|
Style/ColonMethodCall:
|
2871
2943
|
Description: 'Do not use :: for method call.'
|
@@ -2925,6 +2997,7 @@ Style/CommentedKeyword:
|
|
2925
2997
|
Description: 'Do not place comments on the same line as certain keywords.'
|
2926
2998
|
Enabled: true
|
2927
2999
|
VersionAdded: '0.51'
|
3000
|
+
VersionChanged: '1.7'
|
2928
3001
|
|
2929
3002
|
Style/ConditionalAssignment:
|
2930
3003
|
Description: >-
|
@@ -3165,9 +3238,10 @@ Style/ExponentialNotation:
|
|
3165
3238
|
Style/FloatDivision:
|
3166
3239
|
Description: 'For performing float division, coerce one side only.'
|
3167
3240
|
StyleGuide: '#float-division'
|
3168
|
-
Reference: 'https://
|
3241
|
+
Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
3169
3242
|
Enabled: true
|
3170
3243
|
VersionAdded: '0.72'
|
3244
|
+
VersionChanged: '1.6'
|
3171
3245
|
EnforcedStyle: single_coerce
|
3172
3246
|
SupportedStyles:
|
3173
3247
|
- left_coerce
|
@@ -3283,6 +3357,13 @@ Style/HashEachMethods:
|
|
3283
3357
|
VersionAdded: '0.80'
|
3284
3358
|
Safe: false
|
3285
3359
|
|
3360
|
+
Style/HashExcept:
|
3361
|
+
Description: >-
|
3362
|
+
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
3363
|
+
that can be replaced with `Hash#except` method.
|
3364
|
+
Enabled: pending
|
3365
|
+
VersionAdded: '1.7'
|
3366
|
+
|
3286
3367
|
Style/HashLikeCase:
|
3287
3368
|
Description: >-
|
3288
3369
|
Checks for places where `case-when` represents a simple 1:1
|
@@ -3437,6 +3518,7 @@ Style/KeywordParametersOrder:
|
|
3437
3518
|
StyleGuide: '#keyword-parameters-order'
|
3438
3519
|
Enabled: true
|
3439
3520
|
VersionAdded: '0.90'
|
3521
|
+
VersionChanged: '1.7'
|
3440
3522
|
|
3441
3523
|
Style/Lambda:
|
3442
3524
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
@@ -3475,7 +3557,7 @@ Style/MethodCallWithArgsParentheses:
|
|
3475
3557
|
StyleGuide: '#method-invocation-parens'
|
3476
3558
|
Enabled: false
|
3477
3559
|
VersionAdded: '0.47'
|
3478
|
-
VersionChanged: '
|
3560
|
+
VersionChanged: '1.7'
|
3479
3561
|
IgnoreMacros: true
|
3480
3562
|
IgnoredMethods: []
|
3481
3563
|
IgnoredPatterns: []
|
@@ -3509,7 +3591,7 @@ Style/MethodDefParentheses:
|
|
3509
3591
|
StyleGuide: '#method-parens'
|
3510
3592
|
Enabled: true
|
3511
3593
|
VersionAdded: '0.16'
|
3512
|
-
VersionChanged: '
|
3594
|
+
VersionChanged: '1.7'
|
3513
3595
|
EnforcedStyle: require_parentheses
|
3514
3596
|
SupportedStyles:
|
3515
3597
|
- require_parentheses
|
@@ -3615,6 +3697,7 @@ Style/MultilineMethodSignature:
|
|
3615
3697
|
Description: 'Avoid multi-line method signatures.'
|
3616
3698
|
Enabled: false
|
3617
3699
|
VersionAdded: '0.59'
|
3700
|
+
VersionChanged: '1.7'
|
3618
3701
|
|
3619
3702
|
Style/MultilineTernaryOperator:
|
3620
3703
|
Description: >-
|
@@ -3976,6 +4059,22 @@ Style/RandomWithOffset:
|
|
3976
4059
|
Enabled: true
|
3977
4060
|
VersionAdded: '0.52'
|
3978
4061
|
|
4062
|
+
Style/RedundantArgument:
|
4063
|
+
Description: 'Check for a redundant argument passed to certain methods.'
|
4064
|
+
Enabled: pending
|
4065
|
+
Safe: false
|
4066
|
+
VersionAdded: '1.4'
|
4067
|
+
VersionChanged: '1.7'
|
4068
|
+
Methods:
|
4069
|
+
# Array#join
|
4070
|
+
join: ''
|
4071
|
+
# String#split
|
4072
|
+
split: ' '
|
4073
|
+
# String#chomp
|
4074
|
+
chomp: "\n"
|
4075
|
+
# String#chomp!
|
4076
|
+
chomp!: "\n"
|
4077
|
+
|
3979
4078
|
Style/RedundantAssignment:
|
3980
4079
|
Description: 'Checks for redundant assignment before returning.'
|
3981
4080
|
Enabled: true
|
@@ -4217,7 +4316,7 @@ Style/SingleLineBlockParams:
|
|
4217
4316
|
Description: 'Enforces the names of some block params.'
|
4218
4317
|
Enabled: false
|
4219
4318
|
VersionAdded: '0.16'
|
4220
|
-
VersionChanged: '
|
4319
|
+
VersionChanged: '1.6'
|
4221
4320
|
Methods:
|
4222
4321
|
- reduce:
|
4223
4322
|
- acc
|
@@ -4231,7 +4330,7 @@ Style/SingleLineMethods:
|
|
4231
4330
|
StyleGuide: '#no-single-line-methods'
|
4232
4331
|
Enabled: true
|
4233
4332
|
VersionAdded: '0.9'
|
4234
|
-
VersionChanged: '
|
4333
|
+
VersionChanged: '1.7'
|
4235
4334
|
AllowIfMethodIsEmpty: true
|
4236
4335
|
|
4237
4336
|
Style/SlicingWithRange:
|
@@ -4246,6 +4345,7 @@ Style/SoleNestedConditional:
|
|
4246
4345
|
which can be merged into outer conditional node.
|
4247
4346
|
Enabled: true
|
4248
4347
|
VersionAdded: '0.89'
|
4348
|
+
VersionChanged: '1.5'
|
4249
4349
|
AllowModifier: false
|
4250
4350
|
|
4251
4351
|
Style/SpecialGlobalVars:
|
@@ -4289,6 +4389,7 @@ Style/StringConcatenation:
|
|
4289
4389
|
Enabled: true
|
4290
4390
|
Safe: false
|
4291
4391
|
VersionAdded: '0.89'
|
4392
|
+
VersionChanged: '1.6'
|
4292
4393
|
|
4293
4394
|
Style/StringHashKeys:
|
4294
4395
|
Description: 'Prefer symbols instead of strings as hash keys.'
|
@@ -4378,7 +4479,7 @@ Style/SymbolProc:
|
|
4378
4479
|
Enabled: true
|
4379
4480
|
Safe: false
|
4380
4481
|
VersionAdded: '0.26'
|
4381
|
-
VersionChanged: '
|
4482
|
+
VersionChanged: '1.5'
|
4382
4483
|
# A list of method names to be ignored by the check.
|
4383
4484
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
4384
4485
|
IgnoredMethods:
|
data/lib/cookstyle/version.rb
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Copyright:: 2020, 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
|
+
|
19
|
+
module RuboCop
|
20
|
+
module Cop
|
21
|
+
module Chef
|
22
|
+
# Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/master/chef-utils#getting-started
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
#
|
26
|
+
# # bad
|
27
|
+
# vagrant_key?
|
28
|
+
# vagrant_domain?
|
29
|
+
# vagrant_user?
|
30
|
+
# require_chef_gem
|
31
|
+
# best_ip_for(node)
|
32
|
+
# nexus?
|
33
|
+
# ios_xr?
|
34
|
+
# ruby_20?
|
35
|
+
# ruby_19?
|
36
|
+
# includes_recipe?('foo::bar')
|
37
|
+
# wrlinux?
|
38
|
+
# dev_null
|
39
|
+
# nexentacore_platform?
|
40
|
+
# opensolaris_platform?
|
41
|
+
# nexentacore?
|
42
|
+
# opensolaris?
|
43
|
+
#
|
44
|
+
module Deprecations
|
45
|
+
class ChefSugarHelpers < Base
|
46
|
+
MSG = 'Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/master/chef-utils#getting-started'
|
47
|
+
RESTRICT_ON_SEND = [:vagrant_key?, :vagrant_domain?, :vagrant_user?, :require_chef_gem, :best_ip_for, :nexus?, :ios_xr?, :ruby_20?, :ruby_19?, :includes_recipe?, :wrlinux?, :dev_null, :nexentacore_platform?, :opensolaris_platform?, :nexentacore?, :opensolaris?].freeze
|
48
|
+
|
49
|
+
def on_send(node)
|
50
|
+
add_offense(node, message: MSG, severity: :refactor)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -55,7 +55,7 @@ module RuboCop
|
|
55
55
|
'< 11' => true,
|
56
56
|
},
|
57
57
|
'mac_os_x' => {
|
58
|
-
'< 10.
|
58
|
+
'< 10.14' => '10.15',
|
59
59
|
},
|
60
60
|
'suse' => {
|
61
61
|
'~> 12.0, < 12.4' => '12',
|
@@ -67,8 +67,7 @@ module RuboCop
|
|
67
67
|
'= 15.0' => '15',
|
68
68
|
},
|
69
69
|
'debian' => {
|
70
|
-
'<
|
71
|
-
'> 8.0, < 8.11' => '8',
|
70
|
+
'< 9' => true,
|
72
71
|
'> 9.0, < 9.11' => '9',
|
73
72
|
},
|
74
73
|
'centos' => {
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Copyright:: 2020, 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
|
+
# With the release of Chef Infra Client 12.14 and the yum cookbook 3.0 the actions the yum_repository resource actions were renamed. The `add` action became `create` and `delete` became `remove` to better match other resources in Chef Infra Client.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
#
|
26
|
+
# # bad
|
27
|
+
# yum_repository 'OurCo' do
|
28
|
+
# description 'OurCo yum repository'
|
29
|
+
# baseurl 'http://artifacts.ourco.org/foo/bar'
|
30
|
+
# gpgkey 'http://artifacts.ourco.org/pub/yum/RPM-GPG-KEY-OURCO-6'
|
31
|
+
# action :add
|
32
|
+
# end
|
33
|
+
#
|
34
|
+
# # good
|
35
|
+
# yum_repository 'OurCo' do
|
36
|
+
# description 'OurCo yum repository'
|
37
|
+
# baseurl 'http://artifacts.ourco.org/foo/bar'
|
38
|
+
# gpgkey 'http://artifacts.ourco.org/pub/yum/RPM-GPG-KEY-OURCO-6'
|
39
|
+
# action :create
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
class DeprecatedYumRepositoryActions < Base
|
43
|
+
include RuboCop::Chef::CookbookHelpers
|
44
|
+
extend TargetChefVersion
|
45
|
+
extend AutoCorrector
|
46
|
+
|
47
|
+
minimum_target_chef_version '12.14'
|
48
|
+
|
49
|
+
MSG = 'With the release of Chef Infra Client 12.14 and the yum cookbook 3.0 several properties in the yum_repository resource the actions the yum_repository resource actions were renamed. The `add` action became `create` and `delete` became `remove` to better match other resources in Chef Infra Client.'
|
50
|
+
|
51
|
+
def on_block(node)
|
52
|
+
match_property_in_resource?(:yum_repository, 'action', node) do |prop_node|
|
53
|
+
next unless prop_node.arguments.first.sym_type?
|
54
|
+
next unless [s(:sym, :add), s(:sym, :delete)].include?(prop_node.arguments.first)
|
55
|
+
|
56
|
+
add_offense(prop_node, message: MSG, severity: :warning) do |corrector|
|
57
|
+
corrector.replace(prop_node, prop_node.source
|
58
|
+
.gsub('add', 'create')
|
59
|
+
.gsub('delete', 'remove'))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -28,6 +28,7 @@ module RuboCop
|
|
28
28
|
# property :name, String, name_property: true
|
29
29
|
# attribute :name, kind_of: String
|
30
30
|
# attribute :name, kind_of: String, name_attribute: true
|
31
|
+
# attribute :name, name_attribute: true, kind_of: String
|
31
32
|
#
|
32
33
|
class UnnecessaryNameProperty < Base
|
33
34
|
extend AutoCorrector
|
@@ -35,36 +36,25 @@ module RuboCop
|
|
35
36
|
MSG = 'There is no need to define a property or attribute named :name in a resource as Chef Infra defines this on all resources by default.'
|
36
37
|
RESTRICT_ON_SEND = [:property, :attribute].freeze
|
37
38
|
|
38
|
-
def_node_matcher :name_attribute?, <<-PATTERN
|
39
|
-
(send nil? :attribute
|
40
|
-
(sym :name)
|
41
|
-
(hash
|
42
|
-
(pair
|
43
|
-
(sym :kind_of)
|
44
|
-
(const nil? :String))
|
45
|
-
(pair
|
46
|
-
(sym :name_attribute)
|
47
|
-
(true))?))
|
48
|
-
PATTERN
|
49
|
-
|
50
39
|
def_node_matcher :name_property?, <<-PATTERN
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
(sym :name_property)
|
57
|
-
(true)))?)
|
40
|
+
(send nil? {:attribute :property}
|
41
|
+
(sym :name)
|
42
|
+
(const nil? :String)?
|
43
|
+
(hash $...)?
|
44
|
+
)
|
58
45
|
PATTERN
|
59
46
|
|
60
47
|
def on_send(node)
|
61
|
-
name_property?(node) do
|
62
|
-
|
63
|
-
|
48
|
+
name_property?(node) do |hash_vals|
|
49
|
+
# It's perfectly valid to redefine the name property if you give it non-default values
|
50
|
+
# We do this in a few of our core resources where we give it a default value of "" for nameless resources
|
51
|
+
# If there are hash vals in this attribute/property compare them with the default keys and if there's anything
|
52
|
+
# else return so we don't alert
|
53
|
+
unless hash_vals.empty?
|
54
|
+
hash_keys = hash_vals.first.map { |x| x.key.value }
|
55
|
+
return unless (hash_keys - [:kind_of, :name_attribute, :name_property]).empty?
|
64
56
|
end
|
65
|
-
end
|
66
57
|
|
67
|
-
name_attribute?(node) do
|
68
58
|
add_offense(node, message: MSG, severity: :refactor) do |corrector|
|
69
59
|
corrector.remove(node.source_range)
|
70
60
|
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.2
|
4
|
+
version: 7.5.2
|
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: 2020-
|
12
|
+
date: 2020-12-31 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.
|
20
|
+
version: 1.7.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.
|
27
|
+
version: 1.7.0
|
28
28
|
description:
|
29
29
|
email:
|
30
30
|
- thom@chef.io
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/rubocop/cop/chef/deprecation/chef_rest.rb
|
93
93
|
- lib/rubocop/cop/chef/deprecation/chef_rewind.rb
|
94
94
|
- lib/rubocop/cop/chef/deprecation/chef_shellout.rb
|
95
|
+
- lib/rubocop/cop/chef/deprecation/chef_sugar_helpers.rb
|
95
96
|
- lib/rubocop/cop/chef/deprecation/chef_windows_platform_helper.rb
|
96
97
|
- lib/rubocop/cop/chef/deprecation/chefdk_generators.rb
|
97
98
|
- lib/rubocop/cop/chef/deprecation/cheffile.rb
|
@@ -106,6 +107,7 @@ files:
|
|
106
107
|
- lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb
|
107
108
|
- lib/rubocop/cop/chef/deprecation/deprecated_shellout_methods.rb
|
108
109
|
- lib/rubocop/cop/chef/deprecation/deprecated_windows_version_check.rb
|
110
|
+
- lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_actions.rb
|
109
111
|
- lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_properties.rb
|
110
112
|
- lib/rubocop/cop/chef/deprecation/easy_install.rb
|
111
113
|
- lib/rubocop/cop/chef/deprecation/eol_audit_mode.rb
|