chefstyle 1.0.5 → 1.2.0

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: eeae88f92a024d9fcc4807ee65df12a7362fd72c31d058c3ac912f3ddc8002b3
4
- data.tar.gz: 386d1d16c8dc7ff06fe434fa0199711a1931f06c674361deb73fb0f627070673
3
+ metadata.gz: 16247205f8d2e388a3ac7c5a4336c245cc549c15b9398b5386ca99cf05baccfd
4
+ data.tar.gz: fd8755fc0d427637a9b1945a335eb3b3469d51d40b998aaf8e97ef872b7207bb
5
5
  SHA512:
6
- metadata.gz: 3acfad2f00e590e688415528442b541b9eff3cf1c3da9ee9b4cb0dedc22ef42f687fffcf1093ee0d650b396d06258eb9e499eb8a17bf78c921a7ca7fb598704c
7
- data.tar.gz: 7c496c1d5bb771b872e6e36c5d632c135faf9cddb4fdb8dd015a56dcc28083f6c1c3bc69bd4015f2da39dae08dee846b05fb75be228a8dd5cc2e832a9bbbe0b6
6
+ metadata.gz: c8e4b623134b357308f474ffcfe4f4ec4aa5b93b05f3a86218f8b824f6c6be31d78470cb89a87735e02744d147ac6d727b21e71183a43a8a24739940e26fa6f1
7
+ data.tar.gz: 9118fa2012461bee7207ddd039fb6da69d6a0d85e673ce052a3c76543c38f167e3e8fa0dda142bf8193004be525a87614d17d26dd55d48327eb3555745acd8db
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # -*- encoding: utf-8 -*-
3
-
2
+ # frozen_string_literal: true
4
3
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w{.. lib})
5
4
 
6
5
  require "chefstyle"
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
  lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require "chefstyle/version"
@@ -482,11 +482,15 @@ Style/WhileUntilModifier:
482
482
  Style/WordArray:
483
483
  Enabled: true
484
484
 
485
+ # we are ruby > 2.0 only so we can remove encoding comments for utf-8
486
+ Style/Encoding:
487
+ Enabled: true
488
+
485
489
  #
486
490
  # Disabled Style
487
491
  #
488
492
 
489
- # FIXME: we need to enable this
493
+ # reduces memory usage, but isn't a simple autocorrect so we need to do this one project at a time
490
494
  Style/FrozenStringLiteralComment:
491
495
  Enabled: false
492
496
 
@@ -529,10 +533,6 @@ Style/FormatString:
529
533
  Style/IfUnlessModifier:
530
534
  Enabled: false
531
535
 
532
- # we are ruby > 2.0 only so can disable the Encoding cop
533
- Style/Encoding:
534
- Enabled: false
535
-
536
536
  # Dan is -1 on this one: https://github.com/chef/chef/pull/4526#issuecomment-179950045
537
537
  Layout/IndentFirstHashElement:
538
538
  Enabled: false
@@ -628,3 +628,7 @@ Style/Alias:
628
628
  # anyone else's time either.
629
629
  Style/CommentedKeyword:
630
630
  Enabled: false
631
+
632
+ # make sure we catch this Ruby 3.0 breaking change now
633
+ Lint/DeprecatedOpenSSLConstant:
634
+ Enabled: true
@@ -211,14 +211,20 @@ Lint/BooleanSymbol:
211
211
  Enabled: false
212
212
  Lint/CircularArgumentReference:
213
213
  Enabled: false
214
+ Lint/ConstantResolution:
215
+ Enabled: false
214
216
  Lint/Debugger:
215
217
  Enabled: false
216
218
  Lint/DeprecatedClassMethods:
217
219
  Enabled: false
220
+ Lint/DeprecatedOpenSSLConstant:
221
+ Enabled: false
218
222
  Lint/DisjunctiveAssignmentInConstructor:
219
223
  Enabled: false
220
224
  Lint/DuplicateCaseCondition:
221
225
  Enabled: false
226
+ Lint/DuplicateElsifCondition:
227
+ Enabled: false
222
228
  Lint/DuplicateHashKey:
223
229
  Enabled: false
