chefstyle 1.5.8 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea86ca41825de97c45f03fb4f92b3c24e9593581d7684e9c019a693b71086da7
4
- data.tar.gz: dc61783edb3e841a55812f354fd638be1d490e91a8c8dac809f1ebda9c0d4925
3
+ metadata.gz: 9d423d3b6c1aef64ba7af6404723876508d480d05050d92368032aa704306d7d
4
+ data.tar.gz: b002fe1d27979f8101b7ed79d8c6a0d2f7c201c6dc1f09ee2f140ab533fce3d2
5
5
  SHA512:
6
- metadata.gz: 1af3b9f104d275b7e24c91981aa307213eefdb4317edea2fa78786189cc04934632f940e4c8c4d3e337125f31922c6bf473134b09ea3e3d19b2a5e7380664107
7
- data.tar.gz: e7924820282d4bfe70189ab37c483bf6cf4ef907ab31214bc7bbed8de15003b0323527d74b99ae6ef0d6036e4cbb220eb43382b2cef2c0262421a0cfd3fee73f
6
+ metadata.gz: e597e3beddb923eb33a914d38e33eb1883a9b98c8cfe6b3fdae72b393d89b9cf050635f0ba3e2098fc1ea7f4ab92fd41cf29600da905fc529d7c397742b04799
7
+ data.tar.gz: aad4a9c602ddb9498a5dac5fec9aba55d33c976b713823e6246be096fbfcc81eb22d187825aa242bdab5669fbdf65668ce967f9a53e68920f281f1e516cf1012
data/config/chefstyle.yml CHANGED
@@ -687,6 +687,10 @@ Lint/RedundantWithIndex:
687
687
  Lint/DuplicateRequire:
688
688
  Enabled: true
689
689
 
690
+ # detect assignment typos
691
+ Lint/AmbiguousAssignment:
692
+ Enabled: true
693
+
690
694
  Chef/Ruby/Ruby27KeywordArgumentWarnings:
691
695
  Description: Pass options to shell_out helpers without the brackets to avoid Ruby 2.7 deprecation warnings.
692
696
  Enabled: true
@@ -706,7 +710,22 @@ Chef/Ruby/GemspecRequireRubygems:
706
710
  Include:
707
711
  - '**/*.gemspec'
708
712
 
713
+ Chef/Ruby/GemspecLicense:
714
+ Description: 'All gemspec files should define their license.'
715
+ Enabled: true
716
+ VersionAdded: '1.7.0'
717
+ Include:
718
+ - '**/*.gemspec'
719
+ Exclude:
720
+ - '/**/spec/**/*'
721
+ - '/**/test/**/*'
722
+
709
723
  Chef/Ruby/RequireNetHttps:
710
724
  Description: net/https is deprecated and just includes net/http and openssl. We should include those directly instead
711
725
  Enabled: true
712
- VersionAdded: '1.3.0'
726
+ VersionAdded: '1.3.0'
727
+
728
+ Chef/Ruby/LegacyPowershellOutMethods:
729
+ Description: Use powershell_exec!/powershell_exec instead of the slower legacy powershell_out!/powershell_out methods.
730
+ Enabled: true
731
+ VersionAdded: '1.6.0'
@@ -9,6 +9,8 @@ Bundler/InsecureProtocolSource:
9
9
  Enabled: false
10
10
  Bundler/OrderedGems:
11
11
  Enabled: false
12
+ Gemspec/DateAssignment:
13
+ Enabled: false
12
14
  Gemspec/DuplicatedAssignment:
13
15
  Enabled: false
14
16
  Gemspec/OrderedDependencies:
@@ -169,6 +171,8 @@ Layout/SpaceAroundOperators:
169
171
  Enabled: false
170
172
  Layout/SpaceBeforeBlockBraces:
171
173
  Enabled: false
174
+ Layout/SpaceBeforeBrackets:
175
+ Enabled: false
172
176
  Layout/SpaceBeforeComma:
173
177
  Enabled: false
174
178
  Layout/SpaceBeforeComment:
@@ -201,6 +205,8 @@ Layout/TrailingEmptyLines:
201
205
  Enabled: false
202
206
  Layout/TrailingWhitespace:
203
207
  Enabled: false
208
+ Lint/AmbiguousAssignment:
209
+ Enabled: false
204
210
  Lint/AmbiguousBlockAssociation:
205
211
  Enabled: false
206
212
  Lint/AmbiguousOperator:
@@ -225,6 +231,8 @@ Lint/Debugger:
225
231
  Enabled: false
226
232
  Lint/DeprecatedClassMethods:
227
233
  Enabled: false
234
+ Lint/DeprecatedConstants:
235
+ Enabled: false
228
236
  Lint/DeprecatedOpenSSLConstant:
229
237
  Enabled: false
230
238
  Lint/DisjunctiveAssignmentInConstructor:
@@ -291,6 +299,8 @@ Lint/IneffectiveAccessModifier:
291
299
  Enabled: false
292
300
  Lint/InterpolationCheck:
293
301
  Enabled: false
302
+ Lint/LambdaWithoutLiteralBlock:
303
+ Enabled: false
294
304
  Lint/LiteralAsCondition:
295
305
  Enabled: false
296
306
  Lint/LiteralInInterpolation:
@@ -319,6 +329,10 @@ Lint/NonLocalExitFromIterator:
319
329
  Enabled: false
320
330
  Lint/NumberConversion:
321
331
  Enabled: false
332
+ Lint/NumberedParameterAssignment:
333
+ Enabled: false
334
+ Lint/OrAssignmentToConstant:
335
+ Enabled: false
322
336
  Lint/OrderedMagicComments:
323
337
  Enabled: false
324
338
  Lint/OutOfRangeRegexpRef:
@@ -337,6 +351,8 @@ Lint/RedundantCopDisableDirective:
337
351
  Enabled: false
338
352
  Lint/RedundantCopEnableDirective:
339
353
  Enabled: false
354
+ Lint/RedundantDirGlobSort:
355
+ Enabled: false
340
356
  Lint/RedundantRequireStatement:
341
357
  Enabled: false
342
358
  Lint/RedundantSafeNavigation:
@@ -381,6 +397,8 @@ Lint/StructNewOverride:
381
397
  Enabled: false
382
398
  Lint/SuppressedException:
383
399
  Enabled: false
400
+ Lint/SymbolConversion:
401
+ Enabled: false
384
402
  Lint/Syntax:
385
403
  Enabled: false
386
404
  Lint/ToEnumArguments:
@@ -391,6 +409,8 @@ Lint/TopLevelReturnWithArgument:
391
409
  Enabled: false
392
410
  Lint/TrailingCommaInAttributeDeclaration:
393
411
  Enabled: false
412
+ Lint/TripleQuotes:
413
+ Enabled: false
394
414
  Lint/UnderscorePrefixedVariableName:
395
415
  Enabled: false
396
416
  Lint/UnexpectedBlockArity:
@@ -579,6 +599,8 @@ Style/EmptyLiteral:
579
599
  Enabled: false
580
600
  Style/EmptyMethod:
581
601
  Enabled: false
602
+ Style/EndlessMethod:
603
+ Enabled: false
582
604
  Style/Encoding:
583
605
  Enabled: false
584
606
  Style/EndBlock:
@@ -611,8 +633,12 @@ Style/GuardClause:
611
633
  Enabled: false
612
634
  Style/HashAsLastArrayItem:
613
635
  Enabled: false
636
+ Style/HashConversion:
637
+ Enabled: false
614
638
  Style/HashEachMethods:
615
639
  Enabled: false
640
+ Style/HashExcept:
641
+ Enabled: false
616
642
  Style/HashLikeCase:
617
643
  Enabled: false
618
644
  Style/HashSyntax:
@@ -629,6 +655,8 @@ Style/IfUnlessModifier:
629
655
  Enabled: false
630
656
  Style/IfUnlessModifierOfIfUnless:
631
657
  Enabled: false
658
+ Style/IfWithBooleanLiteralBranches:
659
+ Enabled: false
632
660
  Style/IfWithSemicolon:
633
661
  Enabled: false
634
662
  Style/ImplicitRuntimeError:
@@ -869,6 +897,8 @@ Style/TrivialAccessors:
869
897
  Enabled: false
870
898
  Style/UnlessElse:
871
899
  Enabled: false
900
+ Style/UnlessLogicalOperators:
901
+ Enabled: false
872
902
  Style/UnpackFirst:
873
903
  Enabled: false
874
904
  Style/VariableInterpolation:
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 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: ~
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
@@ -202,6 +203,13 @@ Bundler/OrderedGems:
202
203
 
203
204
  #################### Gemspec ###############################
204
205
 
206
+ Gemspec/DateAssignment:
207
+ Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
208
+ Enabled: pending
209
+ VersionAdded: '1.10'
210
+ Include:
211
+ - '**/*.gemspec'
212
+
205
213
  Gemspec/DuplicatedAssignment:
206
214
  Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
207
215
  Enabled: true
@@ -473,7 +481,7 @@ Layout/EmptyLineBetweenDefs:
473
481
  StyleGuide: '#empty-lines-between-methods'
474
482
  Enabled: true
475
483
  VersionAdded: '0.49'
476
- VersionChanged: '1.4'
484
+ VersionChanged: '1.7'
477
485
  EmptyLineBetweenMethodDefs: true
478
486
  EmptyLineBetweenClassDefs: true
479
487
  EmptyLineBetweenModuleDefs: true
@@ -1192,6 +1200,12 @@ Layout/SpaceBeforeBlockBraces:
1192
1200
  - no_space
1193
1201
  VersionChanged: '0.52'
1194
1202
 
1203
+ Layout/SpaceBeforeBrackets:
1204
+ Description: 'Checks for receiver with a space before the opening brackets.'
1205
+ StyleGuide: '#space-in-brackets-access'
1206
+ Enabled: pending
1207
+ VersionAdded: '1.7'
1208
+
1195
1209
  Layout/SpaceBeforeComma:
1196
1210
  Description: 'No spaces before commas.'
1197
1211
  Enabled: true
@@ -1354,6 +1368,11 @@ Layout/TrailingWhitespace:
1354
1368
  #################### Lint ##################################
1355
1369
  ### Warnings
1356
1370
 
1371
+ Lint/AmbiguousAssignment:
1372
+ Description: 'Checks for mistyped shorthand assignments.'
1373
+ Enabled: pending
1374
+ VersionAdded: '1.7'
1375
+
1357
1376
  Lint/AmbiguousBlockAssociation:
1358
1377
  Description: >-
1359
1378
  Checks for ambiguous block association with method when param passed without
@@ -1396,6 +1415,7 @@ Lint/BinaryOperatorWithIdenticalOperands:
1396
1415
  Enabled: true
1397
1416
  Safe: false
1398
1417
  VersionAdded: '0.89'
1418
+ VersionChanged: '1.7'
1399
1419
 
1400
1420
  Lint/BooleanSymbol:
1401
1421
  Description: 'Check for `:true` and `:false` symbols.'
@@ -1433,29 +1453,65 @@ Lint/Debugger:
1433
1453
  Description: 'Check for debugger calls.'
1434
1454
  Enabled: true
1435
1455
  VersionAdded: '0.14'
1436
- VersionChanged: '0.49'
1437
- DebuggerReceivers:
1438
- - binding
1439
- - Kernel
1440
- - Pry
1456
+ VersionChanged: '1.10'
1457
+ DebuggerReceivers: [] # deprecated
1441
1458
  DebuggerMethods:
1442
- - debugger
1443
- - byebug
1444
- - remote_byebug
1445
- - pry
1446
- - remote_pry
1447
- - pry_remote
1448
- - console
1449
- - rescue
1450
- - save_and_open_page
1451
- - save_and_open_screenshot
1452
- - irb
1459
+ # Groups are available so that a specific group can be disabled in
1460
+ # a user's configuration, but are otherwise not significant.
1461
+ Kernel:
1462
+ - binding.irb
1463
+ Byebug:
1464
+ - byebug
1465
+ - remote_byebug
1466
+ - Kernel.byebug
1467
+ - Kernel.remote_byebug
1468
+ Capybara:
1469
+ - save_and_open_page
1470
+ - save_and_open_screenshot
1471
+ Pry:
1472
+ - binding.pry
1473
+ - binding.remote_pry
1474
+ - binding.pry_remote
1475
+ - Pry.rescue
1476
+ Rails:
1477
+ - debugger
1478
+ - Kernel.debugger
1479
+ WebConsole:
1480
+ - binding.console
1453
1481
 
