chefstyle 1.5.2 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbf6452b0cab1ef46383080fe18fa78d21aa00066abc1df2bbc0705a6721d753
4
- data.tar.gz: be21de8c4bc2f9681e8da6f23f0cff755e50b4a4300e84b03df4d2bbd92f829a
3
+ metadata.gz: 8f6a4af8c1483231d1585eca05b6374c95b60b6c8446b9151569ba9572661ff8
4
+ data.tar.gz: d2969b37943ff4d69349ec82d75c602d86158e82775052c144a74bff648dc7f1
5
5
  SHA512:
6
- metadata.gz: e77886f2e3067aa56a3202803dba4ac0d5f18533f0dc2d65c0bc5431fe17be09e9a00126f157bfb12d81649c4001a4d4eb2420ef672f80af28c7ec719d6dd0e7
7
- data.tar.gz: dbb8488366023a4d1986e5694cb7a09b38683b5392d8e6ca4a520cdd11b1bc73597a46b5af180aba81cd20e8e96dffcd0dd19bf545221feab9a54f9d121415e6
6
+ metadata.gz: aeb0997f80921e092c541c33bf9182f6368c96d98b396ab8afe9ed5fe28feb897dab7cf1dd24006bd145dbe27d6013f25f3625b76cf777098839b7828ff76d9a
7
+ data.tar.gz: d38b958b953908730fc0977562e9783ae3c5456bdb44a40ce18d39a68fd39dd5b9f24657849cec287a13fefd364c962afef9b9564df2c71ebd97d7dc919ebe1e
@@ -1,5 +1,6 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 2.4
3
+ SuggestExtensions: false
3
4
 
4
5
  #
5
6
  # Bundler
@@ -243,6 +244,7 @@ Layout/EmptyLineAfterGuardClause:
243
244
  Enabled: true
244
245
  Layout/EmptyLineBetweenDefs:
245
246
  Enabled: true
247
+ AllowAdjacentOneLineDefs: true
246
248
  Layout/EmptyLines:
247
249
  Enabled: true
248
250
  Layout/EmptyLinesAroundAccessModifier:
@@ -685,6 +687,10 @@ Lint/RedundantWithIndex:
685
687
  Lint/DuplicateRequire:
686
688
  Enabled: true
687
689
 
690
+ # detect assignment typos
691
+ Lint/AmbiguousAssignment:
692
+ Enabled: true
693
+
688
694
  Chef/Ruby/Ruby27KeywordArgumentWarnings:
689
695
  Description: Pass options to shell_out helpers without the brackets to avoid Ruby 2.7 deprecation warnings.
690
696
  Enabled: true
@@ -707,4 +713,9 @@ Chef/Ruby/GemspecRequireRubygems:
707
713
  Chef/Ruby/RequireNetHttps:
708
714
  Description: net/https is deprecated and just includes net/http and openssl. We should include those directly instead
709
715
  Enabled: true
710
- VersionAdded: '1.3.0'
716
+ VersionAdded: '1.3.0'
717
+
718
+ Chef/Ruby/LegacyPowershellOutMethods:
719
+ Description: Use powershell_exec!/powershell_exec instead of the slower legacy powershell_out!/powershell_out methods.
720
+ Enabled: true
721
+ VersionAdded: '1.6.0'
@@ -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,8 +407,12 @@ 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
414
+ Lint/UnexpectedBlockArity:
415
+ Enabled: false
396
416
  Lint/UnifiedInteger:
397
417
  Enabled: false
398
418
  Lint/UnmodifiedReduceAccumulator:
@@ -577,6 +597,8 @@ Style/EmptyLiteral:
577
597
  Enabled: false
578
598
  Style/EmptyMethod:
579
599
  Enabled: false
600
+ Style/EndlessMethod:
601
+ Enabled: false
580
602
  Style/Encoding:
581
603
  Enabled: false
582
604
  Style/EndBlock:
@@ -611,6 +633,8 @@ Style/HashAsLastArrayItem:
611
633
  Enabled: false
612
634
  Style/HashEachMethods:
613
635
  Enabled: false
636
+ Style/HashExcept:
637
+ Enabled: false
614
638
  Style/HashLikeCase:
615
639
  Enabled: false
616
640
  Style/HashSyntax:
@@ -627,6 +651,8 @@ Style/IfUnlessModifier:
627
651
  Enabled: false
628
652
  Style/IfUnlessModifierOfIfUnless:
629
653
  Enabled: false
654
+ Style/IfWithBooleanLiteralBranches:
655
+ Enabled: false
630
656
  Style/IfWithSemicolon:
631
657
  Enabled: false
632
658
  Style/ImplicitRuntimeError:
@@ -755,6 +781,8 @@ Style/RaiseArgs:
755
781
  Enabled: false
756
782
  Style/RandomWithOffset:
757
783
  Enabled: false
784
+ Style/RedundantArgument:
785
+ Enabled: false
758
786
  Style/RedundantBegin:
759
787
  Enabled: false
760
788
  Style/RedundantCapitalW:
@@ -132,13 +132,24 @@ 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 file, Gemfile or gems.rb file, RuboCop will try to determine
136
- # the desired version of Ruby by inspecting the .ruby-version file first,
137
- # followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
138
- # is specified in the Gemfile or gems.rb file, RuboCop reads the final value
139
- # from the lock file.) If the Ruby version is still unresolved, RuboCop will
140
- # use the oldest officially supported Ruby version (currently Ruby 2.4).
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: ~
143
+ # Determines if a notification for extension libraries should be shown when
144
+ # rubocop is run. Keys are the name of the extension, and values are an array
145
+ # of gems in the Gemfile that the extension is suggested for, if not already
146
+ # included.
147
+ SuggestExtensions:
148
+ rubocop-rails: [rails]
149
+ rubocop-rspec: [rspec, rspec-rails]
150
+ rubocop-minitest: [minitest]
151
+ rubocop-sequel: [sequel]
152
+ rubocop-rake: [rake]
142
153
 
143
154
  #################### Bundler ###############################
144
155
 
@@ -459,10 +470,14 @@ Layout/EmptyLineAfterMultilineCondition:
459
470
  - https://github.com/airbnb/ruby#multiline-if-newline
460
471
 
461
472
  Layout/EmptyLineBetweenDefs:
462
- Description: 'Use empty lines between defs.'
473
+ Description: 'Use empty lines between class/module/method defs.'
463
474
  StyleGuide: '#empty-lines-between-methods'
464
475
  Enabled: true
465
476
  VersionAdded: '0.49'
477
+ VersionChanged: '1.7'
478
+ EmptyLineBetweenMethodDefs: true
479
+ EmptyLineBetweenClassDefs: true
480
+ EmptyLineBetweenModuleDefs: true
466
481
  # If `true`, this parameter means that single line method definitions don't
467
482
  # need an empty line between them.
468
483
  AllowAdjacentOneLineDefs: false
@@ -891,8 +906,8 @@ Layout/LineLength:
891
906
  StyleGuide: '#max-line-length'
892
907
  Enabled: true
893
908
  VersionAdded: '0.25'
894
- VersionChanged: '1.3'
895
- AutoCorrect: false
909
+ VersionChanged: '1.4'
910
+ AutoCorrect: true
896
911
  Max: 120
897
912
  # To make it possible to copy or click on URIs in the code, we allow lines
898
913
  # containing a URI to be longer than Max.
@@ -1178,6 +1193,12 @@ Layout/SpaceBeforeBlockBraces:
1178
1193
  - no_space
1179
1194
  VersionChanged: '0.52'
1180
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
+
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.'
@@ -1442,6 +1469,34 @@ Lint/DeprecatedClassMethods:
1442
1469
  Enabled: true
1443
1470
  VersionAdded: '0.19'
1444
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
+
1445
1500
  Lint/DeprecatedOpenSSLConstant:
1446
1501
  Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
1447
1502
  Enabled: true
@@ -1458,6 +1513,9 @@ Lint/DuplicateBranch:
1458
1513
  Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
1459
1514
  Enabled: pending
1460
1515
  VersionAdded: '1.3'
1516
+ VersionChanged: '1.7'
1517
+ IgnoreLiteralBranches: false
1518
+ IgnoreConstantBranches: false
1461
1519
 
1462
1520
  Lint/DuplicateCaseCondition:
1463
1521
  Description: 'Do not repeat values in case conditionals.'
