cookstyle 7.4.0 → 7.7.2

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: afe67bc1be4b70753843d22598cd29dd7edded20c3762230d4cbfb08ba2ed240
4
- data.tar.gz: f4f3c739c446a6560b8f9319c63b87dc48c2d338ad45316369a1ed848d40222a
3
+ metadata.gz: c26a8975b37722a6d4b7be270e87fc5e9a7ac499755b2401e8d3ec5dd8627c82
4
+ data.tar.gz: ed69abecf1251fd184ed42b16dcbc0f55bfb06201a98abfd05b6fd69f1812c26
5
5
  SHA512:
6
- metadata.gz: 64ec5f89be1438ba7e29f1e19e9f8b6ebbac1320550f5b32d2a5d58b7ea1994ed4fe08f1243a1328beb46acca4da67608d6ba4b0f3944487adc8af90f9e8fc5e
7
- data.tar.gz: 7b6118d966b9585555db7cd3d7b61114e5229a792d9bd9ee23e71a0330ca004187f8ca11cda4b6922c57007ddd0d8e57d30e925f957517dce27ee24532da7cfa
6
+ metadata.gz: 332eb06789dc7db421b6d38a8234557225e680725ce949a4d8727f1a613c1cd1bdbdd0cfba2ed09b7e60a7091c1296e505cbacef1b0d40f2acd29af1394a611b
7
+ data.tar.gz: 670702283e8aa31d186156ad809e60d262293b600381a5219c829ca3957a554002888883b74406a6b3f0091fc591265e1780a903fdc7cd353d3115f996c30620
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', '~> 0.4.0' # 0.5.0 drops support for Ruby < 2.6
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/bin/cookstyle CHANGED
@@ -12,8 +12,13 @@ unless ARGV.include?('--fail-level')
12
12
  ARGV << 'C'
13
13
  end
14
14
 
15
- # if only -v is passed we'll get 3 args (-v, --fail-level, and C)
16
- if ARGV.size == 3 && %w(-v --version).include?(ARGV.first)
15
+ # we want to link to our docs
16
+ unless ARGV.include?('--display-style-guide')
17
+ ARGV << '--display-style-guide'
18
+ end
19
+
20
+ # if only -v is passed we'll get 4 args (-v, --fail-level. --display-style-guide, and C)
21
+ if ARGV.size == 4 && %w(-v --version).include?(ARGV.first)
17
22
  puts "Cookstyle #{Cookstyle::VERSION}"
18
23
  print ' * RuboCop '
19
24
  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/TrailingBlankLines:
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
@@ -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 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
@@ -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.4'
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 error.'
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: '0.27'
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).'
@@ -3212,7 +3314,8 @@ Style/FloatDivision:
3212
3314
  Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3213
3315
  Enabled: true
3214
3316
  VersionAdded: '0.72'
3215
- VersionChanged: '1.6'
3317
+ VersionChanged: '1.9'
3318
+ Safe: false
3216
3319
  EnforcedStyle: single_coerce
3217
3320
  SupportedStyles:
3218
3321
  - left_coerce
@@ -3260,6 +3363,7 @@ Style/FormatStringToken:
3260
3363
  MaxUnannotatedPlaceholdersAllowed: 1
3261
3364
  VersionAdded: '0.49'
3262
3365
  VersionChanged: '1.0'
3366
+ IgnoredMethods: []
3263
3367
 
3264
3368
  Style/FrozenStringLiteralComment:
3265
3369
  Description: >-
@@ -3328,6 +3432,13 @@ Style/HashEachMethods:
3328
3432
  VersionAdded: '0.80'
3329
3433
  Safe: false
3330
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
+
3331
3442
  Style/HashLikeCase:
3332
3443
  Description: >-
3333
3444
  Checks for places where `case-when` represents a simple 1:1
@@ -3406,6 +3517,14 @@ Style/IfUnlessModifierOfIfUnless:
3406
3517
  VersionAdded: '0.39'
3407
3518
  VersionChanged: '0.87'
3408
3519
 
3520
+ Style/IfWithBooleanLiteralBranches:
3521
+ Description: 'Checks for redundant `if` with boolean literal branches.'
3522
+ Enabled: pending
3523
+ VersionAdded: '1.9'
3524
+ SafeAutoCorrect: false
3525
+ AllowedMethods:
3526
+ - nonzero?
3527
+
3409
3528
  Style/IfWithSemicolon:
3410
3529
  Description: 'Do not use if x; .... Use the ternary operator instead.'
3411
3530
  StyleGuide: '#no-semicolon-ifs'
@@ -3482,6 +3601,7 @@ Style/KeywordParametersOrder:
3482
3601
  StyleGuide: '#keyword-parameters-order'