224
230
  Lint/DuplicateMethods:
@@ -263,6 +269,8 @@ Lint/Loop:
263
269
  Enabled: false
264
270
  Lint/MissingCopEnableDirective:
265
271
  Enabled: false
272
+ Lint/MixedRegexpCaptureTypes:
273
+ Enabled: false
266
274
  Lint/MultipleComparison:
267
275
  Enabled: false
268
276
  Lint/NestedMethodDefinition:
@@ -415,10 +423,14 @@ Naming/VariableNumber:
415
423
  Enabled: false
416
424
  Style/AccessModifierDeclarations:
417
425
  Enabled: false
426
+ Style/AccessorGrouping:
427
+ Enabled: false
418
428
  Style/Alias:
419
429
  Enabled: false
420
430
  Style/AndOr:
421
431
  Enabled: false
432
+ Style/ArrayCoercion:
433
+ Enabled: false
422
434
  Style/ArrayJoin:
423
435
  Enabled: false
424
436
  Style/AsciiComments:
@@ -431,12 +443,16 @@ Style/BarePercentLiterals:
431
443
  Enabled: false
432
444
  Style/BeginBlock:
433
445
  Enabled: false
446
+ Style/BisectedAttrAccessor:
447
+ Enabled: false
434
448
  Style/BlockComments:
435
449
  Enabled: false
436
450
  Style/BlockDelimiters:
437
451
  Enabled: false
438
452
  Style/CaseEquality:
439
453
  Enabled: false
454
+ Style/CaseLikeIf:
455
+ Enabled: false
440
456
  Style/CharacterLiteral:
441
457
  Enabled: false
442
458
  Style/ClassAndModuleChildren:
@@ -523,8 +539,12 @@ Style/GlobalVars:
523
539
  Enabled: false
524
540
  Style/GuardClause:
525
541
  Enabled: false
542
+ Style/HashAsLastArrayItem:
543
+ Enabled: false
526
544
  Style/HashEachMethods:
527
545
  Enabled: false
546
+ Style/HashLikeCase:
547
+ Enabled: false
528
548
  Style/HashSyntax:
529
549
  Enabled: false
530
550
  Style/HashTransformKeys:
@@ -561,6 +581,12 @@ Style/MethodCallWithoutArgsParentheses:
561
581
  Enabled: false
562
582
  Style/MethodCallWithArgsParentheses:
563
583
  Enabled: false
584
+ Style/RedundantAssignment:
585
+ Enabled: false
586
+ Style/RedundantFetchBlock:
587
+ Enabled: false
588
+ Style/RedundantFileExtensionInRequire:
589
+ Enabled: false
564
590
  Style/MethodCalledOnDoEndBlock:
565
591
  Enabled: false
566
592
  Style/MethodDefParentheses:
@@ -667,6 +693,10 @@ Style/RedundantParentheses:
667
693
  Enabled: false
668
694
  Style/RedundantPercentQ:
669
695
  Enabled: false
696
+ Style/RedundantRegexpCharacterClass:
697
+ Enabled: false
698
+ Style/RedundantRegexpEscape:
699
+ Enabled: false
670
700
  Style/RedundantReturn:
671
701
  Enabled: false
672
702
  Style/RedundantSelf:
@@ -153,12 +153,13 @@ Bundler/GemComment:
153
153
  Description: 'Add a comment describing each gem.'
154
154
  Enabled: false
155
155
  VersionAdded: '0.59'
156
- VersionChanged: '0.77'
156
+ VersionChanged: '0.85'
157
157
  Include:
158
158
  - '**/*.gemfile'
159
159
  - '**/Gemfile'
160
160
  - '**/gems.rb'
161
161
  IgnoredGems: []
162
+ OnlyFor: []
162
163
 
163
164
  Bundler/InsecureProtocolSource:
164
165
  Description: >-
@@ -179,6 +180,9 @@ Bundler/OrderedGems:
179
180
  VersionAdded: '0.46'
180
181
  VersionChanged: '0.47'
181
182
  TreatCommentsAsGroupSeparators: true