1454
1482
  Lint/DeprecatedClassMethods:
1455
1483
  Description: 'Check for deprecated class method calls.'
1456
1484
  Enabled: true
1457
1485
  VersionAdded: '0.19'
1458
1486
 
1487
+ Lint/DeprecatedConstants:
1488
+ Description: 'Checks for deprecated constants.'
1489
+ Enabled: pending
1490
+ VersionAdded: '1.8'
1491
+ # You can configure deprecated constants.
1492
+ # If there is an alternative method, you can set alternative value as `Alternative`.
1493
+ # And you can set the deprecated version as `DeprecatedVersion`.
1494
+ # These options can be omitted if they are not needed.
1495
+ #
1496
+ # DeprecatedConstants:
1497
+ # 'DEPRECATED_CONSTANT':
1498
+ # Alternative: 'alternative_value'
1499
+ # DeprecatedVersion: 'deprecated_version'
1500
+ #
1501
+ DeprecatedConstants:
1502
+ 'NIL':
1503
+ Alternative: 'nil'
1504
+ DeprecatedVersion: '2.4'
1505
+ 'TRUE':
1506
+ Alternative: 'true'
1507
+ DeprecatedVersion: '2.4'
1508
+ 'FALSE':
1509
+ Alternative: 'false'
1510
+ DeprecatedVersion: '2.4'
1511
+ 'Random::DEFAULT':
1512
+ Alternative: 'Random.new'
1513
+ DeprecatedVersion: '3.0'
1514
+
1459
1515
  Lint/DeprecatedOpenSSLConstant:
1460
1516
  Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
1461
1517
  Enabled: true
@@ -1472,6 +1528,9 @@ Lint/DuplicateBranch:
1472
1528
  Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
1473
1529
  Enabled: pending
1474
1530
  VersionAdded: '1.3'
1531
+ VersionChanged: '1.7'
1532
+ IgnoreLiteralBranches: false
1533
+ IgnoreConstantBranches: false
1475
1534
 
1476
1535
  Lint/DuplicateCaseCondition:
1477
1536
  Description: 'Do not repeat values in case conditionals.'
@@ -1658,6 +1717,11 @@ Lint/InterpolationCheck:
1658
1717
  VersionAdded: '0.50'
1659
1718
  VersionChanged: '0.87'
1660
1719
 
1720
+ Lint/LambdaWithoutLiteralBlock:
1721
+ Description: 'Checks uses of lambda without a literal block.'
1722
+ Enabled: pending
1723
+ VersionAdded: '1.8'
1724
+
1661
1725
  Lint/LiteralAsCondition:
1662
1726
  Description: 'Checks of literals used in conditions.'
1663
1727
  Enabled: true
@@ -1757,6 +1821,17 @@ Lint/NumberConversion:
1757
1821
  - Time
1758
1822
  - DateTime
1759
1823
 
1824
+ Lint/NumberedParameterAssignment:
1825
+ Description: 'Checks for uses of numbered parameter assignment.'
1826
+ Enabled: pending
1827
+ VersionAdded: '1.9'
1828
+
1829
+ Lint/OrAssignmentToConstant:
1830
+ Description: 'Checks unintended or-assignment to constant.'
1831
+ Enabled: pending
1832
+ Safe: false
1833
+ VersionAdded: '1.9'
1834
+
1760
1835
  Lint/OrderedMagicComments:
1761
1836
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1762
1837
  Enabled: true
@@ -1820,6 +1895,11 @@ Lint/RedundantCopEnableDirective:
1820
1895
  Enabled: true
1821
1896
  VersionAdded: '0.76'
1822
1897
 
1898
+ Lint/RedundantDirGlobSort:
1899
+ Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
1900
+ Enabled: pending
1901
+ VersionAdded: '1.8'
1902
+
1823
1903
  Lint/RedundantRequireStatement:
1824
1904
  Description: 'Checks for unnecessary `require` statement.'
1825
1905
  Enabled: true
@@ -1842,6 +1922,8 @@ Lint/RedundantSplatExpansion:
1842
1922
  Description: 'Checks for splat unnecessarily being called on literals.'