3483
3602
  Enabled: true
3484
3603
  VersionAdded: '0.90'
3604
+ VersionChanged: '1.7'
3485
3605
 
3486
3606
  Style/Lambda:
3487
3607
  Description: 'Use the new lambda literal syntax for single-line blocks.'
@@ -3520,7 +3640,7 @@ Style/MethodCallWithArgsParentheses:
3520
3640
  StyleGuide: '#method-invocation-parens'
3521
3641
  Enabled: false
3522
3642
  VersionAdded: '0.47'
3523
- VersionChanged: '0.61'
3643
+ VersionChanged: '1.7'
3524
3644
  IgnoreMacros: true
3525
3645
  IgnoredMethods: []
3526
3646
  IgnoredPatterns: []
@@ -3554,7 +3674,7 @@ Style/MethodDefParentheses:
3554
3674
  StyleGuide: '#method-parens'
3555
3675
  Enabled: true
3556
3676
  VersionAdded: '0.16'
3557
- VersionChanged: '0.35'
3677
+ VersionChanged: '1.7'
3558
3678
  EnforcedStyle: require_parentheses
3559
3679
  SupportedStyles:
3560
3680
  - require_parentheses
@@ -3660,6 +3780,7 @@ Style/MultilineMethodSignature:
3660
3780
  Description: 'Avoid multi-line method signatures.'
3661
3781
  Enabled: false
3662
3782
  VersionAdded: '0.59'
3783
+ VersionChanged: '1.7'
3663
3784
 
3664
3785
  Style/MultilineTernaryOperator:
3665
3786
  Description: >-
@@ -3688,7 +3809,8 @@ Style/MutableConstant:
3688
3809
  Description: 'Do not assign mutable objects to constants.'
3689
3810
  Enabled: true
3690
3811
  VersionAdded: '0.34'
3691
- VersionChanged: '0.65'
3812
+ VersionChanged: '1.8'
3813
+ SafeAutoCorrect: false
3692
3814
  EnforcedStyle: literals
3693
3815
  SupportedStyles:
3694
3816
  # literals: freeze literals assigned to constants
@@ -4026,12 +4148,16 @@ Style/RedundantArgument:
4026
4148
  Enabled: pending
4027
4149
  Safe: false
4028
4150
  VersionAdded: '1.4'
4029
- VersionChanged: '1.6'
4151
+ VersionChanged: '1.7'
4030
4152
  Methods:
4031
4153
  # Array#join
4032
4154
  join: ''
4033
4155
  # String#split
4034
4156
  split: ' '
4157
+ # String#chomp
4158
+ chomp: "\n"
4159
+ # String#chomp!
4160
+ chomp!: "\n"
4035
4161
 
4036
4162
  Style/RedundantAssignment:
4037
4163
  Description: 'Checks for redundant assignment before returning.'
@@ -4288,7 +4414,7 @@ Style/SingleLineMethods:
4288
4414
  StyleGuide: '#no-single-line-methods'
4289
4415
  Enabled: true
4290
4416
  VersionAdded: '0.9'
4291
- VersionChanged: '0.19'
4417
+ VersionChanged: '1.8'
4292
4418
  AllowIfMethodIsEmpty: true
4293
4419
 
4294
4420
  Style/SlicingWithRange:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Cookstyle
3
- VERSION = "7.4.0" # rubocop: disable Style/StringLiterals
4
- RUBOCOP_VERSION = '1.6.1'
3
+ VERSION = "7.7.2" # rubocop: disable Style/StringLiterals
4
+ RUBOCOP_VERSION = '1.9.1'
5
5
  end
@@ -64,7 +64,7 @@ module RuboCop
64
64
  'opensuse' => {
65
65
  '< 14' => true,
66
66
  '~> 42.0' => true,
67
- '= 15.0' => '15',
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.6 ' => '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.6' => '7',
81
+ '~> 7.0, < 7.7' => '7',
82
82
  },