183
+ # By default, "-" and "_" are ignored for order purposes.
184
+ # This can be overridden by setting this parameter to true.
185
+ ConsiderPunctuation: false
182
186
  Include:
183
187
  - '**/*.gemfile'
184
188
  - '**/Gemfile'
@@ -199,6 +203,9 @@ Gemspec/OrderedDependencies:
199
203
  Enabled: true
200
204
  VersionAdded: '0.51'
201
205
  TreatCommentsAsGroupSeparators: true
206
+ # By default, "-" and "_" are ignored for order purposes.
207
+ # This can be overridden by setting this parameter to true.
208
+ ConsiderPunctuation: false
202
209
  Include:
203
210
  - '**/*.gemspec'
204
211
 
@@ -468,6 +475,13 @@ Layout/EmptyLinesAroundAttributeAccessor:
468
475
  StyleGuide: '#empty-lines-around-attribute-accessor'
469
476
  Enabled: pending
470
477
  VersionAdded: '0.83'
478
+ VersionChanged: '0.84'
479
+ AllowAliasSyntax: true
480
+ AllowedMethods:
481
+ - alias_method
482
+ - public
483
+ - protected
484
+ - private
471
485
 
472
486
  Layout/EmptyLinesAroundBeginBody:
473
487
  Description: "Keeps track of empty lines around begin-end bodies."
@@ -783,13 +797,7 @@ Layout/HeredocIndentation:
783
797
  StyleGuide: '#squiggly-heredocs'
784
798
  Enabled: true
785
799
  VersionAdded: '0.49'
786
- VersionChanged: '0.77'
787
- EnforcedStyle: squiggly
788
- SupportedStyles:
789
- - squiggly
790
- - active_support
791
- - powerpack
792
- - unindent
800
+ VersionChanged: '0.85'
793
801
 
794
802
  Layout/IndentationConsistency:
795
803
  Description: 'Keep indentation straight.'
@@ -857,13 +865,13 @@ Layout/LeadingEmptyLines:
857
865
  VersionChanged: '0.77'
858
866
 
859
867
  Layout/LineLength:
860
- Description: 'Limit lines to 80 characters.'
861
- StyleGuide: '#80-character-limits'
868
+ Description: 'Checks that line length does not exceed the configured limit.'
869
+ StyleGuide: '#max-line-length'
862
870
  Enabled: true
863
871
  VersionAdded: '0.25'
864
- VersionChanged: '0.78'
872
+ VersionChanged: '0.84'
865
873
  AutoCorrect: false
866
- Max: 80
874
+ Max: 120
867
875
  # To make it possible to copy or click on URIs in the code, we allow lines
868
876
  # containing a URI to be longer than Max.
869
877
  AllowHeredoc: true
@@ -1359,6 +1367,15 @@ Lint/CircularArgumentReference:
1359
1367
  Enabled: true
1360
1368
  VersionAdded: '0.33'
1361
1369
 
1370
+ Lint/ConstantResolution:
1371
+ Description: 'Check that constants are fully qualified with `::`.'
1372
+ Enabled: false
1373
+ VersionAdded: '0.86'
1374
+ # Restrict this cop to only looking at certain names
1375
+ Only: []
1376
+ # Restrict this cop from only looking at certain names
1377
+ Ignore: []
1378
+
1362
1379
  Lint/Debugger:
1363
1380
  Description: 'Check for debugger calls.'
1364
1381
  Enabled: true
@@ -1370,17 +1387,28 @@ Lint/DeprecatedClassMethods:
1370
1387
  Enabled: true
1371
1388
  VersionAdded: '0.19'
1372
1389
 
1390
+ Lint/DeprecatedOpenSSLConstant:
1391
+ Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
1392
+ Enabled: pending
1393
+ VersionAdded: '0.84'
1394
+
1373
1395
  Lint/DisjunctiveAssignmentInConstructor:
1374
1396
  Description: 'In constructor, plain assignment is preferred over disjunctive.'
1375
1397
  Enabled: true
1376
1398
  Safe: false
1377
1399
  VersionAdded: '0.62'
1400
+ VersionChanged: '0.88'
1378
1401
 
1379
1402
  Lint/DuplicateCaseCondition:
1380
1403
  Description: 'Do not repeat values in case conditionals.'
1381
1404
  Enabled: true
1382
1405
  VersionAdded: '0.45'
1383
1406
 
1407
+ Lint/DuplicateElsifCondition:
1408
+ Description: 'Do not repeat conditions used in if `elsif`.'
1409
+ Enabled: 'pending'
1410
+ VersionAdded: '0.88'
1411
+
1384
1412
  Lint/DuplicateHashKey:
1385
1413
  Description: 'Check for duplicate keys in hash literals.'
1386
1414
  Enabled: true
@@ -1492,7 +1520,9 @@ Lint/InheritException:
1492
1520
  Lint/InterpolationCheck:
1493
1521
  Description: 'Raise warning for interpolation in single q strs.'
1494
1522
  Enabled: true
1523
+ SafeAutoCorrect: false
1495
1524
  VersionAdded: '0.50'
1525
+ VersionChanged: '0.87'
1496
1526
 
1497
1527
  Lint/LiteralAsCondition:
1498
1528
  Description: 'Checks of literals used in conditions.'
@@ -1526,6 +1556,11 @@ Lint/MissingCopEnableDirective:
1526
1556
  # .inf for any size
1527
1557
  MaximumRangeSize: .inf
1528
1558
 
1559
+ Lint/MixedRegexpCaptureTypes:
1560
+ Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1561
+ Enabled: pending
1562
+ VersionAdded: '0.85'
1563
+
1529
1564
  Lint/MultipleComparison:
1530
1565
  Description: "Use `&&` operator to compare multiple values."
1531
1566
  Enabled: true
@@ -1599,7 +1634,9 @@ Lint/RaiseException:
1599
1634
  Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
1600
1635
  StyleGuide: '#raise-exception'
1601
1636
  Enabled: pending
1637
+ Safe: false
1602
1638
  VersionAdded: '0.81'
1639
+ VersionChanged: '0.86'
1603
1640
  AllowedImplicitNamespaces:
1604
1641
  - 'Gem'
1605
1642
 
@@ -1656,6 +1693,7 @@ Lint/RegexpAsCondition:
1656
1693
  The regexp literal matches `$_` implicitly.
1657
1694
  Enabled: true
1658
1695
  VersionAdded: '0.51'
1696
+ VersionChanged: '0.86'
1659
1697
 
1660
1698
  Lint/RequireParentheses:
1661
1699
  Description: >-
@@ -1712,6 +1750,7 @@ Lint/SafeNavigationWithEmpty:
1712
1750
  Description: 'Avoid `foo&.empty?` in conditionals.'
1713
1751
  Enabled: true
1714
1752
  VersionAdded: '0.62'
1753
+ VersionChanged: '0.87'
1715
1754
 
1716
1755
  Lint/ScriptPermission:
1717
1756
  Description: 'Grant script file execute permission.'
@@ -1878,9 +1917,10 @@ Metrics/BlockLength:
1878
1917
  Description: 'Avoid long blocks with many lines.'
1879
1918
  Enabled: true
1880
1919
  VersionAdded: '0.44'
1881
- VersionChanged: '0.66'
1920
+ VersionChanged: '0.87'
1882
1921
  CountComments: false # count full line comments?
1883
1922
  Max: 25
1923
+ CountAsOne: []
1884
1924
  ExcludedMethods:
1885
1925
  # By default, exclude the `#refine` method, as it tends to have larger
1886
1926
  # associated blocks.
@@ -1901,8 +1941,10 @@ Metrics/ClassLength:
1901
1941
  Description: 'Avoid classes longer than 100 lines of code.'
1902
1942
  Enabled: true
1903
1943
  VersionAdded: '0.25'
1944
+ VersionChanged: '0.87'
1904
1945
  CountComments: false # count full line comments?
1905
1946
  Max: 100
1947
+ CountAsOne: []
1906
1948
 
1907
1949
  # Avoid complex methods.
1908
1950
  Metrics/CyclomaticComplexity:
@@ -1913,24 +1955,27 @@ Metrics/CyclomaticComplexity:
1913
1955
  VersionAdded: '0.25'