@@ -1644,6 +1702,11 @@ Lint/InterpolationCheck:
1644
1702
  VersionAdded: '0.50'
1645
1703
  VersionChanged: '0.87'
1646
1704
 
1705
+ Lint/LambdaWithoutLiteralBlock:
1706
+ Description: 'Checks uses of lambda without a literal block.'
1707
+ Enabled: pending
1708
+ VersionAdded: '1.8'
1709
+
1647
1710
  Lint/LiteralAsCondition:
1648
1711
  Description: 'Checks of literals used in conditions.'
1649
1712
  Enabled: true
@@ -1684,6 +1747,7 @@ Lint/MissingSuper:
1684
1747
  without calls to `super`'.
1685
1748
  Enabled: true
1686
1749
  VersionAdded: '0.89'
1750
+ VersionChanged: '1.4'
1687
1751
 
1688
1752
  Lint/MixedRegexpCaptureTypes:
1689
1753
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
@@ -1742,6 +1806,17 @@ Lint/NumberConversion:
1742
1806
  - Time
1743
1807
  - DateTime
1744
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
+
1745
1820
  Lint/OrderedMagicComments:
1746
1821
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1747
1822
  Enabled: true
@@ -1805,6 +1880,11 @@ Lint/RedundantCopEnableDirective:
1805
1880
  Enabled: true
1806
1881
  VersionAdded: '0.76'
1807
1882
 
1883
+ Lint/RedundantDirGlobSort:
1884
+ Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
1885
+ Enabled: pending
1886
+ VersionAdded: '1.8'
1887
+
1808
1888
  Lint/RedundantRequireStatement:
1809
1889
  Description: 'Checks for unnecessary `require` statement.'
1810
1890
  Enabled: true
@@ -1827,6 +1907,8 @@ Lint/RedundantSplatExpansion:
1827
1907
  Description: 'Checks for splat unnecessarily being called on literals.'
1828
1908
  Enabled: true
1829
1909
  VersionAdded: '0.76'
1910
+ VersionChanged: '1.7'
1911
+ AllowPercentLiteralArrayArgument: true
1830
1912
 
1831
1913
  Lint/RedundantStringCoercion:
1832
1914
  Description: 'Checks for Object#to_s usage in string interpolation.'
@@ -1961,12 +2043,16 @@ Lint/SuppressedException:
1961
2043
  VersionAdded: '0.9'
1962
2044
  VersionChanged: '0.81'
1963
2045
 
2046
+ Lint/SymbolConversion:
2047
+ Description: 'Checks for unnecessary symbol conversions.'
2048
+ Enabled: pending
2049
+ VersionAdded: '1.9'
2050
+
1964
2051
  Lint/Syntax:
1965
- Description: 'Checks syntax error.'
2052
+ Description: 'Checks for syntax errors.'
1966
2053
  Enabled: true
1967
2054
  VersionAdded: '0.9'
1968
2055
 
1969
-
1970
2056
  Lint/ToEnumArguments:
1971
2057
  Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
1972
2058
  Enabled: pending
@@ -1987,12 +2073,34 @@ Lint/TrailingCommaInAttributeDeclaration:
1987
2073
  Enabled: true
1988
2074
  VersionAdded: '0.90'
1989
2075
 
2076
+ Lint/TripleQuotes:
2077
+ Description: 'Checks for useless triple quote constructs.'
2078
+ Enabled: pending
2079
+ VersionAdded: '1.9'
2080
+
1990
2081
  Lint/UnderscorePrefixedVariableName:
1991
2082
  Description: 'Do not use prefix `_` for a variable that is used.'
1992
2083
  Enabled: true
1993
2084
  VersionAdded: '0.21'
1994
2085
  AllowKeywordBlockArguments: false
1995
2086
 
2087
+ Lint/UnexpectedBlockArity:
2088
+ Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
2089
+ Enabled: pending
2090
+ Safe: false
2091
+ VersionAdded: '1.5'
2092
+ Methods:
2093
+ chunk_while: 2
2094
+ each_with_index: 2
2095
+ each_with_object: 2
2096
+ inject: 2
2097
+ max: 2
2098
+ min: 2
2099
+ minmax: 2
2100
+ reduce: 2
2101
+ slice_when: 2
2102
+ sort: 2
2103
+
1996
2104
  Lint/UnifiedInteger:
1997
2105
  Description: 'Use Integer instead of Fixnum or Bignum.'
1998
2106
  Enabled: true
@@ -2002,6 +2110,7 @@ Lint/UnmodifiedReduceAccumulator:
2002
2110
  Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
2003
2111
  Enabled: pending
2004
2112
  VersionAdded: '1.1'
2113
+ VersionChanged: '1.5'
2005
2114
 
2006
2115
  Lint/UnreachableCode:
2007
2116
  Description: 'Unreachable code.'
@@ -2012,6 +2121,11 @@ Lint/UnreachableLoop:
2012
2121
  Description: 'This cop checks for loops that will have at most one iteration.'
2013
2122
  Enabled: true
2014
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/
2015
2129
 
2016
2130
  Lint/UnusedBlockArgument:
2017
2131
  Description: 'Checks for unused block arguments.'
@@ -2105,21 +2219,23 @@ Metrics/AbcSize:
2105
2219
  - https://en.wikipedia.org/wiki/ABC_Software_Metric
2106
2220
  Enabled: true
2107
2221
  VersionAdded: '0.27'
2108
- VersionChanged: '0.81'
2222
+ VersionChanged: '1.5'
2109
2223
  # The ABC size is a calculated magnitude, so this number can be an Integer or
2110
2224
  # a Float.
2111
2225
  IgnoredMethods: []
2226
+ CountRepeatedAttributes: true
2112
2227
  Max: 17
2113
2228
 
2114
2229
  Metrics/BlockLength:
2115
2230
  Description: 'Avoid long blocks with many lines.'
2116
2231
  Enabled: true
2117
2232
  VersionAdded: '0.44'
2118
- VersionChanged: '0.87'
2233
+ VersionChanged: '1.5'
2119
2234
  CountComments: false # count full line comments?
2120
2235
  Max: 25
2121
2236
  CountAsOne: []
2122
- ExcludedMethods:
2237
+ ExcludedMethods: [] # deprecated, retained for backwards compatibility
2238
+ IgnoredMethods:
2123
2239
  # By default, exclude the `#refine` method, as it tends to have larger
2124
2240
  # associated blocks.
2125
2241
  - refine
@@ -2160,11 +2276,12 @@ Metrics/MethodLength:
2160
2276
  StyleGuide: '#short-methods'
2161
2277
  Enabled: true
2162
2278
  VersionAdded: '0.25'
2163
- VersionChanged: '0.87'
2279
+ VersionChanged: '1.5'
2164
2280
  CountComments: false # count full line comments?
2165
2281
  Max: 10
2166
2282
  CountAsOne: []
2167
- ExcludedMethods: []
2283
+ ExcludedMethods: [] # deprecated, retained for backwards compatibility
2284
+ IgnoredMethods: []
2168
2285
 
2169
2286
  Metrics/ModuleLength:
2170
2287
  Description: 'Avoid modules longer than 100 lines of code.'
@@ -2180,8 +2297,10 @@ Metrics/ParameterLists:
2180
2297
  StyleGuide: '#too-many-params'
2181
2298
  Enabled: true
2182
2299
  VersionAdded: '0.25'
2300
+ VersionChanged: '1.5'
2183
2301
  Max: 5
2184
2302
  CountKeywordArgs: true
2303
+ MaxOptionalParameters: 3
2185
2304
 
2186
2305
  Metrics/PerceivedComplexity:
2187
2306
  Description: >-
@@ -2441,17 +2560,19 @@ Naming/VariableName:
2441
2560
  StyleGuide: '#snake-case-symbols-methods-vars'
2442
2561
  Enabled: true
2443
2562
  VersionAdded: '0.50'
2563
+ VersionChanged: '1.8'
2444
2564
  EnforcedStyle: snake_case
2445
2565
  SupportedStyles:
2446
2566
  - snake_case
2447
2567
  - camelCase
2568
+ AllowedIdentifiers: []
2448
2569
 
2449
2570
  Naming/VariableNumber:
2450
2571
  Description: 'Use the configured style when numbering symbols, methods and variables.'
2451
2572
  StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
2452
2573
  Enabled: true
2453
2574
  VersionAdded: '0.50'
2454
- VersionChanged: '1.3'
2575
+ VersionChanged: '1.4'
2455
2576
  EnforcedStyle: normalcase