83
83
  'oracle' => {
84
84
  '< 6.0' => true,
@@ -74,7 +74,7 @@ module RuboCop
74
74
  when :str
75
75
  "'#{type.source}[#{name.value}]'"
76
76
  when :dstr
77
- "\"#{type.source}[#{name.value.source}]\""
77
+ "\"#{type.source}[#{name.value}]\""
78
78
  else
79
79
  "\"#{type.source}[\#{#{name.source}}]\""
80
80
  end
@@ -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
- (send nil? :property
52
- (sym :name)
53
- (const nil? :String)
54
- (hash
55
- (pair
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
- add_offense(node, message: MSG, severity: :refactor) do |corrector|
63
- corrector.remove(node.source_range)
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
@@ -49,4 +49,4 @@ module RuboCop
49
49
  end
50
50
  end
51
51
  end
52
- end
52
+ end
@@ -57,4 +57,4 @@ module RuboCop
57
57
  end
58
58
  end
59
59
  end
60
- end
60
+ end
@@ -31,11 +31,13 @@ module RuboCop
31
31
  # license 'Apache-2.0'
32
32
  # license 'all rights reserved'
33
33
  #
34
- # list of valid SPDX.org license strings. To build an array run this:
34
+ # list of valid SPDX.org license strings. To build an array run this ruby:
35
+ # ```ruby
35
36
  # require 'json'
36
37
  # require 'net/http'
37
38
  # json_data = JSON.parse(Net::HTTP.get(URI('https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json')))
38
39
  # licenses = json_data['licenses'].map {|l| l['licenseId'] }.sort
40
+ # ```
39
41
  #
40
42
  class InvalidLicenseString < Base
41
43
  extend AutoCorrector
@@ -59,6 +61,7 @@ module RuboCop
59
61
  AML
60
62
  AMPAS
61
63
  ANTLR-PD
64
+ ANTLR-PD-fallback
62
65
  APAFML
63
66
  APL-1.0
64
67
  APSL-1.0
@@ -82,6 +85,7 @@ module RuboCop
82
85
  BSD-2-Clause-FreeBSD
83
86
  BSD-2-Clause-NetBSD
84
87
  BSD-2-Clause-Patent
88
+ BSD-2-Clause-Views
85
89
  BSD-3-Clause
86
90
  BSD-3-Clause-Attribution
87
91
  BSD-3-Clause-Clear
@@ -95,6 +99,7 @@ module RuboCop
95
99
  BSD-Protection
96
100
  BSD-Source-Code
97
101
  BSL-1.0
102
+ BUSL-1.1
98
103
  Bahyph
99
104
  Barr
100
105
  Beerware
@@ -102,11 +107,15 @@ module RuboCop
102
107
  BitTorrent-1.1
103
108
  BlueOak-1.0.0
104
109
  Borceux
110
+ CAL-1.0
111
+ CAL-1.0-Combined-Work-Exception
105
112
  CATOSL-1.1
106
113
  CC-BY-1.0
107
114
  CC-BY-2.0
108
115
  CC-BY-2.5
109
116
  CC-BY-3.0
117
+ CC-BY-3.0-AT
118
+ CC-BY-3.0-US
110
119
  CC-BY-4.0
111
120
  CC-BY-NC-1.0
112
121
  CC-BY-NC-2.0
@@ -117,6 +126,7 @@ module RuboCop
117
126
  CC-BY-NC-ND-2.0
118
127
  CC-BY-NC-ND-2.5
119
128
  CC-BY-NC-ND-3.0
129
+ CC-BY-NC-ND-3.0-IGO
120
130
  CC-BY-NC-ND-4.0
121
131
  CC-BY-NC-SA-1.0
122
132
  CC-BY-NC-SA-2.0
@@ -130,8 +140,10 @@ module RuboCop
130
140
  CC-BY-ND-4.0
131
141
  CC-BY-SA-1.0
132
142
  CC-BY-SA-2.0
143
+ CC-BY-SA-2.0-UK
133
144
  CC-BY-SA-2.5
134
145
  CC-BY-SA-3.0
146
+ CC-BY-SA-3.0-AT
135
147
  CC-BY-SA-4.0
136
148
  CC-PDDC
137
149
  CC0-1.0
@@ -147,6 +159,9 @@ module RuboCop
147
159
  CECILL-C
148
160
  CERN-OHL-1.1
149
161
  CERN-OHL-1.2
162
+ CERN-OHL-P-2.0
163
+ CERN-OHL-S-2.0
164
+ CERN-OHL-W-2.0
150
165
  CNRI-Jython
151
166
  CNRI-Python
152
167
  CNRI-Python-GPL-Compatible
@@ -168,6 +183,7 @@ module RuboCop
168
183
  ECL-2.0
169
184
  EFL-1.0
170
185
  EFL-2.0
186
+ EPICS
171
187
  EPL-1.0
172
188
  EPL-2.0
173
189
  EUDatagrid
@@ -185,15 +201,28 @@ module RuboCop
185
201
  Frameworx-1.0
186
202
  FreeImage
187
203
  GFDL-1.1
204
+ GFDL-1.1-invariants-only
205
+ GFDL-1.1-invariants-or-later
206
+ GFDL-1.1-no-invariants-only
207
+ GFDL-1.1-no-invariants-or-later
188
208
  GFDL-1.1-only
189
209
  GFDL-1.1-or-later
190
210
  GFDL-1.2
211
+ GFDL-1.2-invariants-only
212
+ GFDL-1.2-invariants-or-later
213
+ GFDL-1.2-no-invariants-only
214
+ GFDL-1.2-no-invariants-or-later
191
215
  GFDL-1.2-only
192
216
  GFDL-1.2-or-later
193
217
  GFDL-1.3
218
+ GFDL-1.3-invariants-only
219
+ GFDL-1.3-invariants-or-later
220
+ GFDL-1.3-no-invariants-only
221
+ GFDL-1.3-no-invariants-or-later
194
222
  GFDL-1.3-only
195
223
  GFDL-1.3-or-later
196
224
  GL2PS
225
+ GLWTPL
197
226
  GPL-1.0
198
227
  GPL-1.0+
199
228
  GPL-1.0-only
@@ -218,7 +247,9 @@ module RuboCop
218
247
  Glulxe
219
248
  HPND
220
249
  HPND-sell-variant
250
+ HTMLTIDY
221
251
  HaskellReport
252
+ Hippocratic-2.1
222
253
  IBM-pibs
223
254
  ICU
224
255
  IJG
@@ -269,6 +300,7 @@ module RuboCop
269
300
  MIT-advertising
270
301
  MIT-enna
271
302
  MIT-feh
303
+ MIT-open-group
272
304
  MITNFA
273
305
  MPL-1.0
274
306
  MPL-1.1
@@ -280,12 +312,17 @@ module RuboCop
280
312
  MakeIndex
281
313
  MirOS
282
314
  Motosoto
315
+ MulanPSL-1.0
316
+ MulanPSL-2.0
283
317
  Multics
284
318
  Mup
285
319
  NASA-1.3
286
320
  NBPL-1.0
321
+ NCGL-UK-2.0
287
322
  NCSA
288
323
  NGPL
324
+ NIST-PD
325
+ NIST-PD-fallback
289
326
  NLOD-1.0
290
327
  NLPL
291
328
  NOSL
@@ -294,6 +331,7 @@ module RuboCop
294
331
  NPOSL-3.0
295
332
  NRL
296
333
  NTP
334
+ NTP-0
297
335
  Naumen
298
336
  Net-SNMP
299
337
  NetCDF
@@ -301,12 +339,19 @@ module RuboCop
301
339
  Nokia
302
340
  Noweb
303
341
  Nunit
342
+ O-UDA-1.0
304
343
  OCCT-PL
305
344
  OCLC-2.0
306
345
  ODC-By-1.0
307
346
  ODbL-1.0
308
347
  OFL-1.0
348
+ OFL-1.0-RFN
349
+ OFL-1.0-no-RFN
309
350
  OFL-1.1
351
+ OFL-1.1-RFN
352
+ OFL-1.1-no-RFN
353
+ OGC-1.0
354
+ OGL-Canada-2.0
310
355
  OGL-UK-1.0
311
356
  OGL-UK-2.0
312
357
  OGL-UK-3.0
@@ -339,8 +384,12 @@ module RuboCop
339
384
  PDDL-1.0
340
385
  PHP-3.0
341
386
  PHP-3.01
387
+ PSF-2.0
342
388
  Parity-6.0.0
389
+ Parity-7.0.0
343
390
  Plexus
391
+ PolyForm-Noncommercial-1.0.0
392
+ PolyForm-Small-Business-1.0.0
344
393
  PostgreSQL
345
394
  Python-2.0
346
395
  QPL-1.0
@@ -366,6 +415,8 @@ module RuboCop
366
415
  SMPPL
367
416
  SNIA
368
417
  SPL-1.0
418
+ SSH-OpenSSH
419
+ SSH-short
369
420
  SSPL-1.0
370
421
  SWL
371
422
  Saxpath
@@ -386,6 +437,7 @@ module RuboCop
386
437
  TOSL
387
438
  TU-Berlin-1.0
388
439
  TU-Berlin-2.0
440
+ UCL-1.0
389
441
  UPL-1.0
390
442
  Unicode-DFS-2015
391
443
  Unicode-DFS-2016
@@ -425,10 +477,12 @@ module RuboCop
425
477
  dvipdfm
426
478
  eCos-2.0
427
479
  eGenix
480
+ etalab-2.0
428
481
  gSOAP-1.3b
429
482
  gnuplot
430
483
  iMatix
431
484
  libpng-2.0
485
+ libselinux-1.0
432
486
  libtiff
433
487
  mpich2
434
488
  psfrag
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.0
4
+ version: 7.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thom May
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-12-21 00:00:00.000000000 Z
12
+ date: 2021-02-01 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.6.1
20
+ version: 1.9.1
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.6.1
27
+ version: 1.9.1
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.0.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