1914
1956
  VersionChanged: '0.81'
1915
1957
  IgnoredMethods: []
1916
- Max: 6
1958
+ Max: 7
1917
1959
 
1918
1960
  Metrics/MethodLength:
1919
1961
  Description: 'Avoid methods longer than 10 lines of code.'
1920
1962
  StyleGuide: '#short-methods'
1921
1963
  Enabled: true
1922
1964
  VersionAdded: '0.25'
1923
- VersionChanged: '0.59.2'
1965
+ VersionChanged: '0.87'
1924
1966
  CountComments: false # count full line comments?
1925
1967
  Max: 10
1968
+ CountAsOne: []
1926
1969
  ExcludedMethods: []
1927
1970
 
1928
1971
  Metrics/ModuleLength:
1929
1972
  Description: 'Avoid modules longer than 100 lines of code.'
1930
1973
  Enabled: true
1931
1974
  VersionAdded: '0.31'
1975
+ VersionChanged: '0.87'
1932
1976
  CountComments: false # count full line comments?
1933
1977
  Max: 100
1978
+ CountAsOne: []
1934
1979
 
1935
1980
  Metrics/ParameterLists:
1936
1981
  Description: 'Avoid parameter lists longer than three or four parameters.'
@@ -1968,10 +2013,12 @@ Naming/AccessorMethodName:
1968
2013
  VersionAdded: '0.50'
1969
2014
 
1970
2015
  Naming/AsciiIdentifiers:
1971
- Description: 'Use only ascii symbols in identifiers.'
2016
+ Description: 'Use only ascii symbols in identifiers and constants.'
1972
2017
  StyleGuide: '#english-identifiers'
1973
2018
  Enabled: true
1974
2019
  VersionAdded: '0.50'
2020
+ VersionChanged: '0.87'
2021
+ AsciiConstants: true
1975
2022
 
1976
2023
  Naming/BinaryOperatorParameterName:
1977
2024
  Description: 'When defining binary operators, name the argument other.'
@@ -1999,6 +2046,11 @@ Naming/ClassAndModuleCamelCase:
1999
2046
  StyleGuide: '#camelcase-classes'
2000
2047
  Enabled: true
2001
2048
  VersionAdded: '0.50'
2049
+ VersionChanged: '0.85'
2050
+ # Allowed class/module names can be specified here.
2051
+ # These can be full or part of the name.
2052
+ AllowedNames:
2053
+ - module_parent
2002
2054
 
2003
2055
  Naming/ConstantName:
2004
2056
  Description: 'Constants should use SCREAMING_SNAKE_CASE.'
@@ -2019,6 +2071,10 @@ Naming/FileName:
2019
2071
  # It further expects it to be nested inside modules which match the names
2020
2072
  # of subdirectories in its path.
2021
2073
  ExpectMatchingDefinition: false
2074
+ # When `false`, changes the behavior of ExpectMatchingDefinition to match only
2075
+ # whether each source file's class or module name matches the file name --
2076
+ # not whether the nested module hierarchy matches the subdirectory path.
2077
+ CheckDefinitionPathHierarchy: true
2022
2078
  # If non-`nil`, expect all source file names to match the following regex.
2023
2079
  # Only the file name itself is matched, not the entire file path.
2024
2080
  # Use anchors as necessary if you want to match the entire name rather than
@@ -2129,17 +2185,18 @@ Naming/MethodParameterName:
2129
2185
  AllowNamesEndingInNumbers: true
2130
2186
  # Allowed names that will not register an offense
2131
2187
  AllowedNames:
2132
- - io
2133
- - id
2134
- - to
2188
+ - at
2135
2189
  - by
2136
- - 'on'
2190
+ - db
2191
+ - id
2137
2192
  - in
2138
- - at
2193
+ - io
2139
2194
  - ip
2140
- - db
2195
+ - of
2196
+ - 'on'
2141
2197
  - os
2142
2198
  - pp
2199
+ - to
2143
2200
  # Forbidden names that will register an offense
2144
2201
  ForbiddenNames: []
2145
2202
 
@@ -2210,7 +2267,7 @@ Security/JSONLoad:
2210
2267
  Description: >-