1843
1923
  Enabled: true
1844
1924
  VersionAdded: '0.76'
1925
+ VersionChanged: '1.7'
1926
+ AllowPercentLiteralArrayArgument: true
1845
1927
 
1846
1928
  Lint/RedundantStringCoercion:
1847
1929
  Description: 'Checks for Object#to_s usage in string interpolation.'
@@ -1976,12 +2058,16 @@ Lint/SuppressedException:
1976
2058
  VersionAdded: '0.9'
1977
2059
  VersionChanged: '0.81'
1978
2060
 
2061
+ Lint/SymbolConversion:
2062
+ Description: 'Checks for unnecessary symbol conversions.'
2063
+ Enabled: pending
2064
+ VersionAdded: '1.9'
2065
+
1979
2066
  Lint/Syntax:
1980
- Description: 'Checks syntax error.'
2067
+ Description: 'Checks for syntax errors.'
1981
2068
  Enabled: true
1982
2069
  VersionAdded: '0.9'
1983
2070
 
1984
-
1985
2071
  Lint/ToEnumArguments:
1986
2072
  Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
1987
2073
  Enabled: pending
@@ -2002,6 +2088,11 @@ Lint/TrailingCommaInAttributeDeclaration:
2002
2088
  Enabled: true
2003
2089
  VersionAdded: '0.90'
2004
2090
 
2091
+ Lint/TripleQuotes:
2092
+ Description: 'Checks for useless triple quote constructs.'
2093
+ Enabled: pending
2094
+ VersionAdded: '1.9'
2095
+
2005
2096
  Lint/UnderscorePrefixedVariableName:
2006
2097
  Description: 'Do not use prefix `_` for a variable that is used.'
2007
2098
  Enabled: true
@@ -2045,6 +2136,11 @@ Lint/UnreachableLoop:
2045
2136
  Description: 'This cop checks for loops that will have at most one iteration.'
2046
2137
  Enabled: true
2047
2138
  VersionAdded: '0.89'
2139
+ VersionChanged: '1.7'
2140
+ IgnoredPatterns:
2141
+ # RSpec uses `times` in its message expectations
2142
+ # eg. `exactly(2).times`
2143
+ - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
2048
2144
 
2049
2145
  Lint/UnusedBlockArgument:
2050
2146
  Description: 'Checks for unused block arguments.'
@@ -2479,10 +2575,12 @@ Naming/VariableName:
2479
2575
  StyleGuide: '#snake-case-symbols-methods-vars'
2480
2576
  Enabled: true
2481
2577
  VersionAdded: '0.50'
2578
+ VersionChanged: '1.8'
2482
2579
  EnforcedStyle: snake_case
2483
2580
  SupportedStyles:
2484
2581
  - snake_case
2485
2582
  - camelCase
2583
+ AllowedIdentifiers: []
2486
2584
 
2487
2585
  Naming/VariableNumber:
2488
2586
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -2626,7 +2724,8 @@ Style/AsciiComments:
2626
2724
  Enabled: true
2627
2725
  VersionAdded: '0.9'
2628
2726
  VersionChanged: '0.52'
2629
- AllowedChars: []
2727
+ AllowedChars:
2728
+ - ©
2630
2729
 
2631
2730
  Style/Attr:
2632
2731
  Description: 'Checks for uses of Module#attr.'
@@ -2895,7 +2994,7 @@ Style/CollectionMethods:
2895
2994
  StyleGuide: '#map-find-select-reduce-include-size'
2896
2995
  Enabled: false
2897
2996
  VersionAdded: '0.9'
2898
- VersionChanged: '0.27'
2997
+ VersionChanged: '1.7'
2899
2998
  Safe: false
2900
2999
  # Mapping from undesired method to desired method
2901
3000
  # e.g. to use `detect` over `find`:
@@ -2910,6 +3009,11 @@ Style/CollectionMethods:
2910
3009
  detect: 'find'
2911
3010
  find_all: 'select'
2912
3011
  member?: 'include?'
3012
+ # Methods in this array accept a final symbol as an implicit block
3013
+ # eg. `inject(:+)`
3014
+ MethodsAcceptingSymbol:
3015
+ - inject
3016
+ - reduce
2913
3017
 
