cookstyle 7.3.10 → 7.5.3
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 +2 -4
- data/config/cookstyle.yml +1 -1
- data/config/disable_all.yml +6 -0
- data/config/upstream.yml +52 -7
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +3 -3
- 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
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c9e534b328ad67e11c08f3aad0fa8380bcc11f48659c15ad13cf9eacdfdd1fb
|
4
|
+
data.tar.gz: 9822c6e1a3b3b98a37533c5d281c09719ca9d13a02280d8be3c45b12f06f7da3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a011a3c3532e811a988d8f87533bc3595920f9863d9151c994aaf7aa8115073fee0f05419a3ec0cb07498f0934adee5d8acc89f97441b092b87a4ebb4b6be5c0
|
7
|
+
data.tar.gz: d6d42efac3a6438c9aa00309b4c4987a1c82c03d9187f7e237d0e493de221137bd02f196436f0e6fe2d9ec1f56a1ec242c2f44aeb8a20da50147de0311eeca61
|
data/Gemfile
CHANGED
@@ -7,12 +7,10 @@ gemspec
|
|
7
7
|
group :debug do
|
8
8
|
gem 'pry'
|
9
9
|
gem 'pry-byebug'
|
10
|
-
gem 'pry-stack_explorer', '
|
10
|
+
gem 'pry-stack_explorer', '< 0.4.13' # 0.4.13+ drops support for Ruby < 2.6
|
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
|
|
@@ -28,4 +26,4 @@ end
|
|
28
26
|
group :development do
|
29
27
|
gem 'rake'
|
30
28
|
gem 'rspec', '>= 3.4'
|
31
|
-
end
|
29
|
+
end
|
data/config/cookstyle.yml
CHANGED
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:
|
@@ -613,6 +617,8 @@ Style/HashAsLastArrayItem:
|
|
613
617
|
Enabled: false
|
614
618
|
Style/HashEachMethods:
|
615
619
|
Enabled: false
|
620
|
+
Style/HashExcept:
|
621
|
+
Enabled: false
|
616
622
|
Style/HashLikeCase:
|
617
623
|
Enabled: false
|
618
624
|
Style/HashSyntax:
|
data/config/upstream.yml
CHANGED
@@ -473,7 +473,7 @@ Layout/EmptyLineBetweenDefs:
|
|
473
473
|
StyleGuide: '#empty-lines-between-methods'
|
474
474
|
Enabled: true
|
475
475
|
VersionAdded: '0.49'
|
476
|
-
VersionChanged: '1.
|
476
|
+
VersionChanged: '1.7'
|
477
477
|
EmptyLineBetweenMethodDefs: true
|
478
478
|
EmptyLineBetweenClassDefs: true
|
479
479
|
EmptyLineBetweenModuleDefs: true
|
@@ -1192,6 +1192,13 @@ Layout/SpaceBeforeBlockBraces:
|
|
1192
1192
|
- no_space
|
1193
1193
|
VersionChanged: '0.52'
|
1194
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
|
+
|
1195
1202
|
Layout/SpaceBeforeComma:
|
1196
1203
|
Description: 'No spaces before commas.'
|
1197
1204
|
Enabled: true
|
@@ -1354,6 +1361,11 @@ Layout/TrailingWhitespace:
|
|
1354
1361
|
#################### Lint ##################################
|
1355
1362
|
### Warnings
|
1356
1363
|
|
1364
|
+
Lint/AmbiguousAssignment:
|
1365
|
+
Description: 'Checks for mistyped shorthand assignments.'
|
1366
|
+
Enabled: pending
|
1367
|
+
VersionAdded: '1.7'
|
1368
|
+
|
1357
1369
|
Lint/AmbiguousBlockAssociation:
|
1358
1370
|
Description: >-
|
1359
1371
|
Checks for ambiguous block association with method when param passed without
|
@@ -1396,6 +1408,7 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
1396
1408
|
Enabled: true
|
1397
1409
|
Safe: false
|
1398
1410
|
VersionAdded: '0.89'
|
1411
|
+
VersionChanged: '1.7'
|
1399
1412
|
|
1400
1413
|
Lint/BooleanSymbol:
|
1401
1414
|
Description: 'Check for `:true` and `:false` symbols.'
|
@@ -1472,6 +1485,9 @@ Lint/DuplicateBranch:
|
|
1472
1485
|
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
1473
1486
|
Enabled: pending
|
1474
1487
|
VersionAdded: '1.3'
|
1488
|
+
VersionChanged: '1.7'
|
1489
|
+
IgnoreLiteralBranches: false
|
1490
|
+
IgnoreConstantBranches: false
|
1475
1491
|
|
1476
1492
|
Lint/DuplicateCaseCondition:
|
1477
1493
|
Description: 'Do not repeat values in case conditionals.'
|
@@ -1842,6 +1858,8 @@ Lint/RedundantSplatExpansion:
|
|
1842
1858
|
Description: 'Checks for splat unnecessarily being called on literals.'
|
1843
1859
|
Enabled: true
|
1844
1860
|
VersionAdded: '0.76'
|
1861
|
+
VersionChanged: '1.7'
|
1862
|
+
AllowPercentLiteralArrayArgument: true
|
1845
1863
|
|
1846
1864
|
Lint/RedundantStringCoercion:
|
1847
1865
|
Description: 'Checks for Object#to_s usage in string interpolation.'
|
@@ -2045,6 +2063,11 @@ Lint/UnreachableLoop:
|
|
2045
2063
|
Description: 'This cop checks for loops that will have at most one iteration.'
|
2046
2064
|
Enabled: true
|
2047
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/
|
2048
2071
|
|
2049
2072
|
Lint/UnusedBlockArgument:
|
2050
2073
|
Description: 'Checks for unused block arguments.'
|
@@ -2895,7 +2918,7 @@ Style/CollectionMethods:
|
|
2895
2918
|
StyleGuide: '#map-find-select-reduce-include-size'
|
2896
2919
|
Enabled: false
|
2897
2920
|
VersionAdded: '0.9'
|
2898
|
-
VersionChanged: '
|
2921
|
+
VersionChanged: '1.7'
|
2899
2922
|
Safe: false
|
2900
2923
|
# Mapping from undesired method to desired method
|
2901
2924
|
# e.g. to use `detect` over `find`:
|
@@ -2910,6 +2933,11 @@ Style/CollectionMethods:
|
|
2910
2933
|
detect: 'find'
|
2911
2934
|
find_all: 'select'
|
2912
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
|
2913
2941
|
|
2914
2942
|
Style/ColonMethodCall:
|
2915
2943
|
Description: 'Do not use :: for method call.'
|
@@ -2969,6 +2997,7 @@ Style/CommentedKeyword:
|
|
2969
2997
|
Description: 'Do not place comments on the same line as certain keywords.'
|
2970
2998
|
Enabled: true
|
2971
2999
|
VersionAdded: '0.51'
|
3000
|
+
VersionChanged: '1.7'
|
2972
3001
|
|
2973
3002
|
Style/ConditionalAssignment:
|
2974
3003
|
Description: >-
|
@@ -3209,9 +3238,10 @@ Style/ExponentialNotation:
|
|
3209
3238
|
Style/FloatDivision:
|
3210
3239
|
Description: 'For performing float division, coerce one side only.'
|
3211
3240
|
StyleGuide: '#float-division'
|
3212
|
-
Reference: 'https://
|
3241
|
+
Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
3213
3242
|
Enabled: true
|
3214
3243
|
VersionAdded: '0.72'
|
3244
|
+
VersionChanged: '1.6'
|
3215
3245
|
EnforcedStyle: single_coerce
|
3216
3246
|
SupportedStyles:
|
3217
3247
|
- left_coerce
|
@@ -3327,6 +3357,13 @@ Style/HashEachMethods:
|
|
3327
3357
|
VersionAdded: '0.80'
|
3328
3358
|
Safe: false
|
3329
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
|
+
|
3330
3367
|
Style/HashLikeCase:
|
3331
3368
|
Description: >-
|
3332
3369
|
Checks for places where `case-when` represents a simple 1:1
|
@@ -3481,6 +3518,7 @@ Style/KeywordParametersOrder:
|
|
3481
3518
|
StyleGuide: '#keyword-parameters-order'
|
3482
3519
|
Enabled: true
|
3483
3520
|
VersionAdded: '0.90'
|
3521
|
+
VersionChanged: '1.7'
|
3484
3522
|
|
3485
3523
|
Style/Lambda:
|
3486
3524
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
@@ -3519,7 +3557,7 @@ Style/MethodCallWithArgsParentheses:
|
|
3519
3557
|
StyleGuide: '#method-invocation-parens'
|
3520
3558
|
Enabled: false
|
3521
3559
|
VersionAdded: '0.47'
|
3522
|
-
VersionChanged: '
|
3560
|
+
VersionChanged: '1.7'
|
3523
3561
|
IgnoreMacros: true
|
3524
3562
|
IgnoredMethods: []
|
3525
3563
|
IgnoredPatterns: []
|
@@ -3553,7 +3591,7 @@ Style/MethodDefParentheses:
|
|
3553
3591
|
StyleGuide: '#method-parens'
|
3554
3592
|
Enabled: true
|
3555
3593
|
VersionAdded: '0.16'
|
3556
|
-
VersionChanged: '
|
3594
|
+
VersionChanged: '1.7'
|
3557
3595
|
EnforcedStyle: require_parentheses
|
3558
3596
|
SupportedStyles:
|
3559
3597
|
- require_parentheses
|
@@ -3659,6 +3697,7 @@ Style/MultilineMethodSignature:
|
|
3659
3697
|
Description: 'Avoid multi-line method signatures.'
|
3660
3698
|
Enabled: false
|
3661
3699
|
VersionAdded: '0.59'
|
3700
|
+
VersionChanged: '1.7'
|
3662
3701
|
|
3663
3702
|
Style/MultilineTernaryOperator:
|
3664
3703
|
Description: >-
|
@@ -4025,11 +4064,16 @@ Style/RedundantArgument:
|
|
4025
4064
|
Enabled: pending
|
4026
4065
|
Safe: false
|
4027
4066
|
VersionAdded: '1.4'
|
4067
|
+
VersionChanged: '1.7'
|
4028
4068
|
Methods:
|
4029
4069
|
# Array#join
|
4030
4070
|
join: ''
|
4031
4071
|
# String#split
|
4032
4072
|
split: ' '
|
4073
|
+
# String#chomp
|
4074
|
+
chomp: "\n"
|
4075
|
+
# String#chomp!
|
4076
|
+
chomp!: "\n"
|
4033
4077
|
|
4034
4078
|
Style/RedundantAssignment:
|
4035
4079
|
Description: 'Checks for redundant assignment before returning.'
|
@@ -4272,7 +4316,7 @@ Style/SingleLineBlockParams:
|
|
4272
4316
|
Description: 'Enforces the names of some block params.'
|
4273
4317
|
Enabled: false
|
4274
4318
|
VersionAdded: '0.16'
|
4275
|
-
VersionChanged: '
|
4319
|
+
VersionChanged: '1.6'
|
4276
4320
|
Methods:
|
4277
4321
|
- reduce:
|
4278
4322
|
- acc
|
@@ -4286,7 +4330,7 @@ Style/SingleLineMethods:
|
|
4286
4330
|
StyleGuide: '#no-single-line-methods'
|
4287
4331
|
Enabled: true
|
4288
4332
|
VersionAdded: '0.9'
|
4289
|
-
VersionChanged: '
|
4333
|
+
VersionChanged: '1.7'
|
4290
4334
|
AllowIfMethodIsEmpty: true
|
4291
4335
|
|
4292
4336
|
Style/SlicingWithRange:
|
@@ -4345,6 +4389,7 @@ Style/StringConcatenation:
|
|
4345
4389
|
Enabled: true
|
4346
4390
|
Safe: false
|
4347
4391
|
VersionAdded: '0.89'
|
4392
|
+
VersionChanged: '1.6'
|
4348
4393
|
|
4349
4394
|
Style/StringHashKeys:
|
4350
4395
|
Description: 'Prefer symbols instead of strings as hash keys.'
|
data/lib/cookstyle/version.rb
CHANGED
@@ -64,7 +64,7 @@ module RuboCop
|
|
64
64
|
'opensuse' => {
|
65
65
|
'< 14' => true,
|
66
66
|
'~> 42.0' => true,
|
67
|
-
'
|
67
|
+
'~> 15.0, < 15.2' => '15',
|
68
68
|
},
|
69
69
|
'debian' => {
|
70
70
|
'< 9' => true,
|
@@ -73,12 +73,12 @@ module RuboCop
|
|
73
73
|
'centos' => {
|
74
74
|
'< 6.0' => true,
|
75
75
|
'~> 6.0, < 6.10' => '6',
|
76
|
-
'~> 7.0, < 7.
|
76
|
+
'~> 7.0, < 7.7 ' => '7',
|
77
77
|
},
|
78
78
|
'redhat' => {
|
79
79
|
'< 6.0' => true,
|
80
80
|
'~> 6.0, < 6.10' => '6',
|
81
|
-
'~> 7.0, < 7.
|
81
|
+
'~> 7.0, < 7.7' => '7',
|
82
82
|
},
|
83
83
|
'oracle' => {
|
84
84
|
'< 6.0' => true,
|
@@ -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.3
|
4
|
+
version: 7.5.3
|
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-
|
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
|