2211
2268
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
2212
2269
  security issues. See reference for more information.
2213
- Reference: 'https://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
2270
+ Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
2214
2271
  Enabled: true
2215
2272
  VersionAdded: '0.43'
2216
2273
  VersionChanged: '0.44'
@@ -2223,7 +2280,7 @@ Security/MarshalLoad:
2223
2280
  Description: >-
2224
2281
  Avoid using of `Marshal.load` or `Marshal.restore` due to potential
2225
2282
  security issues. See reference for more information.
2226
- Reference: 'https://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
2283
+ Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
2227
2284
  Enabled: true
2228
2285
  VersionAdded: '0.47'
2229
2286
 
@@ -2237,7 +2294,7 @@ Security/YAMLLoad:
2237
2294
  Description: >-
2238
2295
  Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
2239
2296
  security issues. See reference for more information.
2240
- Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2297
+ Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2241
2298
  Enabled: true
2242
2299
  VersionAdded: '0.47'
2243
2300
  SafeAutoCorrect: false
@@ -2255,6 +2312,17 @@ Style/AccessModifierDeclarations:
2255
2312
  - group
2256
2313
  AllowModifiersOnSymbols: true
2257
2314
 
2315
+ Style/AccessorGrouping:
2316
+ Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
2317
+ Enabled: 'pending'
2318
+ VersionAdded: '0.87'
2319
+ EnforcedStyle: grouped
2320
+ SupportedStyles:
2321
+ # separated: each accessor goes in a separate statement.
2322
+ # grouped: accessors are grouped into a single statement.
2323
+ - separated
2324
+ - grouped
2325
+
2258
2326
  Style/Alias:
2259
2327
  Description: 'Use alias instead of alias_method.'
2260
2328
  StyleGuide: '#alias-method-lexically'
@@ -2274,11 +2342,19 @@ Style/AndOr:
2274
2342
  VersionChanged: '0.25'
2275
2343
  # Whether `and` and `or` are banned only in conditionals (conditionals)
2276
2344
  # or completely (always).
2277
- EnforcedStyle: always
2345
+ EnforcedStyle: conditionals
2278
2346
  SupportedStyles:
2279
2347
  - always
2280
2348
  - conditionals
2281
2349
 
2350
+ Style/ArrayCoercion:
2351
+ Description: >-
2352
+ Use Array() instead of explicit Array check or [*var], when dealing
2353
+ with a variable you want to treat as an Array, but you're not certain it's an array.
2354
+ StyleGuide: '#array-coercion'
2355
+ Enabled: 'pending'
2356
+ VersionAdded: '0.88'
2357
+
2282
2358
  Style/ArrayJoin:
2283
2359
  Description: 'Use Array#join instead of Array#*.'
2284
2360
  StyleGuide: '#array-join'
@@ -2322,6 +2398,13 @@ Style/BeginBlock:
2322
2398
  Enabled: true
2323
2399
  VersionAdded: '0.9'
2324
2400
 
2401
+ Style/BisectedAttrAccessor:
2402
+ Description: >-
2403
+ Checks for places where `attr_reader` and `attr_writer`
2404
+ for the same method can be combined into single `attr_accessor`.
2405
+ Enabled: 'pending'
2406
+ VersionAdded: '0.87'
2407
+
2325
2408
  Style/BlockComments:
2326
2409
  Description: 'Do not use block comments.'
2327
2410
  StyleGuide: '#no-block-comments'
@@ -2454,6 +2537,12 @@ Style/CaseEquality:
2454
2537
  # String === "string"
2455
2538
  AllowOnConstant: false
2456
2539
 
2540
+ Style/CaseLikeIf:
2541
+ Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2542
+ StyleGuide: '#case-vs-if-else'
2543
+ Enabled: 'pending'
2544
+ VersionAdded: '0.88'
2545
+
2457
2546
  Style/CharacterLiteral:
2458
2547
  Description: 'Checks for uses of character literals.'
2459
2548
  StyleGuide: '#no-character-literals'
@@ -2694,6 +2783,12 @@ Style/DoubleNegation:
2694
2783
  StyleGuide: '#no-bang-bang'