2914
3018
  Style/ColonMethodCall:
2915
3019
  Description: 'Do not use :: for method call.'
@@ -2969,6 +3073,7 @@ Style/CommentedKeyword:
2969
3073
  Description: 'Do not place comments on the same line as certain keywords.'
2970
3074
  Enabled: true
2971
3075
  VersionAdded: '0.51'
3076
+ VersionChanged: '1.7'
2972
3077
 
2973
3078
  Style/ConditionalAssignment:
2974
3079
  Description: >-
@@ -2997,6 +3102,8 @@ Style/ConstantVisibility:
2997
3102
  visibility declarations.
2998
3103
  Enabled: false
2999
3104
  VersionAdded: '0.66'
3105
+ VersionChanged: '1.10'
3106
+ IgnoreModules: false
3000
3107
 
3001
3108
  # Checks that you have put a copyright in a comment before any code.
3002
3109
  #
@@ -3051,6 +3158,8 @@ Style/DisableCopsWithinSourceCodeDirective:
3051
3158
  Forbids disabling/enabling cops within source code.
3052
3159
  Enabled: false
3053
3160
  VersionAdded: '0.82'
3161
+ VersionChanged: '1.9'
3162
+ AllowedCops: []
3054
3163
 
3055
3164
  Style/DocumentDynamicEvalDefinition:
3056
3165
  Description: >-
@@ -3168,6 +3277,17 @@ Style/EndBlock:
3168
3277
  VersionAdded: '0.9'
3169
3278
  VersionChanged: '0.81'
3170
3279
 
3280
+ Style/EndlessMethod:
3281
+ Description: 'Avoid the use of multi-lined endless method definitions.'
3282
+ StyleGuide: '#endless-methods'
3283
+ Enabled: pending
3284
+ VersionAdded: '1.8'
3285
+ EnforcedStyle: allow_single_line
3286
+ SupportedStyles:
3287
+ - allow_single_line
3288
+ - allow_always
3289
+ - disallow
3290
+
3171
3291
  Style/EvalWithLocation:
3172
3292
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3173
3293
  Enabled: true
@@ -3191,9 +3311,8 @@ Style/ExplicitBlockArgument:
3191
3311
  that just passes its arguments to another block.
3192
3312
  StyleGuide: '#block-argument'
3193
3313
  Enabled: true
3194
- # May change the yielding arity.
3195
- Safe: false
3196
3314
  VersionAdded: '0.89'
3315
+ VersionChanged: '1.8'
3197
3316
 
3198
3317
  Style/ExponentialNotation:
3199
3318
  Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
@@ -3212,7 +3331,8 @@ Style/FloatDivision:
3212
3331
  Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3213
3332
  Enabled: true
3214
3333
  VersionAdded: '0.72'
3215
- VersionChanged: '1.6'
3334
+ VersionChanged: '1.9'
3335
+ Safe: false
3216
3336
  EnforcedStyle: single_coerce
3217
3337
  SupportedStyles:
3218
3338
  - left_coerce
@@ -3260,6 +3380,7 @@ Style/FormatStringToken:
3260
3380
  MaxUnannotatedPlaceholdersAllowed: 1
3261
3381
  VersionAdded: '0.49'
3262
3382
  VersionChanged: '1.0'
3383
+ IgnoredMethods: []
3263
3384
 
3264
3385
  Style/FrozenStringLiteralComment:
3265
3386
  Description: >-
@@ -3321,6 +3442,13 @@ Style/HashAsLastArrayItem:
3321
3442
  - braces
3322
3443
  - no_braces
3323
3444
 
3445
+ Style/HashConversion:
3446
+ Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3447
+ Enabled: pending
3448
+ VersionAdded: '1.10'
3449
+ VersionChanged: '1.11'
3450
+ AllowSplatArgument: true
3451
+
3324
3452
  Style/HashEachMethods:
3325
3453
  Description: 'Use Hash#each_key and Hash#each_value.'
3326
3454
  StyleGuide: '#hash-each'
@@ -3328,6 +3456,13 @@ Style/HashEachMethods:
3328
3456
  VersionAdded: '0.80'
