cookstyle 7.3.11 → 7.6.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 +4 -4
- data/Gemfile +2 -2
- data/config/cookstyle.yml +5 -1
- data/config/disable_all.yml +24 -0
- data/config/upstream.yml +145 -19
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +3 -3
- data/lib/rubocop/cop/chef/deprecation/legacy_notify_syntax.rb +1 -1
- 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 +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94c65d786aaf2a303f8bdc1d56aa5e486d54149362ecd24cd502e0bbacbe2ded
|
4
|
+
data.tar.gz: 713071ed03eb0a3095ff8fe4e0205deaa3cb51230717661a276c3e7b9593b3fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b46edc9f54e8233b750ca4ad575184bb65e134398b7c5fb5ac58e0c2e3b2c69679a53e13efb9f4ca282d26f31ae5bf6a711567fa5c4c6e8d5e3549cc623c3f99
|
7
|
+
data.tar.gz: c2cd89d013da57b588b75ccaccc8331fc2c13122992f586a0672d4fdbdcb0b34968144366ac04c7556bd4b861af684f566f9fd391b4b3a5e005bee0789d605ca
|
data/Gemfile
CHANGED
@@ -7,7 +7,7 @@ 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
|
@@ -26,4 +26,4 @@ end
|
|
26
26
|
group :development do
|
27
27
|
gem 'rake'
|
28
28
|
gem 'rspec', '>= 3.4'
|
29
|
-
end
|
29
|
+
end
|
data/config/cookstyle.yml
CHANGED
@@ -2324,7 +2324,7 @@ Style/SymbolLiteral:
|
|
2324
2324
|
Enabled: true
|
2325
2325
|
Layout/IndentationStyle:
|
2326
2326
|
Enabled: true
|
2327
|
-
Layout/
|
2327
|
+
Layout/TrailingEmptyLines:
|
2328
2328
|
Enabled: true
|
2329
2329
|
Style/TrailingCommaInArguments:
|
2330
2330
|
Enabled: true
|
@@ -2803,3 +2803,7 @@ Lint/RedundantSafeNavigation:
|
|
2803
2803
|
# Avoid using blocks to remove nils from a Hash/Array
|
2804
2804
|
Style/CollectionCompact:
|
2805
2805
|
Enabled: true
|
2806
|
+
|
2807
|
+
# eventually these constants are going to break code so fix them
|
2808
|
+
Lint/DeprecatedConstants:
|
2809
|
+
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:
|
@@ -225,6 +229,8 @@ Lint/Debugger:
|
|
225
229
|
Enabled: false
|
226
230
|
Lint/DeprecatedClassMethods:
|
227
231
|
Enabled: false
|
232
|
+
Lint/DeprecatedConstants:
|
233
|
+
Enabled: false
|
228
234
|
Lint/DeprecatedOpenSSLConstant:
|
229
235
|
Enabled: false
|
230
236
|
Lint/DisjunctiveAssignmentInConstructor:
|
@@ -291,6 +297,8 @@ Lint/IneffectiveAccessModifier:
|
|
291
297
|
Enabled: false
|
292
298
|
Lint/InterpolationCheck:
|
293
299
|
Enabled: false
|
300
|
+
Lint/LambdaWithoutLiteralBlock:
|
301
|
+
Enabled: false
|
294
302
|
Lint/LiteralAsCondition:
|
295
303
|
Enabled: false
|
296
304
|
Lint/LiteralInInterpolation:
|
@@ -319,6 +327,10 @@ Lint/NonLocalExitFromIterator:
|
|
319
327
|
Enabled: false
|
320
328
|
Lint/NumberConversion:
|
321
329
|
Enabled: false
|
330
|
+
Lint/NumberedParameterAssignment:
|
331
|
+
Enabled: false
|
332
|
+
Lint/OrAssignmentToConstant:
|
333
|
+
Enabled: false
|
322
334
|
Lint/OrderedMagicComments:
|
323
335
|
Enabled: false
|
324
336
|
Lint/OutOfRangeRegexpRef:
|
@@ -337,6 +349,8 @@ Lint/RedundantCopDisableDirective:
|
|
337
349
|
Enabled: false
|
338
350
|
Lint/RedundantCopEnableDirective:
|
339
351
|
Enabled: false
|
352
|
+
Lint/RedundantDirGlobSort:
|
353
|
+
Enabled: false
|
340
354
|
Lint/RedundantRequireStatement:
|
341
355
|
Enabled: false
|
342
356
|
Lint/RedundantSafeNavigation:
|
@@ -381,6 +395,8 @@ Lint/StructNewOverride:
|
|
381
395
|
Enabled: false
|
382
396
|
Lint/SuppressedException:
|
383
397
|
Enabled: false
|
398
|
+
Lint/SymbolConversion:
|
399
|
+
Enabled: false
|
384
400
|
Lint/Syntax:
|
385
401
|
Enabled: false
|
386
402
|
Lint/ToEnumArguments:
|
@@ -391,6 +407,8 @@ Lint/TopLevelReturnWithArgument:
|
|
391
407
|
Enabled: false
|
392
408
|
Lint/TrailingCommaInAttributeDeclaration:
|
393
409
|
Enabled: false
|
410
|
+
Lint/TripleQuotes:
|
411
|
+
Enabled: false
|
394
412
|
Lint/UnderscorePrefixedVariableName:
|
395
413
|
Enabled: false
|
396
414
|
Lint/UnexpectedBlockArity:
|
@@ -579,6 +597,8 @@ Style/EmptyLiteral:
|
|
579
597
|
Enabled: false
|
580
598
|
Style/EmptyMethod:
|
581
599
|
Enabled: false
|
600
|
+
Style/EndlessMethod:
|
601
|
+
Enabled: false
|
582
602
|
Style/Encoding:
|
583
603
|
Enabled: false
|
584
604
|
Style/EndBlock:
|
@@ -613,6 +633,8 @@ Style/HashAsLastArrayItem:
|
|
613
633
|
Enabled: false
|
614
634
|
Style/HashEachMethods:
|
615
635
|
Enabled: false
|
636
|
+
Style/HashExcept:
|
637
|
+
Enabled: false
|
616
638
|
Style/HashLikeCase:
|
617
639
|
Enabled: false
|
618
640
|
Style/HashSyntax:
|
@@ -629,6 +651,8 @@ Style/IfUnlessModifier:
|
|
629
651
|
Enabled: false
|
630
652
|
Style/IfUnlessModifierOfIfUnless:
|
631
653
|
Enabled: false
|
654
|
+
Style/IfWithBooleanLiteralBranches:
|
655
|
+
Enabled: false
|
632
656
|
Style/IfWithSemicolon:
|
633
657
|
Enabled: false
|
634
658
|
Style/ImplicitRuntimeError:
|
data/config/upstream.yml
CHANGED
@@ -132,12 +132,13 @@ AllCops:
|
|
132
132
|
# If a value is specified for TargetRubyVersion then it is used. Acceptable
|
133
133
|
# values are specificed as a float (i.e. 2.5); the teeny version of Ruby
|
134
134
|
# should not be included. If the project specifies a Ruby version in the
|
135
|
-
# .ruby-version
|
136
|
-
# the desired version of Ruby by inspecting the
|
137
|
-
#
|
138
|
-
#
|
139
|
-
# from the lock file.) If the
|
140
|
-
#
|
135
|
+
# .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
|
136
|
+
# try to determine the desired version of Ruby by inspecting the
|
137
|
+
# .tool-versions file first, then .ruby-version, followed by the Gemfile.lock
|
138
|
+
# or gems.locked file. (Although the Ruby version is specified in the Gemfile
|
139
|
+
# or gems.rb file, RuboCop reads the final value from the lock file.) If the
|
140
|
+
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
141
|
+
# supported Ruby version (currently Ruby 2.4).
|
141
142
|
TargetRubyVersion: ~
|
142
143
|
# Determines if a notification for extension libraries should be shown when
|
143
144
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
@@ -473,7 +474,7 @@ Layout/EmptyLineBetweenDefs:
|
|
473
474
|
StyleGuide: '#empty-lines-between-methods'
|
474
475
|
Enabled: true
|
475
476
|
VersionAdded: '0.49'
|
476
|
-
VersionChanged: '1.
|
477
|
+
VersionChanged: '1.7'
|
477
478
|
EmptyLineBetweenMethodDefs: true
|
478
479
|
EmptyLineBetweenClassDefs: true
|
479
480
|
EmptyLineBetweenModuleDefs: true
|
@@ -1192,6 +1193,12 @@ Layout/SpaceBeforeBlockBraces:
|
|
1192
1193
|
- no_space
|
1193
1194
|
VersionChanged: '0.52'
|
1194
1195
|
|
1196
|
+
Layout/SpaceBeforeBrackets:
|
1197
|
+
Description: 'Checks for receiver with a space before the opening brackets.'
|
1198
|
+
StyleGuide: '#space-in-brackets-access'
|
1199
|
+
Enabled: pending
|
1200
|
+
VersionAdded: '1.7'
|
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.'
|
@@ -1456,6 +1469,34 @@ Lint/DeprecatedClassMethods:
|
|
1456
1469
|
Enabled: true
|
1457
1470
|
VersionAdded: '0.19'
|
1458
1471
|
|
1472
|
+
Lint/DeprecatedConstants:
|
1473
|
+
Description: 'Checks for deprecated constants.'
|
1474
|
+
Enabled: pending
|
1475
|
+
VersionAdded: '1.8'
|
1476
|
+
# You can configure deprecated constants.
|
1477
|
+
# If there is an alternative method, you can set alternative value as `Alternative`.
|
1478
|
+
# And you can set the deprecated version as `DeprecatedVersion`.
|
1479
|
+
# These options can be omitted if they are not needed.
|
1480
|
+
#
|
1481
|
+
# DeprecatedConstants:
|
1482
|
+
# 'DEPRECATED_CONSTANT':
|
1483
|
+
# Alternative: 'alternative_value'
|
1484
|
+
# DeprecatedVersion: 'deprecated_version'
|
1485
|
+
#
|
1486
|
+
DeprecatedConstants:
|
1487
|
+
'NIL':
|
1488
|
+
Alternative: 'nil'
|
1489
|
+
DeprecatedVersion: '2.4'
|
1490
|
+
'TRUE':
|
1491
|
+
Alternative: 'true'
|
1492
|
+
DeprecatedVersion: '2.4'
|
1493
|
+
'FALSE':
|
1494
|
+
Alternative: 'false'
|
1495
|
+
DeprecatedVersion: '2.4'
|
1496
|
+
'Random::DEFAULT':
|
1497
|
+
Alternative: 'Random.new'
|
1498
|
+
DeprecatedVersion: '3.0'
|
1499
|
+
|
1459
1500
|
Lint/DeprecatedOpenSSLConstant:
|
1460
1501
|
Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
|
1461
1502
|
Enabled: true
|
@@ -1472,6 +1513,9 @@ Lint/DuplicateBranch:
|
|
1472
1513
|
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
1473
1514
|
Enabled: pending
|
1474
1515
|
VersionAdded: '1.3'
|
1516
|
+
VersionChanged: '1.7'
|
1517
|
+
IgnoreLiteralBranches: false
|
1518
|
+
IgnoreConstantBranches: false
|
1475
1519
|
|
1476
1520
|
Lint/DuplicateCaseCondition:
|
1477
1521
|
Description: 'Do not repeat values in case conditionals.'
|
@@ -1658,6 +1702,11 @@ Lint/InterpolationCheck:
|
|
1658
1702
|
VersionAdded: '0.50'
|
1659
1703
|
VersionChanged: '0.87'
|
1660
1704
|
|
1705
|
+
Lint/LambdaWithoutLiteralBlock:
|
1706
|
+
Description: 'Checks uses of lambda without a literal block.'
|
1707
|
+
Enabled: pending
|
1708
|
+
VersionAdded: '1.8'
|
1709
|
+
|
1661
1710
|
Lint/LiteralAsCondition:
|
1662
1711
|
Description: 'Checks of literals used in conditions.'
|
1663
1712
|
Enabled: true
|
@@ -1757,6 +1806,17 @@ Lint/NumberConversion:
|
|
1757
1806
|
- Time
|
1758
1807
|
- DateTime
|
1759
1808
|
|
1809
|
+
Lint/NumberedParameterAssignment:
|
1810
|
+
Description: 'Checks for uses of numbered parameter assignment.'
|
1811
|
+
Enabled: pending
|
1812
|
+
VersionAdded: '1.9'
|
1813
|
+
|
1814
|
+
Lint/OrAssignmentToConstant:
|
1815
|
+
Description: 'Checks unintended or-assignment to constant.'
|
1816
|
+
Enabled: pending
|
1817
|
+
Safe: false
|
1818
|
+
VersionAdded: '1.9'
|
1819
|
+
|
1760
1820
|
Lint/OrderedMagicComments:
|
1761
1821
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
1762
1822
|
Enabled: true
|
@@ -1820,6 +1880,11 @@ Lint/RedundantCopEnableDirective:
|
|
1820
1880
|
Enabled: true
|
1821
1881
|
VersionAdded: '0.76'
|
1822
1882
|
|
1883
|
+
Lint/RedundantDirGlobSort:
|
1884
|
+
Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
|
1885
|
+
Enabled: pending
|
1886
|
+
VersionAdded: '1.8'
|
1887
|
+
|
1823
1888
|
Lint/RedundantRequireStatement:
|
1824
1889
|
Description: 'Checks for unnecessary `require` statement.'
|
1825
1890
|
Enabled: true
|
@@ -1842,6 +1907,8 @@ Lint/RedundantSplatExpansion:
|
|
1842
1907
|
Description: 'Checks for splat unnecessarily being called on literals.'
|
1843
1908
|
Enabled: true
|
1844
1909
|
VersionAdded: '0.76'
|
1910
|
+
VersionChanged: '1.7'
|
1911
|
+
AllowPercentLiteralArrayArgument: true
|
1845
1912
|
|
1846
1913
|
Lint/RedundantStringCoercion:
|
1847
1914
|
Description: 'Checks for Object#to_s usage in string interpolation.'
|
@@ -1976,12 +2043,16 @@ Lint/SuppressedException:
|
|
1976
2043
|
VersionAdded: '0.9'
|
1977
2044
|
VersionChanged: '0.81'
|
1978
2045
|
|
2046
|
+
Lint/SymbolConversion:
|
2047
|
+
Description: 'Checks for unnecessary symbol conversions.'
|
2048
|
+
Enabled: pending
|
2049
|
+
VersionAdded: '1.9'
|
2050
|
+
|
1979
2051
|
Lint/Syntax:
|
1980
|
-
Description: 'Checks syntax
|
2052
|
+
Description: 'Checks for syntax errors.'
|
1981
2053
|
Enabled: true
|
1982
2054
|
VersionAdded: '0.9'
|
1983
2055
|
|
1984
|
-
|
1985
2056
|
Lint/ToEnumArguments:
|
1986
2057
|
Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
|
1987
2058
|
Enabled: pending
|
@@ -2002,6 +2073,11 @@ Lint/TrailingCommaInAttributeDeclaration:
|
|
2002
2073
|
Enabled: true
|
2003
2074
|
VersionAdded: '0.90'
|
2004
2075
|
|
2076
|
+
Lint/TripleQuotes:
|
2077
|
+
Description: 'Checks for useless triple quote constructs.'
|
2078
|
+
Enabled: pending
|
2079
|
+
VersionAdded: '1.9'
|
2080
|
+
|
2005
2081
|
Lint/UnderscorePrefixedVariableName:
|
2006
2082
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
2007
2083
|
Enabled: true
|
@@ -2045,6 +2121,11 @@ Lint/UnreachableLoop:
|
|
2045
2121
|
Description: 'This cop checks for loops that will have at most one iteration.'
|
2046
2122
|
Enabled: true
|
2047
2123
|
VersionAdded: '0.89'
|
2124
|
+
VersionChanged: '1.7'
|
2125
|
+
IgnoredPatterns:
|
2126
|
+
# RSpec uses `times` in its message expectations
|
2127
|
+
# eg. `exactly(2).times`
|
2128
|
+
- !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
|
2048
2129
|
|
2049
2130
|
Lint/UnusedBlockArgument:
|
2050
2131
|
Description: 'Checks for unused block arguments.'
|
@@ -2479,10 +2560,12 @@ Naming/VariableName:
|
|
2479
2560
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
2480
2561
|
Enabled: true
|
2481
2562
|
VersionAdded: '0.50'
|
2563
|
+
VersionChanged: '1.8'
|
2482
2564
|
EnforcedStyle: snake_case
|
2483
2565
|
SupportedStyles:
|
2484
2566
|
- snake_case
|
2485
2567
|
- camelCase
|
2568
|
+
AllowedIdentifiers: []
|
2486
2569
|
|
2487
2570
|
Naming/VariableNumber:
|
2488
2571
|
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
@@ -2626,7 +2709,8 @@ Style/AsciiComments:
|
|
2626
2709
|
Enabled: true
|
2627
2710
|
VersionAdded: '0.9'
|
2628
2711
|
VersionChanged: '0.52'
|
2629
|
-
AllowedChars:
|
2712
|
+
AllowedChars:
|
2713
|
+
- ©
|
2630
2714
|
|
2631
2715
|
Style/Attr:
|
2632
2716
|
Description: 'Checks for uses of Module#attr.'
|
@@ -2895,7 +2979,7 @@ Style/CollectionMethods:
|
|
2895
2979
|
StyleGuide: '#map-find-select-reduce-include-size'
|
2896
2980
|
Enabled: false
|
2897
2981
|
VersionAdded: '0.9'
|
2898
|
-
VersionChanged: '
|
2982
|
+
VersionChanged: '1.7'
|
2899
2983
|
Safe: false
|
2900
2984
|
# Mapping from undesired method to desired method
|
2901
2985
|
# e.g. to use `detect` over `find`:
|
@@ -2910,6 +2994,11 @@ Style/CollectionMethods:
|
|
2910
2994
|
detect: 'find'
|
2911
2995
|
find_all: 'select'
|
2912
2996
|
member?: 'include?'
|
2997
|
+
# Methods in this array accept a final symbol as an implicit block
|
2998
|
+
# eg. `inject(:+)`
|
2999
|
+
MethodsAcceptingSymbol:
|
3000
|
+
- inject
|
3001
|
+
- reduce
|
2913
3002
|
|
2914
3003
|
Style/ColonMethodCall:
|
2915
3004
|
Description: 'Do not use :: for method call.'
|
@@ -2969,6 +3058,7 @@ Style/CommentedKeyword:
|
|
2969
3058
|
Description: 'Do not place comments on the same line as certain keywords.'
|
2970
3059
|
Enabled: true
|
2971
3060
|
VersionAdded: '0.51'
|
3061
|
+
VersionChanged: '1.7'
|
2972
3062
|
|
2973
3063
|
Style/ConditionalAssignment:
|
2974
3064
|
Description: >-
|
@@ -3051,6 +3141,8 @@ Style/DisableCopsWithinSourceCodeDirective:
|
|
3051
3141
|
Forbids disabling/enabling cops within source code.
|
3052
3142
|
Enabled: false
|
3053
3143
|
VersionAdded: '0.82'
|
3144
|
+
VersionChanged: '1.9'
|
3145
|
+
AllowedCops: []
|
3054
3146
|
|
3055
3147
|
Style/DocumentDynamicEvalDefinition:
|
3056
3148
|
Description: >-
|
@@ -3168,6 +3260,17 @@ Style/EndBlock:
|
|
3168
3260
|
VersionAdded: '0.9'
|
3169
3261
|
VersionChanged: '0.81'
|
3170
3262
|
|
3263
|
+
Style/EndlessMethod:
|
3264
|
+
Description: 'Avoid the use of multi-lined endless method definitions.'
|
3265
|
+
StyleGuide: '#endless-methods'
|
3266
|
+
Enabled: pending
|
3267
|
+
VersionAdded: '1.8'
|
3268
|
+
EnforcedStyle: allow_single_line
|
3269
|
+
SupportedStyles:
|
3270
|
+
- allow_single_line
|
3271
|
+
- allow_always
|
3272
|
+
- disallow
|
3273
|
+
|
3171
3274
|
Style/EvalWithLocation:
|
3172
3275
|
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
3173
3276
|
Enabled: true
|
@@ -3191,9 +3294,8 @@ Style/ExplicitBlockArgument:
|
|
3191
3294
|
that just passes its arguments to another block.
|
3192
3295
|
StyleGuide: '#block-argument'
|
3193
3296
|
Enabled: true
|
3194
|
-
# May change the yielding arity.
|
3195
|
-
Safe: false
|
3196
3297
|
VersionAdded: '0.89'
|
3298
|
+
VersionChanged: '1.8'
|
3197
3299
|
|
3198
3300
|
Style/ExponentialNotation:
|
3199
3301
|
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
@@ -3209,9 +3311,11 @@ Style/ExponentialNotation:
|
|
3209
3311
|
Style/FloatDivision:
|
3210
3312
|
Description: 'For performing float division, coerce one side only.'
|
3211
3313
|
StyleGuide: '#float-division'
|
3212
|
-
Reference: 'https://
|
3314
|
+
Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
3213
3315
|
Enabled: true
|
3214
3316
|
VersionAdded: '0.72'
|
3317
|
+
VersionChanged: '1.9'
|
3318
|
+
Safe: false
|
3215
3319
|
EnforcedStyle: single_coerce
|
3216
3320
|
SupportedStyles:
|
3217
3321
|
- left_coerce
|
@@ -3259,6 +3363,7 @@ Style/FormatStringToken:
|
|
3259
3363
|
MaxUnannotatedPlaceholdersAllowed: 1
|
3260
3364
|
VersionAdded: '0.49'
|
3261
3365
|
VersionChanged: '1.0'
|
3366
|
+
IgnoredMethods: []
|
3262
3367
|
|
3263
3368
|
Style/FrozenStringLiteralComment:
|
3264
3369
|
Description: >-
|
@@ -3327,6 +3432,13 @@ Style/HashEachMethods:
|
|
3327
3432
|
VersionAdded: '0.80'
|
3328
3433
|
Safe: false
|
3329
3434
|
|
3435
|
+
Style/HashExcept:
|
3436
|
+
Description: >-
|
3437
|
+
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
3438
|
+
that can be replaced with `Hash#except` method.
|
3439
|
+
Enabled: pending
|
3440
|
+
VersionAdded: '1.7'
|
3441
|
+
|
3330
3442
|
Style/HashLikeCase:
|
3331
3443
|
Description: >-
|
3332
3444
|
Checks for places where `case-when` represents a simple 1:1
|
@@ -3405,6 +3517,11 @@ Style/IfUnlessModifierOfIfUnless:
|
|
3405
3517
|
VersionAdded: '0.39'
|
3406
3518
|
VersionChanged: '0.87'
|
3407
3519
|
|
3520
|
+
Style/IfWithBooleanLiteralBranches:
|
3521
|
+
Description: 'Checks for redundant `if` with boolean literal branches.'
|
3522
|
+
Enabled: pending
|
3523
|
+
VersionAdded: '1.9'
|
3524
|
+
|
3408
3525
|
Style/IfWithSemicolon:
|
3409
3526
|
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
3410
3527
|
StyleGuide: '#no-semicolon-ifs'
|
@@ -3481,6 +3598,7 @@ Style/KeywordParametersOrder:
|
|
3481
3598
|
StyleGuide: '#keyword-parameters-order'
|
3482
3599
|
Enabled: true
|
3483
3600
|
VersionAdded: '0.90'
|
3601
|
+
VersionChanged: '1.7'
|
3484
3602
|
|
3485
3603
|
Style/Lambda:
|
3486
3604
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
@@ -3519,7 +3637,7 @@ Style/MethodCallWithArgsParentheses:
|
|
3519
3637
|
StyleGuide: '#method-invocation-parens'
|
3520
3638
|
Enabled: false
|
3521
3639
|
VersionAdded: '0.47'
|
3522
|
-
VersionChanged: '
|
3640
|
+
VersionChanged: '1.7'
|
3523
3641
|
IgnoreMacros: true
|
3524
3642
|
IgnoredMethods: []
|
3525
3643
|
IgnoredPatterns: []
|
@@ -3553,7 +3671,7 @@ Style/MethodDefParentheses:
|
|
3553
3671
|
StyleGuide: '#method-parens'
|
3554
3672
|
Enabled: true
|
3555
3673
|
VersionAdded: '0.16'
|
3556
|
-
VersionChanged: '
|
3674
|
+
VersionChanged: '1.7'
|
3557
3675
|
EnforcedStyle: require_parentheses
|
3558
3676
|
SupportedStyles:
|
3559
3677
|
- require_parentheses
|
@@ -3659,6 +3777,7 @@ Style/MultilineMethodSignature:
|
|
3659
3777
|
Description: 'Avoid multi-line method signatures.'
|
3660
3778
|
Enabled: false
|
3661
3779
|
VersionAdded: '0.59'
|
3780
|
+
VersionChanged: '1.7'
|
3662
3781
|
|
3663
3782
|
Style/MultilineTernaryOperator:
|
3664
3783
|
Description: >-
|
@@ -3687,7 +3806,8 @@ Style/MutableConstant:
|
|
3687
3806
|
Description: 'Do not assign mutable objects to constants.'
|
3688
3807
|
Enabled: true
|
3689
3808
|
VersionAdded: '0.34'
|
3690
|
-
VersionChanged: '
|
3809
|
+
VersionChanged: '1.8'
|
3810
|
+
SafeAutoCorrect: false
|
3691
3811
|
EnforcedStyle: literals
|
3692
3812
|
SupportedStyles:
|
3693
3813
|
# literals: freeze literals assigned to constants
|
@@ -4025,11 +4145,16 @@ Style/RedundantArgument:
|
|
4025
4145
|
Enabled: pending
|
4026
4146
|
Safe: false
|
4027
4147
|
VersionAdded: '1.4'
|
4148
|
+
VersionChanged: '1.7'
|
4028
4149
|
Methods:
|
4029
4150
|
# Array#join
|
4030
4151
|
join: ''
|
4031
4152
|
# String#split
|
4032
4153
|
split: ' '
|
4154
|
+
# String#chomp
|
4155
|
+
chomp: "\n"
|
4156
|
+
# String#chomp!
|
4157
|
+
chomp!: "\n"
|
4033
4158
|
|
4034
4159
|
Style/RedundantAssignment:
|
4035
4160
|
Description: 'Checks for redundant assignment before returning.'
|
@@ -4272,7 +4397,7 @@ Style/SingleLineBlockParams:
|
|
4272
4397
|
Description: 'Enforces the names of some block params.'
|
4273
4398
|
Enabled: false
|
4274
4399
|
VersionAdded: '0.16'
|
4275
|
-
VersionChanged: '
|
4400
|
+
VersionChanged: '1.6'
|
4276
4401
|
Methods:
|
4277
4402
|
- reduce:
|
4278
4403
|
- acc
|
@@ -4286,7 +4411,7 @@ Style/SingleLineMethods:
|
|
4286
4411
|
StyleGuide: '#no-single-line-methods'
|
4287
4412
|
Enabled: true
|
4288
4413
|
VersionAdded: '0.9'
|
4289
|
-
VersionChanged: '
|
4414
|
+
VersionChanged: '1.8'
|
4290
4415
|
AllowIfMethodIsEmpty: true
|
4291
4416
|
|
4292
4417
|
Style/SlicingWithRange:
|
@@ -4345,6 +4470,7 @@ Style/StringConcatenation:
|
|
4345
4470
|
Enabled: true
|
4346
4471
|
Safe: false
|
4347
4472
|
VersionAdded: '0.89'
|
4473
|
+
VersionChanged: '1.6'
|
4348
4474
|
|
4349
4475
|
Style/StringHashKeys:
|
4350
4476
|
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.
|
4
|
+
version: 7.6.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:
|
12
|
+
date: 2021-01-29 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.9.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.9.0
|
28
28
|
description:
|
29
29
|
email:
|
30
30
|
- thom@chef.io
|
@@ -303,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
303
303
|
- !ruby/object:Gem::Version
|
304
304
|
version: '0'
|
305
305
|
requirements: []
|
306
|
-
rubygems_version: 3.
|
306
|
+
rubygems_version: 3.1.4
|
307
307
|
signing_key:
|
308
308
|
specification_version: 4
|
309
309
|
summary: Cookstyle is a code linting tool that helps you to write better Chef Infra
|