2695
2784
  Enabled: true
2696
2785
  VersionAdded: '0.19'
2786
+ VersionChanged: '0.84'
2787
+ EnforcedStyle: allowed_in_returns
2788
+ SafeAutoCorrect: false
2789
+ SupportedStyles:
2790
+ - allowed_in_returns
2791
+ - forbidden
2697
2792
 
2698
2793
  Style/EachForSimpleLoop:
2699
2794
  Description: >-
@@ -2857,8 +2952,7 @@ Style/FrozenStringLiteralComment:
2857
2952
  SupportedStyles:
2858
2953
  # `always` will always add the frozen string literal comment to a file
2859
2954
  # regardless of the Ruby version or if `freeze` or `<<` are called on a
2860
- # string literal. If you run code against multiple versions of Ruby, it is
2861
- # possible that this will create errors in Ruby 2.3.0+.
2955
+ # string literal. It is possible that this will create errors.
2862
2956
  - always
2863
2957
  # `always_true` will add the frozen string literal comment to a file,
2864
2958
  # similarly to the `always` style, but will also change any disabled
@@ -2888,6 +2982,18 @@ Style/GuardClause:
2888
2982
  # needs to have to trigger this cop
2889
2983
  MinBodyLength: 1
2890
2984
 
2985
+ Style/HashAsLastArrayItem:
2986
+ Description: >-
2987
+ Checks for presence or absence of braces around hash literal as a last
2988
+ array item depending on configuration.
2989
+ StyleGuide: '#hash-literal-as-last-array-item'
2990
+ Enabled: 'pending'
2991
+ VersionAdded: '0.88'
2992
+ EnforcedStyle: braces
2993
+ SupportedStyles:
2994
+ - braces
2995
+ - no_braces
2996
+
2891
2997
  Style/HashEachMethods:
2892
2998
  Description: 'Use Hash#each_key and Hash#each_value.'
2893
2999
  StyleGuide: '#hash-each'
@@ -2895,6 +3001,16 @@ Style/HashEachMethods:
2895
3001
  VersionAdded: '0.80'
2896
3002
  Safe: false
2897
3003
 
3004
+ Style/HashLikeCase:
3005
+ Description: >-
3006
+ Checks for places where `case-when` represents a simple 1:1
3007
+ mapping and can be replaced with a hash lookup.
3008
+ Enabled: 'pending'
3009
+ VersionAdded: '0.88'
3010
+ # `MinBranchesCount` defines the number of branches `case` needs to have
3011
+ # to trigger this cop
3012
+ MinBranchesCount: 3
3013
+
2898
3014
  Style/HashSyntax:
2899
3015
  Description: >-
2900
3016
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -2958,6 +3074,7 @@ Style/IfUnlessModifierOfIfUnless:
2958
3074
  Avoid modifier if/unless usage on conditionals.
2959
3075
  Enabled: true
2960
3076
  VersionAdded: '0.39'
3077
+ VersionChanged: '0.87'
2961
3078
 
2962
3079
  Style/IfWithSemicolon:
2963
3080
  Description: 'Do not use if x; .... Use the ternary operator instead.'
@@ -3214,6 +3331,7 @@ Style/MultilineTernaryOperator:
3214
3331
  StyleGuide: '#no-multiline-ternary'
3215
3332
  Enabled: true
3216
3333
  VersionAdded: '0.9'
3334
+ VersionChanged: '0.86'
3217
3335
 
3218
3336
  Style/MultilineWhenThen:
3219
3337
  Description: 'Do not use then for multi-line when statement.'
@@ -3318,6 +3436,7 @@ Style/NestedTernaryOperator:
3318
3436
  StyleGuide: '#no-nested-ternary'
3319
3437
  Enabled: true
3320
3438
  VersionAdded: '0.9'
3439
+ VersionChanged: '0.86'
3321
3440
 
3322
3441
  Style/Next:
3323
3442
  Description: 'Use `next` to skip iteration instead of a condition at the end.'
@@ -3542,6 +3661,11 @@ Style/RandomWithOffset:
3542
3661
  Enabled: true
3543
3662
  VersionAdded: '0.52'