3329
3457
  Safe: false
3330
3458
 
3459
+ Style/HashExcept:
3460
+ Description: >-
3461
+ Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3462
+ that can be replaced with `Hash#except` method.
3463
+ Enabled: pending
3464
+ VersionAdded: '1.7'
3465
+
3331
3466
  Style/HashLikeCase:
3332
3467
  Description: >-
3333
3468
  Checks for places where `case-when` represents a simple 1:1
@@ -3406,6 +3541,14 @@ Style/IfUnlessModifierOfIfUnless:
3406
3541
  VersionAdded: '0.39'
3407
3542
  VersionChanged: '0.87'
3408
3543
 
3544
+ Style/IfWithBooleanLiteralBranches:
3545
+ Description: 'Checks for redundant `if` with boolean literal branches.'
3546
+ Enabled: pending
3547
+ VersionAdded: '1.9'
3548
+ SafeAutoCorrect: false
3549
+ AllowedMethods:
3550
+ - nonzero?
3551
+
3409
3552
  Style/IfWithSemicolon:
3410
3553
  Description: 'Do not use if x; .... Use the ternary operator instead.'
3411
3554
  StyleGuide: '#no-semicolon-ifs'
@@ -3482,6 +3625,7 @@ Style/KeywordParametersOrder:
3482
3625
  StyleGuide: '#keyword-parameters-order'
3483
3626
  Enabled: true
3484
3627
  VersionAdded: '0.90'
3628
+ VersionChanged: '1.7'
3485
3629
 
3486
3630
  Style/Lambda:
3487
3631
  Description: 'Use the new lambda literal syntax for single-line blocks.'
@@ -3520,7 +3664,7 @@ Style/MethodCallWithArgsParentheses:
3520
3664
  StyleGuide: '#method-invocation-parens'
3521
3665
  Enabled: false
3522
3666
  VersionAdded: '0.47'
3523
- VersionChanged: '0.61'
3667
+ VersionChanged: '1.7'
3524
3668
  IgnoreMacros: true
3525
3669
  IgnoredMethods: []
3526
3670
  IgnoredPatterns: []
@@ -3554,7 +3698,7 @@ Style/MethodDefParentheses:
3554
3698
  StyleGuide: '#method-parens'
3555
3699
  Enabled: true
3556
3700
  VersionAdded: '0.16'
3557
- VersionChanged: '0.35'
3701
+ VersionChanged: '1.7'
3558
3702
  EnforcedStyle: require_parentheses
3559
3703
  SupportedStyles:
3560
3704
  - require_parentheses
@@ -3660,6 +3804,7 @@ Style/MultilineMethodSignature:
3660
3804
  Description: 'Avoid multi-line method signatures.'
3661
3805
  Enabled: false
3662
3806
  VersionAdded: '0.59'
3807
+ VersionChanged: '1.7'
3663
3808
 
3664
3809
  Style/MultilineTernaryOperator:
3665
3810
  Description: >-
@@ -3688,7 +3833,8 @@ Style/MutableConstant:
3688
3833
  Description: 'Do not assign mutable objects to constants.'
3689
3834
  Enabled: true
3690
3835
  VersionAdded: '0.34'
3691
- VersionChanged: '0.65'
3836
+ VersionChanged: '1.8'
3837
+ SafeAutoCorrect: false
3692
3838
  EnforcedStyle: literals
3693
3839
  SupportedStyles:
3694
3840
  # literals: freeze literals assigned to constants
@@ -4026,12 +4172,16 @@ Style/RedundantArgument:
4026
4172
  Enabled: pending
4027
4173
  Safe: false
4028
4174
  VersionAdded: '1.4'
4029
- VersionChanged: '1.6'
4175
+ VersionChanged: '1.7'
4030
4176
  Methods:
4031
4177
  # Array#join
4032
4178
  join: ''
4033
4179
  # String#split
4034
4180
  split: ' '
4181
+ # String#chomp
4182
+ chomp: "\n"
4183
+ # String#chomp!
4184
+ chomp!: "\n"
4035
4185
 
4036
4186
  Style/RedundantAssignment:
4037
4187
  Description: 'Checks for redundant assignment before returning.'