2456
2577
  SupportedStyles:
2457
2578
  - snake_case
@@ -2459,7 +2580,13 @@ Naming/VariableNumber:
2459
2580
  - non_integer
2460
2581
  CheckMethodNames: true
2461
2582
  CheckSymbols: true
2462
- AllowedIdentifiers: []
2583
+ AllowedIdentifiers:
2584
+ - capture3 # Open3.capture3
2585
+ - iso8601 # Time#iso8601
2586
+ - rfc1123_date # CGI.rfc1123_date
2587
+ - rfc822 # Time#rfc822
2588
+ - rfc2822 # Time#rfc2822
2589
+ - rfc3339 # DateTime.rfc3339
2463
2590
 
2464
2591
  #################### Security ##############################
2465
2592
 
@@ -2582,7 +2709,8 @@ Style/AsciiComments:
2582
2709
  Enabled: true
2583
2710
  VersionAdded: '0.9'
2584
2711
  VersionChanged: '0.52'
2585
- AllowedChars: []
2712
+ AllowedChars:
2713
+ - ©
2586
2714
 
2587
2715
  Style/Attr:
2588
2716
  Description: 'Checks for uses of Module#attr.'
@@ -2851,7 +2979,7 @@ Style/CollectionMethods:
2851
2979
  StyleGuide: '#map-find-select-reduce-include-size'
2852
2980
  Enabled: false
2853
2981
  VersionAdded: '0.9'
2854
- VersionChanged: '0.27'
2982
+ VersionChanged: '1.7'
2855
2983
  Safe: false
2856
2984
  # Mapping from undesired method to desired method
2857
2985
  # e.g. to use `detect` over `find`:
@@ -2866,6 +2994,11 @@ Style/CollectionMethods:
2866
2994
  detect: 'find'
2867
2995
  find_all: 'select'
2868
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
2869
3002
 
2870
3003
  Style/ColonMethodCall:
2871
3004
  Description: 'Do not use :: for method call.'
@@ -2925,6 +3058,7 @@ Style/CommentedKeyword:
2925
3058
  Description: 'Do not place comments on the same line as certain keywords.'
2926
3059
  Enabled: true
2927
3060
  VersionAdded: '0.51'
3061
+ VersionChanged: '1.7'
2928
3062
 
2929
3063
  Style/ConditionalAssignment:
2930
3064
  Description: >-
@@ -3007,6 +3141,8 @@ Style/DisableCopsWithinSourceCodeDirective:
3007
3141
  Forbids disabling/enabling cops within source code.
3008
3142
  Enabled: false
3009
3143
  VersionAdded: '0.82'
3144
+ VersionChanged: '1.9'
3145
+ AllowedCops: []
3010
3146
 
3011
3147
  Style/DocumentDynamicEvalDefinition:
3012
3148
  Description: >-
@@ -3124,6 +3260,17 @@ Style/EndBlock:
3124
3260
  VersionAdded: '0.9'
3125
3261
  VersionChanged: '0.81'
3126
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
+
3127
3274
  Style/EvalWithLocation:
3128
3275
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3129
3276
  Enabled: true
@@ -3147,9 +3294,8 @@ Style/ExplicitBlockArgument:
3147
3294
  that just passes its arguments to another block.
3148
3295
  StyleGuide: '#block-argument'
3149
3296
  Enabled: true
3150
- # May change the yielding arity.
3151
- Safe: false
3152
3297
  VersionAdded: '0.89'
3298
+ VersionChanged: '1.8'
3153
3299
 
3154
3300
  Style/ExponentialNotation:
3155
3301
  Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
@@ -3165,9 +3311,11 @@ Style/ExponentialNotation:
3165
3311
  Style/FloatDivision:
3166
3312
  Description: 'For performing float division, coerce one side only.'
3167
3313
  StyleGuide: '#float-division'
3168
- Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
3314
+ Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3169
3315
  Enabled: true
3170
3316
  VersionAdded: '0.72'
3317
+ VersionChanged: '1.9'
3318
+ Safe: false
3171
3319
  EnforcedStyle: single_coerce
3172
3320
  SupportedStyles:
3173
3321
  - left_coerce
