cookstyle 7.2.1 → 7.3.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -4
- data/config/cookstyle.yml +41 -6
- data/config/disable_all.yml +4 -0
- data/config/upstream.yml +67 -11
- 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/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: 7e45a26b3da9f964cf0e791fb11bf6c524a627403f266c5ab809c17bef6a6999
|
4
|
+
data.tar.gz: d2adff5897b1b0fc4700252fa51026eff90826d353ce390e70480776caf7993e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 042130c9ee03c716518ab26e4a1f53b9748eba6c1f268c86f74795ca2a1fd06320a0cc16bc248fc8179a3501970576af7777b679d886c71ed3caf09e19d6d2e3
|
7
|
+
data.tar.gz: 96ac7744718b752f666b55cea268d0b9bfd2c7dd17d19305078a5daed83c358c8c07504964a381d3cb5dac7bb05ec2298e15126196143931ab948f67d9d2439f
|
data/Gemfile
CHANGED
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:
|
@@ -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
@@ -393,6 +393,8 @@ Lint/TrailingCommaInAttributeDeclaration:
|
|
393
393
|
Enabled: false
|
394
394
|
Lint/UnderscorePrefixedVariableName:
|
395
395
|
Enabled: false
|
396
|
+
Lint/UnexpectedBlockArity:
|
397
|
+
Enabled: false
|
396
398
|
Lint/UnifiedInteger:
|
397
399
|
Enabled: false
|
398
400
|
Lint/UnmodifiedReduceAccumulator:
|
@@ -755,6 +757,8 @@ Style/RaiseArgs:
|
|
755
757
|
Enabled: false
|
756
758
|
Style/RandomWithOffset:
|
757
759
|
Enabled: false
|
760
|
+
Style/RedundantArgument:
|
761
|
+
Enabled: false
|
758
762
|
Style/RedundantBegin:
|
759
763
|
Enabled: false
|
760
764
|
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.4'
|
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.
|
@@ -1684,6 +1698,7 @@ Lint/MissingSuper:
|
|
1684
1698
|
without calls to `super`'.
|
1685
1699
|
Enabled: true
|
1686
1700
|
VersionAdded: '0.89'
|
1701
|
+
VersionChanged: '1.4'
|
1687
1702
|
|
1688
1703
|
Lint/MixedRegexpCaptureTypes:
|
1689
1704
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
@@ -1993,6 +2008,23 @@ Lint/UnderscorePrefixedVariableName:
|
|
1993
2008
|
VersionAdded: '0.21'
|
1994
2009
|
AllowKeywordBlockArguments: false
|
1995
2010
|
|
2011
|
+
Lint/UnexpectedBlockArity:
|
2012
|
+
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
|
2013
|
+
Enabled: pending
|
2014
|
+
Safe: false
|
2015
|
+
VersionAdded: '1.5'
|
2016
|
+
Methods:
|
2017
|
+
chunk_while: 2
|
2018
|
+
each_with_index: 2
|
2019
|
+
each_with_object: 2
|
2020
|
+
inject: 2
|
2021
|
+
max: 2
|
2022
|
+
min: 2
|
2023
|
+
minmax: 2
|
2024
|
+
reduce: 2
|
2025
|
+
slice_when: 2
|
2026
|
+
sort: 2
|
2027
|
+
|
1996
2028
|
Lint/UnifiedInteger:
|
1997
2029
|
Description: 'Use Integer instead of Fixnum or Bignum.'
|
1998
2030
|
Enabled: true
|
@@ -2002,6 +2034,7 @@ Lint/UnmodifiedReduceAccumulator:
|
|
2002
2034
|
Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
|
2003
2035
|
Enabled: pending
|
2004
2036
|
VersionAdded: '1.1'
|
2037
|
+
VersionChanged: '1.5'
|
2005
2038
|
|
2006
2039
|
Lint/UnreachableCode:
|
2007
2040
|
Description: 'Unreachable code.'
|
@@ -2105,21 +2138,23 @@ Metrics/AbcSize:
|
|
2105
2138
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
2106
2139
|
Enabled: true
|
2107
2140
|
VersionAdded: '0.27'
|
2108
|
-
VersionChanged: '
|
2141
|
+
VersionChanged: '1.5'
|
2109
2142
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
2110
2143
|
# a Float.
|
2111
2144
|
IgnoredMethods: []
|
2145
|
+
CountRepeatedAttributes: true
|
2112
2146
|
Max: 17
|
2113
2147
|
|
2114
2148
|
Metrics/BlockLength:
|
2115
2149
|
Description: 'Avoid long blocks with many lines.'
|
2116
2150
|
Enabled: true
|
2117
2151
|
VersionAdded: '0.44'
|
2118
|
-
VersionChanged: '
|
2152
|
+
VersionChanged: '1.5'
|
2119
2153
|
CountComments: false # count full line comments?
|
2120
2154
|
Max: 25
|
2121
2155
|
CountAsOne: []
|
2122
|
-
ExcludedMethods:
|
2156
|
+
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2157
|
+
IgnoredMethods:
|
2123
2158
|
# By default, exclude the `#refine` method, as it tends to have larger
|
2124
2159
|
# associated blocks.
|
2125
2160
|
- refine
|
@@ -2160,11 +2195,12 @@ Metrics/MethodLength:
|
|
2160
2195
|
StyleGuide: '#short-methods'
|
2161
2196
|
Enabled: true
|
2162
2197
|
VersionAdded: '0.25'
|
2163
|
-
VersionChanged: '
|
2198
|
+
VersionChanged: '1.5'
|
2164
2199
|
CountComments: false # count full line comments?
|
2165
2200
|
Max: 10
|
2166
2201
|
CountAsOne: []
|
2167
|
-
ExcludedMethods: []
|
2202
|
+
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2203
|
+
IgnoredMethods: []
|
2168
2204
|
|
2169
2205
|
Metrics/ModuleLength:
|
2170
2206
|
Description: 'Avoid modules longer than 100 lines of code.'
|
@@ -2180,8 +2216,10 @@ Metrics/ParameterLists:
|
|
2180
2216
|
StyleGuide: '#too-many-params'
|
2181
2217
|
Enabled: true
|
2182
2218
|
VersionAdded: '0.25'
|
2219
|
+
VersionChanged: '1.5'
|
2183
2220
|
Max: 5
|
2184
2221
|
CountKeywordArgs: true
|
2222
|
+
MaxOptionalParameters: 3
|
2185
2223
|
|
2186
2224
|
Metrics/PerceivedComplexity:
|
2187
2225
|
Description: >-
|
@@ -2451,7 +2489,7 @@ Naming/VariableNumber:
|
|
2451
2489
|
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
|
2452
2490
|
Enabled: true
|
2453
2491
|
VersionAdded: '0.50'
|
2454
|
-
VersionChanged: '1.
|
2492
|
+
VersionChanged: '1.4'
|
2455
2493
|
EnforcedStyle: normalcase
|
2456
2494
|
SupportedStyles:
|
2457
2495
|
- snake_case
|
@@ -2459,7 +2497,13 @@ Naming/VariableNumber:
|
|
2459
2497
|
- non_integer
|
2460
2498
|
CheckMethodNames: true
|
2461
2499
|
CheckSymbols: true
|
2462
|
-
AllowedIdentifiers:
|
2500
|
+
AllowedIdentifiers:
|
2501
|
+
- capture3 # Open3.capture3
|
2502
|
+
- iso8601 # Time#iso8601
|
2503
|
+
- rfc1123_date # CGI.rfc1123_date
|
2504
|
+
- rfc822 # Time#rfc822
|
2505
|
+
- rfc2822 # Time#rfc2822
|
2506
|
+
- rfc3339 # DateTime.rfc3339
|
2463
2507
|
|
2464
2508
|
#################### Security ##############################
|
2465
2509
|
|
@@ -3976,6 +4020,17 @@ Style/RandomWithOffset:
|
|
3976
4020
|
Enabled: true
|
3977
4021
|
VersionAdded: '0.52'
|
3978
4022
|
|
4023
|
+
Style/RedundantArgument:
|
4024
|
+
Description: 'Check for a redundant argument passed to certain methods.'
|
4025
|
+
Enabled: pending
|
4026
|
+
Safe: false
|
4027
|
+
VersionAdded: '1.4'
|
4028
|
+
Methods:
|
4029
|
+
# Array#join
|
4030
|
+
join: ''
|
4031
|
+
# String#split
|
4032
|
+
split: ' '
|
4033
|
+
|
3979
4034
|
Style/RedundantAssignment:
|
3980
4035
|
Description: 'Checks for redundant assignment before returning.'
|
3981
4036
|
Enabled: true
|
@@ -4246,6 +4301,7 @@ Style/SoleNestedConditional:
|
|
4246
4301
|
which can be merged into outer conditional node.
|
4247
4302
|
Enabled: true
|
4248
4303
|
VersionAdded: '0.89'
|
4304
|
+
VersionChanged: '1.5'
|
4249
4305
|
AllowModifier: false
|
4250
4306
|
|
4251
4307
|
Style/SpecialGlobalVars:
|
@@ -4378,7 +4434,7 @@ Style/SymbolProc:
|
|
4378
4434
|
Enabled: true
|
4379
4435
|
Safe: false
|
4380
4436
|
VersionAdded: '0.26'
|
4381
|
-
VersionChanged: '
|
4437
|
+
VersionChanged: '1.5'
|
4382
4438
|
# A list of method names to be ignored by the check.
|
4383
4439
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
4384
4440
|
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
|
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.
|
4
|
+
version: 7.3.10
|
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-01 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.5.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.5.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
|