@@ -4288,7 +4438,7 @@ Style/SingleLineMethods:
4288
4438
  StyleGuide: '#no-single-line-methods'
4289
4439
  Enabled: true
4290
4440
  VersionAdded: '0.9'
4291
- VersionChanged: '0.19'
4441
+ VersionChanged: '1.8'
4292
4442
  AllowIfMethodIsEmpty: true
4293
4443
 
4294
4444
  Style/SlicingWithRange:
@@ -4438,6 +4588,7 @@ Style/SymbolProc:
4438
4588
  Safe: false
4439
4589
  VersionAdded: '0.26'
4440
4590
  VersionChanged: '1.5'
4591
+ AllowMethodsWithArguments: false
4441
4592
  # A list of method names to be ignored by the check.
4442
4593
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4443
4594
  IgnoredMethods:
@@ -4590,6 +4741,16 @@ Style/UnlessElse:
4590
4741
  Enabled: true
4591
4742
  VersionAdded: '0.9'
4592
4743
 
4744
+ Style/UnlessLogicalOperators:
4745
+ Description: >-
4746
+ Checks for use of logical operators in an unless condition.
4747
+ Enabled: false
4748
+ VersionAdded: '1.11'
4749
+ EnforcedStyle: forbid_mixed_logical_operators
4750
+ SupportedStyles:
4751
+ - forbid_mixed_logical_operators
4752
+ - forbid_logical_operators
4753
+
4593
4754
  Style/UnpackFirst:
4594
4755
  Description: >-
4595
4756
  Checks for accessing the first element of `String#unpack`
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Chefstyle
3
- VERSION = "1.5.8"
4
- RUBOCOP_VERSION = "1.6.1"
5
- end
3
+ VERSION = "1.7.2"
4
+ RUBOCOP_VERSION = "1.11.0"
5
+ end
@@ -0,0 +1,55 @@
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
+ # All gemspec files should define their license.
24
+ #
25
+ # @example
26
+ #
27
+ # # good
28
+ # spec.license = "Apache-2.0"
29
+ #
30
+ class GemspecLicense < Base
31
+ include RangeHelp
32
+
33
+ MSG = "All gemspec files should define their license."
34
+
35
+ def_node_search :license, <<~PATTERN
36
+ (send _ {:license= :licenses=} _)
37
+ PATTERN
38
+
39
+ def_node_search :eval_method, <<~PATTERN
40
+ (send nil? {:eval :instance_eval} ... )
41
+ PATTERN
42
+
43
+ def on_new_investigation
44
+ # exit if we find a license statement or any eval since that usually happens
45
+ # when we have a windows platform gem that evals the main gemspec
46
+ return if license(processed_source.ast).first || eval_method(processed_source.ast).first
47
+
48
+ range = source_range(processed_source.buffer, 1, 0)
49
+ add_offense(range, message: MSG, severity: :warning)
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ 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.8
4
+ version: 1.7.2
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-12-21 00:00:00.000000000 Z
11
+ date: 2021-03-09 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.6.1
19
+ version: 1.11.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.6.1
26
+ version: 1.11.0
27
27
  description:
28
28
  email:
29
29
  - oss@chef.io
@@ -42,7 +42,9 @@ files:
42
42
  - lib/chefstyle.rb
43
43
  - lib/chefstyle/version.rb
44
44
  - lib/rubocop/chef.rb
45
+ - lib/rubocop/cop/chef/ruby/gemspec_license.rb
45
46
  - lib/rubocop/cop/chef/ruby/gemspec_require_rubygems.rb
47
+ - lib/rubocop/cop/chef/ruby/legacy_powershell_out_methods.rb
46
48
  - lib/rubocop/cop/chef/ruby/require_net_https.rb
47
49
  - lib/rubocop/cop/chef/ruby/ruby_27_keyword_argument_warnings.rb
48
50
  - lib/rubocop/cop/chef/ruby/unless_defined_require.rb
@@ -65,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
67
  - !ruby/object:Gem::Version
66
68
  version: '0'
67
69
  requirements: []
68
- rubygems_version: 3.0.3
70
+ rubygems_version: 3.1.4
69
71
  signing_key:
70
72
  specification_version: 4
71
73
  summary: RuboCop configuration for Chef's ruby projects