@@ -3215,6 +3363,7 @@ Style/FormatStringToken:
3215
3363
  MaxUnannotatedPlaceholdersAllowed: 1
3216
3364
  VersionAdded: '0.49'
3217
3365
  VersionChanged: '1.0'
3366
+ IgnoredMethods: []
3218
3367
 
3219
3368
  Style/FrozenStringLiteralComment:
3220
3369
  Description: >-
@@ -3283,6 +3432,13 @@ Style/HashEachMethods:
3283
3432
  VersionAdded: '0.80'
3284
3433
  Safe: false
3285
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
+
3286
3442
  Style/HashLikeCase:
3287
3443
  Description: >-
3288
3444
  Checks for places where `case-when` represents a simple 1:1
@@ -3361,6 +3517,11 @@ Style/IfUnlessModifierOfIfUnless:
3361
3517
  VersionAdded: '0.39'
3362
3518
  VersionChanged: '0.87'
3363
3519
 
3520
+ Style/IfWithBooleanLiteralBranches:
3521
+ Description: 'Checks for redundant `if` with boolean literal branches.'
3522
+ Enabled: pending
3523
+ VersionAdded: '1.9'
3524
+
3364
3525
  Style/IfWithSemicolon:
3365
3526
  Description: 'Do not use if x; .... Use the ternary operator instead.'
3366
3527
  StyleGuide: '#no-semicolon-ifs'
@@ -3437,6 +3598,7 @@ Style/KeywordParametersOrder:
3437
3598
  StyleGuide: '#keyword-parameters-order'
3438
3599
  Enabled: true
3439
3600
  VersionAdded: '0.90'
3601
+ VersionChanged: '1.7'
3440
3602
 
3441
3603
  Style/Lambda:
3442
3604
  Description: 'Use the new lambda literal syntax for single-line blocks.'
@@ -3475,7 +3637,7 @@ Style/MethodCallWithArgsParentheses:
3475
3637
  StyleGuide: '#method-invocation-parens'
3476
3638
  Enabled: false
3477
3639
  VersionAdded: '0.47'
3478
- VersionChanged: '0.61'
3640
+ VersionChanged: '1.7'
3479
3641
  IgnoreMacros: true
3480
3642
  IgnoredMethods: []
3481
3643
  IgnoredPatterns: []
@@ -3509,7 +3671,7 @@ Style/MethodDefParentheses:
3509
3671
  StyleGuide: '#method-parens'
3510
3672
  Enabled: true
3511
3673
  VersionAdded: '0.16'
3512
- VersionChanged: '0.35'
3674
+ VersionChanged: '1.7'
3513
3675
  EnforcedStyle: require_parentheses
3514
3676
  SupportedStyles:
3515
3677
  - require_parentheses
@@ -3615,6 +3777,7 @@ Style/MultilineMethodSignature:
3615
3777
  Description: 'Avoid multi-line method signatures.'
3616
3778
  Enabled: false
3617
3779
  VersionAdded: '0.59'
3780
+ VersionChanged: '1.7'
3618
3781
 
3619
3782
  Style/MultilineTernaryOperator:
3620
3783
  Description: >-
@@ -3643,7 +3806,8 @@ Style/MutableConstant:
3643
3806
  Description: 'Do not assign mutable objects to constants.'
3644
3807
  Enabled: true
3645
3808
  VersionAdded: '0.34'
3646
- VersionChanged: '0.65'
3809
+ VersionChanged: '1.8'
3810
+ SafeAutoCorrect: false
3647
3811
  EnforcedStyle: literals
3648
3812
  SupportedStyles:
3649
3813
  # literals: freeze literals assigned to constants
@@ -3976,6 +4140,22 @@ Style/RandomWithOffset:
3976
4140
  Enabled: true
3977
4141
  VersionAdded: '0.52'
3978
4142
 
4143
+ Style/RedundantArgument:
4144
+ Description: 'Check for a redundant argument passed to certain methods.'
4145
+ Enabled: pending
4146
+ Safe: false
4147
+ VersionAdded: '1.4'
4148
+ VersionChanged: '1.7'
4149
+ Methods:
4150
+ # Array#join
4151
+ join: ''
4152
+ # String#split
4153
+ split: ' '
4154
+ # String#chomp
4155
+ chomp: "\n"
4156
+ # String#chomp!
4157
+ chomp!: "\n"
4158
+
3979
4159
  Style/RedundantAssignment:
3980
4160
  Description: 'Checks for redundant assignment before returning.'
3981
4161
  Enabled: true
@@ -4217,7 +4397,7 @@ Style/SingleLineBlockParams:
4217
4397
  Description: 'Enforces the names of some block params.'
4218
4398
  Enabled: false
4219
4399
  VersionAdded: '0.16'
4220
- VersionChanged: '0.47'
4400
+ VersionChanged: '1.6'
4221
4401
  Methods:
4222
4402
  - reduce:
4223
4403
  - acc
@@ -4231,7 +4411,7 @@ Style/SingleLineMethods:
4231
4411
  StyleGuide: '#no-single-line-methods'
4232
4412
  Enabled: true
4233
4413
  VersionAdded: '0.9'
4234
- VersionChanged: '0.19'
4414
+ VersionChanged: '1.8'
4235
4415
  AllowIfMethodIsEmpty: true
4236
4416
 
4237
4417
  Style/SlicingWithRange:
@@ -4246,6 +4426,7 @@ Style/SoleNestedConditional:
4246
4426
  which can be merged into outer conditional node.
4247
4427
  Enabled: true
4248
4428
  VersionAdded: '0.89'
4429
+ VersionChanged: '1.5'
4249
4430
  AllowModifier: false
4250
4431
 
4251
4432
  Style/SpecialGlobalVars:
@@ -4289,6 +4470,7 @@ Style/StringConcatenation:
4289
4470
  Enabled: true
4290
4471
  Safe: false
4291
4472
  VersionAdded: '0.89'
4473
+ VersionChanged: '1.6'
4292
4474
 
4293
4475
  Style/StringHashKeys:
4294
4476
  Description: 'Prefer symbols instead of strings as hash keys.'
@@ -4378,7 +4560,7 @@ Style/SymbolProc:
4378
4560
  Enabled: true
4379
4561
  Safe: false
4380
4562
  VersionAdded: '0.26'
4381
- VersionChanged: '0.64'
4563
+ VersionChanged: '1.5'
4382
4564
  # A list of method names to be ignored by the check.
4383
4565
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4384
4566
  IgnoredMethods:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Chefstyle
3
- VERSION = "1.5.2"
4
- RUBOCOP_VERSION = "1.3.1"
5
- end
3
+ VERSION = "1.6.1"
4
+ RUBOCOP_VERSION = "1.9.0"
5
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: 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
+ module Ruby
23
+ # Use powershell_exec!/powershell_exec instead of powershell_out!/powershell_out. The new
24
+ # methods don't spawn 2 shells per shellout and instead use .NET bindings to call PS directly.
25
+ class LegacyPowershellOutMethods < Base
26
+ MSG = "Use powershell_exec!/powershell_exec instead of the slower legacy powershell_out!/powershell_out methods."
27
+ RESTRICT_ON_SEND = %i{powershell_out! powershell_out}.freeze
28
+
29
+ def on_send(node)
30
+ add_offense(node, message: MSG, severity: :refactor)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chefstyle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-16 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.3.1
19
+ version: 1.9.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.3.1
26
+ version: 1.9.0
27
27
  description:
28
28
  email:
29
29
  - oss@chef.io
@@ -43,6 +43,7 @@ files:
43
43
  - lib/chefstyle/version.rb
44
44
  - lib/rubocop/chef.rb
45
45
  - lib/rubocop/cop/chef/ruby/gemspec_require_rubygems.rb
46
+ - lib/rubocop/cop/chef/ruby/legacy_powershell_out_methods.rb
46
47
  - lib/rubocop/cop/chef/ruby/require_net_https.rb
47
48
  - lib/rubocop/cop/chef/ruby/ruby_27_keyword_argument_warnings.rb
48
49
  - lib/rubocop/cop/chef/ruby/unless_defined_require.rb
@@ -65,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
66
  - !ruby/object:Gem::Version
66
67
  version: '0'
67
68
  requirements: []
68
- rubygems_version: 3.0.3
69
+ rubygems_version: 3.1.4
69
70
  signing_key:
70
71
  specification_version: 4
71
72
  summary: RuboCop configuration for Chef's ruby projects