3544
3663
 
3664
+ Style/RedundantAssignment:
3665
+ Description: 'Checks for redundant assignment before returning.'
3666
+ Enabled: 'pending'
3667
+ VersionAdded: '0.87'
3668
+
3545
3669
  Style/RedundantBegin:
3546
3670
  Description: "Don't use begin blocks when they are not needed."
3547
3671
  StyleGuide: '#begin-implicit'
@@ -3571,6 +3695,27 @@ Style/RedundantException:
3571
3695
  VersionAdded: '0.14'
3572
3696
  VersionChanged: '0.29'
3573
3697
 
3698
+ Style/RedundantFetchBlock:
3699
+ Description: >-
3700
+ Use `fetch(key, value)` instead of `fetch(key) { value }`
3701
+ when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
3702
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
3703
+ Enabled: 'pending'
3704
+ Safe: false
3705
+ # If enabled, this cop will autocorrect usages of
3706
+ # `fetch` being called with block returning a constant.
3707
+ # This can be dangerous since constants will not be defined at that moment.
3708
+ SafeForConstants: false
3709
+ VersionAdded: '0.86'
3710
+
3711
+ Style/RedundantFileExtensionInRequire:
3712
+ Description: >-
3713
+ Checks for the presence of superfluous `.rb` extension in
3714
+ the filename provided to `require` and `require_relative`.
3715
+ StyleGuide: '#no-explicit-rb-to-require'
3716
+ Enabled: 'pending'
3717
+ VersionAdded: '0.88'
3718
+
3574
3719
  Style/RedundantFreeze:
3575
3720
  Description: "Checks usages of Object#freeze on immutable objects."
3576
3721
  Enabled: true
@@ -3593,6 +3738,16 @@ Style/RedundantPercentQ:
3593
3738
  Enabled: true
3594
3739
  VersionAdded: '0.76'
3595
3740
 
3741
+ Style/RedundantRegexpCharacterClass:
3742
+ Description: 'Checks for unnecessary single-element Regexp character classes.'
3743
+ Enabled: pending
3744
+ VersionAdded: '0.85'
3745
+
3746
+ Style/RedundantRegexpEscape:
3747
+ Description: 'Checks for redundant escapes in Regexps.'
3748
+ Enabled: pending
3749
+ VersionAdded: '0.85'
3750
+
3596
3751
  Style/RedundantReturn:
3597
3752
  Description: "Don't use return where it's not required."
3598
3753
  StyleGuide: '#no-explicit-return'
@@ -3840,6 +3995,7 @@ Style/StructInheritance:
3840
3995
  StyleGuide: '#no-extend-struct-new'
3841
3996
  Enabled: true
3842
3997
  VersionAdded: '0.29'
3998
+ VersionChanged: '0.86'
3843
3999
 
3844
4000
  Style/SymbolArray:
3845
4001
  Description: 'Use %i or %I for arrays of symbols.'
@@ -3861,7 +4017,7 @@ Style/SymbolLiteral:
3861
4017
  Style/SymbolProc:
3862
4018
  Description: 'Use symbols as procs instead of blocks when possible.'
3863
4019
  Enabled: true
3864
- SafeAutoCorrect: false
4020
+ Safe: false
3865
4021
  VersionAdded: '0.26'
3866
4022
  VersionChanged: '0.64'
3867
4023
  # A list of method names to be ignored by the check.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_relative "chefstyle/version"
2
3
 
3
4
  # ensure the desired target version of RuboCop is gem activated
@@ -1,4 +1,5 @@
1
+ # frozen_string_literal: true
1
2
  module Chefstyle
2
- VERSION = "1.0.5".freeze
3
- RUBOCOP_VERSION = "0.83.0".freeze
3
+ VERSION = "1.2.0"
4
+ RUBOCOP_VERSION = "0.88.0"
4
5
  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.0.5
4
+ version: 1.2.0
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-05-11 00:00:00.000000000 Z
11
+ date: 2020-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.83.0
61
+ version: 0.88.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.83.0
68
+ version: 0.88.0
69
69
  description:
70
70
  email:
71
71
  - oss@chef.io