cookstyle 7.24.1 → 7.25.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -4
- data/config/cookstyle.yml +18 -0
- data/config/disable_all.yml +21 -1
- data/config/upstream.yml +105 -19
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/metadata_missing_version.rb +48 -0
- data/lib/rubocop/cop/chef/modernize/class_eval_action_class.rb +0 -1
- data/lib/rubocop/cop/chef/modernize/declare_action_class.rb +54 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e30d9d9b8eccc5de1ad1388d9c1a559c2413230a00163d0026ba388700838b4
|
4
|
+
data.tar.gz: 73771bda8cc6688d7fd67a66e22b8123bd276caccff733e30cff50629cfc4e9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c7b27f9a3c82fa49af42bbbce0af3313c39c2908c2a2d4e880a1f7af375a08cdba58f5413e41a5e4147c72ee5b4e5eb4d329d559ff68c6f995b1db804495b36
|
7
|
+
data.tar.gz: 6de5a48637e077f9ba4c2570fa6c6e6034c44501bbd4a8d8be75a26d5e174f720d65e2bb4d6dc00326248daa1b9d21b14ac76183ae9bfdc6108b2c010c732f61
|
data/Gemfile
CHANGED
@@ -6,8 +6,6 @@ gemspec
|
|
6
6
|
|
7
7
|
group :debug do
|
8
8
|
gem 'pry'
|
9
|
-
gem 'pry-byebug'
|
10
|
-
gem 'pry-stack_explorer', '<= 0.4.13' # 0.4.13+ drops support for Ruby < 2.6
|
11
9
|
end
|
12
10
|
|
13
11
|
group :docs do
|
@@ -15,8 +13,10 @@ group :docs do
|
|
15
13
|
end
|
16
14
|
|
17
15
|
group :profiling do
|
18
|
-
|
19
|
-
|
16
|
+
platforms :ruby do
|
17
|
+
gem 'memory_profiler'
|
18
|
+
gem 'stackprof'
|
19
|
+
end
|
20
20
|
end
|
21
21
|
|
22
22
|
group :rubocop_gems do
|
data/config/cookstyle.yml
CHANGED
@@ -498,6 +498,14 @@ Chef/Correctness/PowershellFileExists:
|
|
498
498
|
- '**/metadata.rb'
|
499
499
|
- '**/Berksfile'
|
500
500
|
|
501
|
+
Chef/Correctness/MetadataMissingVersion:
|
502
|
+
Description: metadata.rb should define a version for the cookbook.
|
503
|
+
StyleGuide: 'chef_correctness_metadatamissingversion'
|
504
|
+
Enabled: true
|
505
|
+
VersionAdded: '7.25'
|
506
|
+
Include:
|
507
|
+
- '**/metadata.rb'
|
508
|
+
|
501
509
|
###############################
|
502
510
|
# Chef/Sharing: Issues that prevent sharing code with other teams or with the Chef community in general
|
503
511
|
###############################
|
@@ -1933,6 +1941,15 @@ Chef/Modernize/UseChefLanguageSystemdHelper:
|
|
1933
1941
|
- '**/metadata.rb'
|
1934
1942
|
- '**/Berksfile'
|
1935
1943
|
|
1944
|
+
Chef/Modernize/DeclareActionClass:
|
1945
|
+
Description: In Chef Infra Client 12.9 and later `action_class` can be used instead of `declare_action_class`.
|
1946
|
+
StyleGuide: 'chef_modernize_declareactionclass'
|
1947
|
+
Enabled: true
|
1948
|
+
VersionAdded: '7.26.0'
|
1949
|
+
Include:
|
1950
|
+
- '**/resources/*.rb'
|
1951
|
+
- '**/libraries/*.rb'
|
1952
|
+
|
1936
1953
|
###############################
|
1937
1954
|
# Chef/RedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
|
1938
1955
|
###############################
|
@@ -2805,6 +2822,7 @@ Style/GuardClause:
|
|
2805
2822
|
# Users really shouldn't have a gem, but if they do they should do it securely
|
2806
2823
|
Bundler/InsecureProtocolSource:
|
2807
2824
|
Enabled: true
|
2825
|
+
AllowHttpProtocol: false
|
2808
2826
|
|
2809
2827
|
# It's easier to read a simple .each and they're faster
|
2810
2828
|
Lint/RedundantWithIndex:
|
data/config/disable_all.yml
CHANGED
@@ -19,6 +19,8 @@ Gemspec/DuplicatedAssignment:
|
|
19
19
|
Enabled: false
|
20
20
|
Gemspec/OrderedDependencies:
|
21
21
|
Enabled: false
|
22
|
+
Gemspec/RequireMFA:
|
23
|
+
Enabled: false
|
22
24
|
Gemspec/RequiredRubyVersion:
|
23
25
|
Enabled: false
|
24
26
|
Gemspec/RubyVersionGlobalsUsage:
|
@@ -221,6 +223,8 @@ Lint/AmbiguousBlockAssociation:
|
|
221
223
|
Enabled: false
|
222
224
|
Lint/AmbiguousOperator:
|
223
225
|
Enabled: false
|
226
|
+
Lint/AmbiguousOperatorPrecedence:
|
227
|
+
Enabled: false
|
224
228
|
Lint/AmbiguousRange:
|
225
229
|
Enabled: false
|
226
230
|
Lint/AmbiguousRegexpLiteral:
|
@@ -307,10 +311,12 @@ Lint/IdentityComparison:
|
|
307
311
|
Enabled: false
|
308
312
|
Lint/ImplicitStringConcatenation:
|
309
313
|
Enabled: false
|
310
|
-
Lint/
|
314
|
+
Lint/IncompatibleIoSelectWithFiberScheduler:
|
311
315
|
Enabled: false
|
312
316
|
Lint/IneffectiveAccessModifier:
|
313
317
|
Enabled: false
|
318
|
+
Lint/InheritException:
|
319
|
+
Enabled: false
|
314
320
|
Lint/InterpolationCheck:
|
315
321
|
Enabled: false
|
316
322
|
Lint/LambdaWithoutLiteralBlock:
|
@@ -383,6 +389,8 @@ Lint/RegexpAsCondition:
|
|
383
389
|
Enabled: false
|
384
390
|
Lint/RequireParentheses:
|
385
391
|
Enabled: false
|
392
|
+
Lint/RequireRelativeSelfPath:
|
393
|
+
Enabled: false
|
386
394
|
Lint/RescueException:
|
387
395
|
Enabled: false
|
388
396
|
Lint/RescueType:
|
@@ -453,6 +461,8 @@ Lint/UselessElseWithoutRescue:
|
|
453
461
|
Enabled: false
|
454
462
|
Lint/UselessMethodDefinition:
|
455
463
|
Enabled: false
|
464
|
+
Lint/UselessRuby2Keywords:
|
465
|
+
Enabled: false
|
456
466
|
Lint/UselessSetterCall:
|
457
467
|
Enabled: false
|
458
468
|
Lint/UselessTimes:
|
@@ -701,6 +711,10 @@ Style/MethodCallWithArgsParentheses:
|
|
701
711
|
Enabled: false
|
702
712
|
Style/MultilineInPatternThen:
|
703
713
|
Enabled: false
|
714
|
+
Style/NumberedParameters:
|
715
|
+
Enabled: false
|
716
|
+
Style/OpenStructUse:
|
717
|
+
Enabled: false
|
704
718
|
Style/RedundantAssignment:
|
705
719
|
Enabled: false
|
706
720
|
Style/RedundantFetchBlock:
|
@@ -773,6 +787,8 @@ Style/NonNilCheck:
|
|
773
787
|
Enabled: false
|
774
788
|
Style/Not:
|
775
789
|
Enabled: false
|
790
|
+
Style/NumberedParametersLimit:
|
791
|
+
Enabled: false
|
776
792
|
Style/NumericLiterals:
|
777
793
|
Enabled: false
|
778
794
|
Style/NumericLiteralPrefix:
|
@@ -853,6 +869,8 @@ Style/SafeNavigation:
|
|
853
869
|
Enabled: false
|
854
870
|
Style/Sample:
|
855
871
|
Enabled: false
|
872
|
+
Style/SelectByRegexp:
|
873
|
+
Enabled: false
|
856
874
|
Style/SelfAssignment:
|
857
875
|
Enabled: false
|
858
876
|
Style/Semicolon:
|
@@ -945,6 +963,8 @@ Style/ZeroLengthPredicate:
|
|
945
963
|
Enabled: false
|
946
964
|
Security/Eval:
|
947
965
|
Enabled: false
|
966
|
+
Security/IoMethods:
|
967
|
+
Enabled: false
|
948
968
|
Security/JSONLoad:
|
949
969
|
Enabled: false
|
950
970
|
Security/MarshalLoad:
|
data/config/upstream.yml
CHANGED
@@ -130,7 +130,7 @@ AllCops:
|
|
130
130
|
# What MRI version of the Ruby interpreter is the inspected code intended to
|
131
131
|
# run on? (If there is more than one, set this to the lowest version.)
|
132
132
|
# If a value is specified for TargetRubyVersion then it is used. Acceptable
|
133
|
-
# values are
|
133
|
+
# values are specified as a float (i.e. 3.0); the teeny version of Ruby
|
134
134
|
# should not be included. If the project specifies a Ruby version in the
|
135
135
|
# .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
|
136
136
|
# try to determine the desired version of Ruby by inspecting the
|
@@ -150,6 +150,7 @@ AllCops:
|
|
150
150
|
rubocop-minitest: [minitest]
|
151
151
|
rubocop-sequel: [sequel]
|
152
152
|
rubocop-rake: [rake]
|
153
|
+
rubocop-graphql: [graphql]
|
153
154
|
|
154
155
|
#################### Bundler ###############################
|
155
156
|
|
@@ -209,6 +210,7 @@ Bundler/InsecureProtocolSource:
|
|
209
210
|
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
|
210
211
|
Enabled: true
|
211
212
|
VersionAdded: '0.50'
|
213
|
+
AllowHttpProtocol: true
|
212
214
|
Include:
|
213
215
|
- '**/*.gemfile'
|
214
216
|
- '**/Gemfile'
|
@@ -257,11 +259,20 @@ Gemspec/OrderedDependencies:
|
|
257
259
|
Include:
|
258
260
|
- '**/*.gemspec'
|
259
261
|
|
262
|
+
Gemspec/RequireMFA:
|
263
|
+
Description: 'Checks that the gemspec has metadata to require MFA from RubyGems.'
|
264
|
+
Enabled: pending
|
265
|
+
VersionAdded: '1.23'
|
266
|
+
Reference:
|
267
|
+
- https://guides.rubygems.org/mfa-requirement-opt-in/
|
268
|
+
Include:
|
269
|
+
- '**/*.gemspec'
|
270
|
+
|
260
271
|
Gemspec/RequiredRubyVersion:
|
261
272
|
Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
|
262
273
|
Enabled: true
|
263
274
|
VersionAdded: '0.52'
|
264
|
-
VersionChanged: '
|
275
|
+
VersionChanged: '1.22'
|
265
276
|
Include:
|
266
277
|
- '**/*.gemspec'
|
267
278
|
|
@@ -510,13 +521,13 @@ Layout/EmptyLineBetweenDefs:
|
|
510
521
|
StyleGuide: '#empty-lines-between-methods'
|
511
522
|
Enabled: true
|
512
523
|
VersionAdded: '0.49'
|
513
|
-
VersionChanged: '1.
|
524
|
+
VersionChanged: '1.23'
|
514
525
|
EmptyLineBetweenMethodDefs: true
|
515
526
|
EmptyLineBetweenClassDefs: true
|
516
527
|
EmptyLineBetweenModuleDefs: true
|
517
|
-
#
|
518
|
-
# need an empty line between them.
|
519
|
-
AllowAdjacentOneLineDefs:
|
528
|
+
# `AllowAdjacentOneLineDefs` means that single line method definitions don't
|
529
|
+
# need an empty line between them. `true` by default.
|
530
|
+
AllowAdjacentOneLineDefs: true
|
520
531
|
# Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
|
521
532
|
NumberOfEmptyLines: 1
|
522
533
|
|
@@ -957,7 +968,6 @@ Layout/LineLength:
|
|
957
968
|
Enabled: true
|
958
969
|
VersionAdded: '0.25'
|
959
970
|
VersionChanged: '1.4'
|
960
|
-
AutoCorrect: true
|
961
971
|
Max: 120
|
962
972
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
963
973
|
# containing a URI to be longer than Max.
|
@@ -1361,10 +1371,11 @@ Layout/SpaceInsideParens:
|
|
1361
1371
|
StyleGuide: '#spaces-braces'
|
1362
1372
|
Enabled: true
|
1363
1373
|
VersionAdded: '0.49'
|
1364
|
-
VersionChanged: '
|
1374
|
+
VersionChanged: '1.22'
|
1365
1375
|
EnforcedStyle: no_space
|
1366
1376
|
SupportedStyles:
|
1367
1377
|
- space
|
1378
|
+
- compact
|
1368
1379
|
- no_space
|
1369
1380
|
|
1370
1381
|
Layout/SpaceInsidePercentLiteralDelimiters:
|
@@ -1448,6 +1459,13 @@ Lint/AmbiguousOperator:
|
|
1448
1459
|
VersionAdded: '0.17'
|
1449
1460
|
VersionChanged: '0.83'
|
1450
1461
|
|
1462
|
+
Lint/AmbiguousOperatorPrecedence:
|
1463
|
+
Description: >-
|
1464
|
+
Checks for expressions containing multiple binary operations with
|
1465
|
+
ambiguous precedence.
|
1466
|
+
Enabled: pending
|
1467
|
+
VersionAdded: '1.21'
|
1468
|
+
|
1451
1469
|
Lint/AmbiguousRange:
|
1452
1470
|
Description: Checks for ranges with ambiguous boundaries.
|
1453
1471
|
Enabled: pending
|
@@ -1485,9 +1503,9 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
1485
1503
|
Lint/BooleanSymbol:
|
1486
1504
|
Description: 'Check for `:true` and `:false` symbols.'
|
1487
1505
|
Enabled: true
|
1488
|
-
|
1506
|
+
SafeAutoCorrect: false
|
1489
1507
|
VersionAdded: '0.50'
|
1490
|
-
VersionChanged: '
|
1508
|
+
VersionChanged: '1.22'
|
1491
1509
|
|
1492
1510
|
Lint/CircularArgumentReference:
|
1493
1511
|
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
|
@@ -1560,6 +1578,7 @@ Lint/DeprecatedConstants:
|
|
1560
1578
|
Description: 'Checks for deprecated constants.'
|
1561
1579
|
Enabled: pending
|
1562
1580
|
VersionAdded: '1.8'
|
1581
|
+
VersionChanged: '1.22'
|
1563
1582
|
# You can configure deprecated constants.
|
1564
1583
|
# If there is an alternative method, you can set alternative value as `Alternative`.
|
1565
1584
|
# And you can set the deprecated version as `DeprecatedVersion`.
|
@@ -1580,6 +1599,9 @@ Lint/DeprecatedConstants:
|
|
1580
1599
|
'FALSE':
|
1581
1600
|
Alternative: 'false'
|
1582
1601
|
DeprecatedVersion: '2.4'
|
1602
|
+
'Net::HTTPServerException':
|
1603
|
+
Alternative: 'Net::HTTPClientException'
|
1604
|
+
DeprecatedVersion: '2.6'
|
1583
1605
|
'Random::DEFAULT':
|
1584
1606
|
Alternative: 'Random.new'
|
1585
1607
|
DeprecatedVersion: '3.0'
|
@@ -1771,6 +1793,11 @@ Lint/ImplicitStringConcatenation:
|
|
1771
1793
|
Enabled: true
|
1772
1794
|
VersionAdded: '0.36'
|
1773
1795
|
|
1796
|
+
Lint/IncompatibleIoSelectWithFiberScheduler:
|
1797
|
+
Description: 'Checks for `IO.select` that is incompatible with Fiber Scheduler.'
|
1798
|
+
Enabled: pending
|
1799
|
+
VersionAdded: '1.21'
|
1800
|
+
|
1774
1801
|
Lint/IneffectiveAccessModifier:
|
1775
1802
|
Description: >-
|
1776
1803
|
Checks for attempts to use `private` or `protected` to set
|
@@ -2034,6 +2061,11 @@ Lint/RequireParentheses:
|
|
2034
2061
|
Enabled: true
|
2035
2062
|
VersionAdded: '0.18'
|
2036
2063
|
|
2064
|
+
Lint/RequireRelativeSelfPath:
|
2065
|
+
Description: 'Checks for uses a file requiring itself with `require_relative`.'
|
2066
|
+
Enabled: pending
|
2067
|
+
VersionAdded: '1.22'
|
2068
|
+
|
2037
2069
|
Lint/RescueException:
|
2038
2070
|
Description: 'Avoid rescuing the Exception class.'
|
2039
2071
|
StyleGuide: '#no-blind-rescues'
|
@@ -2286,6 +2318,11 @@ Lint/UselessMethodDefinition:
|
|
2286
2318
|
Safe: false
|
2287
2319
|
AllowComments: true
|
2288
2320
|
|
2321
|
+
Lint/UselessRuby2Keywords:
|
2322
|
+
Description: 'Finds unnecessary uses of `ruby2_keywords`.'
|
2323
|
+
Enabled: pending
|
2324
|
+
VersionAdded: '1.23'
|
2325
|
+
|
2289
2326
|
Lint/UselessSetterCall:
|
2290
2327
|
Description: 'Checks for useless setter call to a local variable.'
|
2291
2328
|
Enabled: true
|
@@ -2479,6 +2516,7 @@ Naming/FileName:
|
|
2479
2516
|
StyleGuide: '#snake-case-files'
|
2480
2517
|
Enabled: true
|
2481
2518
|
VersionAdded: '0.50'
|
2519
|
+
VersionChanged: '1.23'
|
2482
2520
|
# Camel case file names listed in `AllCops:Include` and all file names listed
|
2483
2521
|
# in `AllCops:Exclude` are excluded by default. Add extra excludes here.
|
2484
2522
|
Exclude: []
|
@@ -2491,6 +2529,13 @@ Naming/FileName:
|
|
2491
2529
|
# whether each source file's class or module name matches the file name --
|
2492
2530
|
# not whether the nested module hierarchy matches the subdirectory path.
|
2493
2531
|
CheckDefinitionPathHierarchy: true
|
2532
|
+
# paths that are considered root directories, for example "lib" in most ruby projects
|
2533
|
+
# or "app/models" in rails projects
|
2534
|
+
CheckDefinitionPathHierarchyRoots:
|
2535
|
+
- lib
|
2536
|
+
- spec
|
2537
|
+
- test
|
2538
|
+
- src
|
2494
2539
|
# If non-`nil`, expect all source file names to match the following regex.
|
2495
2540
|
# Only the file name itself is matched, not the entire file path.
|
2496
2541
|
# Use anchors as necessary if you want to match the entire name rather than
|
@@ -2563,8 +2608,9 @@ Naming/HeredocDelimiterNaming:
|
|
2563
2608
|
|
2564
2609
|
Naming/InclusiveLanguage:
|
2565
2610
|
Description: 'Recommend the use of inclusive language instead of problematic terms.'
|
2566
|
-
Enabled:
|
2611
|
+
Enabled: false
|
2567
2612
|
VersionAdded: '1.18'
|
2613
|
+
VersionChanged: '1.21'
|
2568
2614
|
CheckIdentifiers: true
|
2569
2615
|
CheckConstants: true
|
2570
2616
|
CheckVariables: true
|
@@ -2720,6 +2766,14 @@ Security/Eval:
|
|
2720
2766
|
Enabled: true
|
2721
2767
|
VersionAdded: '0.47'
|
2722
2768
|
|
2769
|
+
Security/IoMethods:
|
2770
|
+
Description: >-
|
2771
|
+
Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`, `IO.binwrite`,
|
2772
|
+
`IO.foreach`, and `IO.readlines`.
|
2773
|
+
Enabled: pending
|
2774
|
+
Safe: false
|
2775
|
+
VersionAdded: '1.22'
|
2776
|
+
|
2723
2777
|
Security/JSONLoad:
|
2724
2778
|
Description: >-
|
2725
2779
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
@@ -2727,10 +2781,9 @@ Security/JSONLoad:
|
|
2727
2781
|
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2728
2782
|
Enabled: true
|
2729
2783
|
VersionAdded: '0.43'
|
2730
|
-
VersionChanged: '
|
2784
|
+
VersionChanged: '1.22'
|
2731
2785
|
# Autocorrect here will change to a method that may cause crashes depending
|
2732
2786
|
# on the value of the argument.
|
2733
|
-
AutoCorrect: false
|
2734
2787
|
SafeAutoCorrect: false
|
2735
2788
|
|
2736
2789
|
Security/MarshalLoad:
|
@@ -2796,8 +2849,9 @@ Style/AndOr:
|
|
2796
2849
|
Description: 'Use &&/|| instead of and/or.'
|
2797
2850
|
StyleGuide: '#no-and-or-or'
|
2798
2851
|
Enabled: true
|
2852
|
+
SafeAutoCorrect: false
|
2799
2853
|
VersionAdded: '0.9'
|
2800
|
-
VersionChanged: '
|
2854
|
+
VersionChanged: '1.21'
|
2801
2855
|
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
2802
2856
|
# or completely (always).
|
2803
2857
|
EnforcedStyle: conditionals
|
@@ -2831,9 +2885,9 @@ Style/ArrayJoin:
|
|
2831
2885
|
Style/AsciiComments:
|
2832
2886
|
Description: 'Use only ascii symbols in comments.'
|
2833
2887
|
StyleGuide: '#english-comments'
|
2834
|
-
Enabled:
|
2888
|
+
Enabled: false
|
2835
2889
|
VersionAdded: '0.9'
|
2836
|
-
VersionChanged: '
|
2890
|
+
VersionChanged: '1.21'
|
2837
2891
|
AllowedChars:
|
2838
2892
|
- ©
|
2839
2893
|
|
@@ -2995,7 +3049,7 @@ Style/CaseEquality:
|
|
2995
3049
|
Enabled: true
|
2996
3050
|
VersionAdded: '0.9'
|
2997
3051
|
VersionChanged: '0.89'
|
2998
|
-
# If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
|
3052
|
+
# If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
|
2999
3053
|
# the case equality operator is a constant.
|
3000
3054
|
#
|
3001
3055
|
# # bad
|
@@ -3690,7 +3744,7 @@ Style/InPatternThen:
|
|
3690
3744
|
Style/InfiniteLoop:
|
3691
3745
|
Description: >-
|
3692
3746
|
Use Kernel#loop for infinite loops.
|
3693
|
-
This cop is unsafe
|
3747
|
+
This cop is unsafe if the body may raise a `StopIteration` exception.
|
3694
3748
|
Safe: false
|
3695
3749
|
StyleGuide: '#infinite-loop'
|
3696
3750
|
Enabled: true
|
@@ -4116,6 +4170,21 @@ Style/Not:
|
|
4116
4170
|
VersionAdded: '0.9'
|
4117
4171
|
VersionChanged: '0.20'
|
4118
4172
|
|
4173
|
+
Style/NumberedParameters:
|
4174
|
+
Description: 'Restrict the usage of numbered parameters.'
|
4175
|
+
Enabled: pending
|
4176
|
+
VersionAdded: '1.22'
|
4177
|
+
EnforcedStyle: allow_single_line
|
4178
|
+
SupportedStyles:
|
4179
|
+
- allow_single_line
|
4180
|
+
- disallow
|
4181
|
+
|
4182
|
+
Style/NumberedParametersLimit:
|
4183
|
+
Description: 'Avoid excessive numbered params in a single block.'
|
4184
|
+
Enabled: pending
|
4185
|
+
VersionAdded: '1.22'
|
4186
|
+
Max: 1
|
4187
|
+
|
4119
4188
|
Style/NumericLiteralPrefix:
|
4120
4189
|
Description: 'Use smallcase prefixes for numeric literals.'
|
4121
4190
|
StyleGuide: '#numeric-literal-prefixes'
|
@@ -4126,7 +4195,6 @@ Style/NumericLiteralPrefix:
|
|
4126
4195
|
- zero_with_o
|
4127
4196
|
- zero_only
|
4128
4197
|
|
4129
|
-
|
4130
4198
|
Style/NumericLiterals:
|
4131
4199
|
Description: >-
|
4132
4200
|
Add underscores to large numeric literals to improve their
|
@@ -4171,6 +4239,16 @@ Style/OneLineConditional:
|
|
4171
4239
|
VersionAdded: '0.9'
|
4172
4240
|
VersionChanged: '0.90'
|
4173
4241
|
|
4242
|
+
Style/OpenStructUse:
|
4243
|
+
Description: >-
|
4244
|
+
Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
|
4245
|
+
version compatibility, and potential security issues.
|
4246
|
+
Reference:
|
4247
|
+
- https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
4248
|
+
|
4249
|
+
Enabled: pending
|
4250
|
+
VersionAdded: '1.23'
|
4251
|
+
|
4174
4252
|
Style/OptionHash:
|
4175
4253
|
Description: "Don't use option hashes when you can use keyword arguments."
|
4176
4254
|
Enabled: false
|
@@ -4447,6 +4525,8 @@ Style/RedundantSort:
|
|
4447
4525
|
`max_by` instead of `sort_by...last`, etc.
|
4448
4526
|
Enabled: true
|
4449
4527
|
VersionAdded: '0.76'
|
4528
|
+
VersionChanged: '1.22'
|
4529
|
+
Safe: false
|
4450
4530
|
|
4451
4531
|
Style/RedundantSortBy:
|
4452
4532
|
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
@@ -4527,6 +4607,12 @@ Style/Sample:
|
|
4527
4607
|
Enabled: true
|
4528
4608
|
VersionAdded: '0.30'
|
4529
4609
|
|
4610
|
+
Style/SelectByRegexp:
|
4611
|
+
Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
|
4612
|
+
Enabled: pending
|
4613
|
+
SafeAutoCorrect: false
|
4614
|
+
VersionAdded: '1.22'
|
4615
|
+
|
4530
4616
|
Style/SelfAssignment:
|
4531
4617
|
Description: >-
|
4532
4618
|
Checks for places where self-assignment shorthand should have
|
data/lib/cookstyle/version.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Copyright:: 2021, 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
|
+
module RuboCop
|
19
|
+
module Cop
|
20
|
+
module Chef
|
21
|
+
module Correctness
|
22
|
+
# metadata.rb should define a version for the cookbook.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
#
|
26
|
+
# #### correct
|
27
|
+
# name 'foo'
|
28
|
+
# version '1.0.0'
|
29
|
+
#
|
30
|
+
class MetadataMissingVersion < Base
|
31
|
+
extend AutoCorrector
|
32
|
+
include RangeHelp
|
33
|
+
|
34
|
+
MSG = 'metadata.rb should define a version for the cookbook.'
|
35
|
+
|
36
|
+
def_node_search :cb_version?, '(send nil? :version str ...)'
|
37
|
+
|
38
|
+
def on_new_investigation
|
39
|
+
# Using range similar to RuboCop::Cop::Naming::Filename (file_name.rb)
|
40
|
+
return if cb_version?(processed_source.ast)
|
41
|
+
range = source_range(processed_source.buffer, 1, 0)
|
42
|
+
add_offense(range, message: MSG, severity: :refactor)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -40,7 +40,6 @@ module RuboCop
|
|
40
40
|
minimum_target_chef_version '12.9'
|
41
41
|
|
42
42
|
MSG = 'In Chef Infra Client 12.9 and later it is no longer necessary to call the class_eval method on the action class block.'
|
43
|
-
RESTRICT_ON_SEND = [:include_recipe].freeze
|
44
43
|
|
45
44
|
def_node_matcher :class_eval_action_class?, <<-PATTERN
|
46
45
|
(block
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Copyright:: 2021, 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
|
+
module RuboCop
|
19
|
+
module Cop
|
20
|
+
module Chef
|
21
|
+
module Modernize
|
22
|
+
# In Chef Infra Client 12.9 and later `action_class` can be used instead of `declare_action_class`.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
#
|
26
|
+
# #### incorrect
|
27
|
+
# declare_action_class do
|
28
|
+
# foo
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# #### correct
|
32
|
+
# action_class do
|
33
|
+
# foo
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
class DeclareActionClass < Base
|
37
|
+
extend TargetChefVersion
|
38
|
+
extend AutoCorrector
|
39
|
+
|
40
|
+
minimum_target_chef_version '12.9'
|
41
|
+
|
42
|
+
MSG = 'In Chef Infra Client 12.9 and later `action_class` can be used instead of `declare_action_class`.'
|
43
|
+
RESTRICT_ON_SEND = [:declare_action_class].freeze
|
44
|
+
|
45
|
+
def on_send(node)
|
46
|
+
add_offense(node, message: MSG, severity: :refactor) do |corrector|
|
47
|
+
corrector.replace(node, node.source.gsub('declare_action_class', 'action_class'))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookstyle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.25.10
|
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: 2021-
|
12
|
+
date: 2021-11-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubocop
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
20
|
+
version: 1.23.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.
|
27
|
+
version: 1.23.0
|
28
28
|
description:
|
29
29
|
email:
|
30
30
|
- thom@chef.io
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- lib/rubocop/cop/chef/correctness/malformed_value_for_platform.rb
|
72
72
|
- lib/rubocop/cop/chef/correctness/metadata_malformed_version.rb
|
73
73
|
- lib/rubocop/cop/chef/correctness/metadata_missing_name.rb
|
74
|
+
- lib/rubocop/cop/chef/correctness/metadata_missing_version.rb
|
74
75
|
- lib/rubocop/cop/chef/correctness/node_normal.rb
|
75
76
|
- lib/rubocop/cop/chef/correctness/node_normal_unless.rb
|
76
77
|
- lib/rubocop/cop/chef/correctness/node_save.rb
|
@@ -187,6 +188,7 @@ files:
|
|
187
188
|
- lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb
|
188
189
|
- lib/rubocop/cop/chef/modernize/cron_manage_resource.rb
|
189
190
|
- lib/rubocop/cop/chef/modernize/databag_helpers.rb
|
191
|
+
- lib/rubocop/cop/chef/modernize/declare_action_class.rb
|
190
192
|
- lib/rubocop/cop/chef/modernize/default_action_initializer.rb
|
191
193
|
- lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb
|
192
194
|
- lib/rubocop/cop/chef/modernize/definitions.rb
|