cookstyle 6.6.9 → 6.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/cookstyle.yml +66 -6
- data/config/disable_all.yml +18 -0
- data/config/upstream.yml +128 -23
- data/lib/cookstyle.rb +2 -1
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/incorrect_library_injection.rb +10 -0
- data/lib/rubocop/cop/chef/correctness/invalid_version_metadata.rb +1 -1
- data/lib/rubocop/cop/chef/correctness/lazy_eval_node_attribute_defaults.rb +3 -3
- data/lib/rubocop/cop/chef/deprecation/hwrp_without_provides.rb +141 -0
- data/lib/rubocop/cop/chef/deprecation/resource_uses_only_resource_name.rb +86 -0
- data/lib/rubocop/cop/chef/modernize/conditional_using_test.rb +56 -0
- data/lib/rubocop/cop/chef/modernize/includes_mixin_shellout.rb +24 -3
- data/lib/rubocop/cop/chef/modernize/node_init_package.rb +16 -8
- data/lib/rubocop/cop/chef/redundant/multiple_platform_checks.rb +60 -0
- data/lib/rubocop/cop/chef/redundant/ohai_attribute_to_string.rb +68 -0
- data/lib/rubocop/cop/chef/sharing/include_resource_examples.rb +59 -0
- data/lib/rubocop/cop/chef/sharing/invalid_license_string.rb +1 -1
- data/lib/rubocop/cop/chef/style/include_recipe_with_parentheses.rb +57 -0
- data/lib/rubocop/monkey_patches/registry_cop.rb +14 -0
- data/lib/rubocop/monkey_patches/team.rb +24 -0
- metadata +13 -6
- data/lib/rubocop/cop/chef/deprecation/resource_without_name_or_provides.rb +0 -81
- data/lib/rubocop/monkey_patches/commissioner.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4593dcbd93b8d0d668e0fe5e5551147db850c38deabcccf698b3f8ea391c281d
|
4
|
+
data.tar.gz: ef4557926f01a865f3ced43e0ad7a464659f597f4f6ffc8104c2f978d959324a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3d3b5ed0ccd193ae9aad8d8e44a03935010a841c3cf551ce070c557f2f27e93ba2ffa2082042741f481ccabb7abf68e83d958ed06e3c5751556b7f0528aa3ae
|
7
|
+
data.tar.gz: e48e47c6d27316fe8054ecc45164aedf0385be8d8e8e1077781dd3ef9948ccb756864bb6adad422941f061232f0ca0d3c6c41679166bcf345dfa29fc71f79ed3
|
data/config/cookstyle.yml
CHANGED
@@ -161,6 +161,16 @@ ChefStyle/NegatingOnlyIf:
|
|
161
161
|
- '**/metadata.rb'
|
162
162
|
- '**/Berksfile'
|
163
163
|
|
164
|
+
ChefStyle/IncludeRecipeWithParentheses:
|
165
|
+
Description: There is no need to wrap the recipe in parentheses when using the include_recipe helper
|
166
|
+
StyleGuide: '#includerecipewithparentheses'
|
167
|
+
VersionAdded: '6.11.0'
|
168
|
+
Enabled: true
|
169
|
+
Exclude:
|
170
|
+
- '**/attributes/*.rb'
|
171
|
+
- '**/metadata.rb'
|
172
|
+
- '**/Berksfile'
|
173
|
+
|
164
174
|
###############################
|
165
175
|
# ChefCorrectness: Avoiding potential problems
|
166
176
|
###############################
|
@@ -300,8 +310,9 @@ ChefCorrectness/IncorrectLibraryInjection:
|
|
300
310
|
StyleGuide: '#chefcorrectnessincorrectlibraryinjection'
|
301
311
|
Enabled: true
|
302
312
|
VersionAdded: '5.10.0'
|
303
|
-
|
304
|
-
- '**/
|
313
|
+
Exclude:
|
314
|
+
- '**/metadata.rb'
|
315
|
+
- '**/Berksfile'
|
305
316
|
|
306
317
|
ChefCorrectness/InvalidPlatformHelper:
|
307
318
|
Description: Pass valid platforms to the platform? helper.
|
@@ -503,6 +514,14 @@ ChefSharing/IncludeResourceDescriptions:
|
|
503
514
|
Include:
|
504
515
|
- '**/resources/*.rb'
|
505
516
|
|
517
|
+
ChefSharing/IncludeResourceExamples:
|
518
|
+
Description: Resources should include examples field to allow automated documention. Requires Chef Infra Client 13.9 or later.
|
519
|
+
StyleGuide: '#chefsharingincluderesourceexamples'
|
520
|
+
Enabled: false
|
521
|
+
VersionAdded: '6.10.0'
|
522
|
+
Include:
|
523
|
+
- '**/resources/*.rb'
|
524
|
+
|
506
525
|
###############################
|
507
526
|
# ChefDeprecations: Resolving Deprecations that block upgrading Chef Infra Client
|
508
527
|
###############################
|
@@ -946,11 +965,12 @@ ChefDeprecations/LogResourceNotifications:
|
|
946
965
|
- '**/metadata.rb'
|
947
966
|
- '**/Berksfile'
|
948
967
|
|
949
|
-
ChefDeprecations/
|
950
|
-
Description: In Chef Infra Client 16 and later legacy HWRP
|
968
|
+
ChefDeprecations/HWRPWithoutProvides:
|
969
|
+
Description: In Chef Infra Client 16 and later a legacy HWRP resource must use `provides` to define how the resource is called in recipes or other resources. To maintain compatibility with Chef Infra Client < 16 use both `resource_name` and `provides`.
|
951
970
|
StyleGuide: '#chefdeprecationsresourcewithoutnameorprovides'
|
952
971
|
Enabled: true
|
953
972
|
VersionAdded: '6.0.0'
|
973
|
+
VersionChanged: '6.8.0'
|
954
974
|
Include:
|
955
975
|
- '**/libraries/*.rb'
|
956
976
|
|
@@ -991,6 +1011,15 @@ ChefDeprecations/Ruby27KeywordArgumentWarnings:
|
|
991
1011
|
- '**/metadata.rb'
|
992
1012
|
- '**/Berksfile'
|
993
1013
|
|
1014
|
+
ChefDeprecations/ResourceUsesOnlyResourceName:
|
1015
|
+
Description: Starting with Chef Infra Client 16, using `resource_name` without also using `provides` will result in resource failures. Use `provides` to change the name of the resource instead and omit `resource_name` entirely if it matches the name Chef Infra Client automatically assigns based on COOKBOOKNAME_FILENAME.
|
1016
|
+
StyleGuide: '#chefdeprecationsresourceusesonlyresourcename'
|
1017
|
+
Enabled: true
|
1018
|
+
VersionAdded: '6.7.0'
|
1019
|
+
Include:
|
1020
|
+
- '**/libraries/*.rb'
|
1021
|
+
- '**/resources/*.rb'
|
1022
|
+
|
994
1023
|
###############################
|
995
1024
|
# ChefModernize: Cleaning up legacy code and using new built-in resources
|
996
1025
|
###############################
|
@@ -1115,6 +1144,7 @@ ChefModernize/IncludingMixinShelloutInResources:
|
|
1115
1144
|
Include:
|
1116
1145
|
- '**/resources/*.rb'
|
1117
1146
|
- '**/providers/*.rb'
|
1147
|
+
- '**/libraries/*.rb'
|
1118
1148
|
|
1119
1149
|
ChefModernize/UseBuildEssentialResource:
|
1120
1150
|
Description: Use the build_essential resource instead of the legacy build-essential recipe. This resource ships in the build-essential cookbook v5.0+ and is built into Chef Infra Client 14+
|
@@ -1522,6 +1552,16 @@ ChefModernize/ShellOutHelper:
|
|
1522
1552
|
- '**/Berksfile'
|
1523
1553
|
- '**/libraries/*.rb'
|
1524
1554
|
|
1555
|
+
ChefModernize/ConditionalUsingTest:
|
1556
|
+
Description: Use ::File.exist?('/foo/bar') instead of the slower 'test -f /foo/bar' which requires shelling out.
|
1557
|
+
StyleGuide: '#conditionalusingtest'
|
1558
|
+
Enabled: true
|
1559
|
+
VersionAdded: '6.11.0'
|
1560
|
+
Exclude:
|
1561
|
+
- '**/metadata.rb'
|
1562
|
+
- '**/Berksfile'
|
1563
|
+
- '**/attributes/*.rb'
|
1564
|
+
|
1525
1565
|
###############################
|
1526
1566
|
# ChefRedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
|
1527
1567
|
###############################
|
@@ -1716,6 +1756,24 @@ ChefRedundantCode/UseCreateIfMissing:
|
|
1716
1756
|
- '**/attributes/*.rb'
|
1717
1757
|
- '**/Berksfile'
|
1718
1758
|
|
1759
|
+
ChefRedundantCode/OhaiAttributeToString:
|
1760
|
+
Description: Many Ohai node attributes are already strings and don't need to be cast to strings again
|
1761
|
+
StyleGuide: '#ohaiattributetostring'
|
1762
|
+
Enabled: true
|
1763
|
+
VersionAdded: '6.10.0'
|
1764
|
+
Exclude:
|
1765
|
+
- '**/metadata.rb'
|
1766
|
+
- '**/Berksfile'
|
1767
|
+
|
1768
|
+
ChefRedundantCode/MultiplePlatformChecks:
|
1769
|
+
Description: You can pass multiple values to the platform? and platform_family? helpers instead of calling the helpers multiple times.
|
1770
|
+
StyleGuide: '#multipleplatformchecks'
|
1771
|
+
Enabled: true
|
1772
|
+
VersionAdded: '6.10.0'
|
1773
|
+
Exclude:
|
1774
|
+
- '**/metadata.rb'
|
1775
|
+
- '**/Berksfile'
|
1776
|
+
|
1719
1777
|
###############################
|
1720
1778
|
# ChefEffortless: Migrating to new patterns
|
1721
1779
|
###############################
|
@@ -1789,8 +1847,6 @@ ChefEffortless/Berksfile:
|
|
1789
1847
|
|
1790
1848
|
Layout/AccessModifierIndentation:
|
1791
1849
|
Enabled: true
|
1792
|
-
Naming/AccessorMethodName:
|
1793
|
-
Enabled: true
|
1794
1850
|
Layout/AlignArray:
|
1795
1851
|
Enabled: true
|
1796
1852
|
Layout/AlignHash:
|
@@ -2444,3 +2500,7 @@ Style/MultilineWhenThen:
|
|
2444
2500
|
# .each_key is a lot more clear that .keys.each
|
2445
2501
|
Style/HashEachMethods:
|
2446
2502
|
Enabled: true
|
2503
|
+
|
2504
|
+
# We want to catch this deprecation in cookbooks
|
2505
|
+
Lint/DeprecatedOpenSSLConstant:
|
2506
|
+
Enabled: true
|
data/config/disable_all.yml
CHANGED
@@ -211,10 +211,14 @@ 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:
|
@@ -263,6 +267,8 @@ Lint/Loop:
|
|
263
267
|
Enabled: false
|
264
268
|
Lint/MissingCopEnableDirective:
|
265
269
|
Enabled: false
|
270
|
+
Lint/MixedRegexpCaptureTypes:
|
271
|
+
Enabled: false
|
266
272
|
Lint/MultipleComparison:
|
267
273
|
Enabled: false
|
268
274
|
Lint/NestedMethodDefinition:
|
@@ -415,6 +421,8 @@ Naming/VariableNumber:
|
|
415
421
|
Enabled: false
|
416
422
|
Style/AccessModifierDeclarations:
|
417
423
|
Enabled: false
|
424
|
+
Style/AccessorGrouping:
|
425
|
+
Enabled: false
|
418
426
|
Style/Alias:
|
419
427
|
Enabled: false
|
420
428
|
Style/AndOr:
|
@@ -431,6 +439,8 @@ Style/BarePercentLiterals:
|
|
431
439
|
Enabled: false
|
432
440
|
Style/BeginBlock:
|
433
441
|
Enabled: false
|
442
|
+
Style/BisectedAttrAccessor:
|
443
|
+
Enabled: false
|
434
444
|
Style/BlockComments:
|
435
445
|
Enabled: false
|
436
446
|
Style/BlockDelimiters:
|
@@ -561,6 +571,10 @@ Style/MethodCallWithoutArgsParentheses:
|
|
561
571
|
Enabled: false
|
562
572
|
Style/MethodCallWithArgsParentheses:
|
563
573
|
Enabled: false
|
574
|
+
Style/RedundantAssignment:
|
575
|
+
Enabled: false
|
576
|
+
Style/RedundantFetchBlock:
|
577
|
+
Enabled: false
|
564
578
|
Style/MethodCalledOnDoEndBlock:
|
565
579
|
Enabled: false
|
566
580
|
Style/MethodDefParentheses:
|
@@ -667,6 +681,10 @@ Style/RedundantParentheses:
|
|
667
681
|
Enabled: false
|
668
682
|
Style/RedundantPercentQ:
|
669
683
|
Enabled: false
|
684
|
+
Style/RedundantRegexpCharacterClass:
|
685
|
+
Enabled: false
|
686
|
+
Style/RedundantRegexpEscape:
|
687
|
+
Enabled: false
|
670
688
|
Style/RedundantReturn:
|
671
689
|
Enabled: false
|
672
690
|
Style/RedundantSelf:
|
data/config/upstream.yml
CHANGED
@@ -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.
|
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.
|
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: '
|
861
|
-
StyleGuide: '#
|
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.
|
872
|
+
VersionChanged: '0.84'
|
865
873
|
AutoCorrect: false
|
866
|
-
Max:
|
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,6 +1387,11 @@ 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
|
@@ -1492,7 +1514,9 @@ Lint/InheritException:
|
|
1492
1514
|
Lint/InterpolationCheck:
|
1493
1515
|
Description: 'Raise warning for interpolation in single q strs.'
|
1494
1516
|
Enabled: true
|
1517
|
+
SafeAutoCorrect: false
|
1495
1518
|
VersionAdded: '0.50'
|
1519
|
+
VersionChanged: '0.87'
|
1496
1520
|
|
1497
1521
|
Lint/LiteralAsCondition:
|
1498
1522
|
Description: 'Checks of literals used in conditions.'
|
@@ -1526,6 +1550,11 @@ Lint/MissingCopEnableDirective:
|
|
1526
1550
|
# .inf for any size
|
1527
1551
|
MaximumRangeSize: .inf
|
1528
1552
|
|
1553
|
+
Lint/MixedRegexpCaptureTypes:
|
1554
|
+
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1555
|
+
Enabled: pending
|
1556
|
+
VersionAdded: '0.85'
|
1557
|
+
|
1529
1558
|
Lint/MultipleComparison:
|
1530
1559
|
Description: "Use `&&` operator to compare multiple values."
|
1531
1560
|
Enabled: true
|
@@ -1599,7 +1628,9 @@ Lint/RaiseException:
|
|
1599
1628
|
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
|
1600
1629
|
StyleGuide: '#raise-exception'
|
1601
1630
|
Enabled: pending
|
1631
|
+
Safe: false
|
1602
1632
|
VersionAdded: '0.81'
|
1633
|
+
VersionChanged: '0.86'
|
1603
1634
|
AllowedImplicitNamespaces:
|
1604
1635
|
- 'Gem'
|
1605
1636
|
|
@@ -1656,6 +1687,7 @@ Lint/RegexpAsCondition:
|
|
1656
1687
|
The regexp literal matches `$_` implicitly.
|
1657
1688
|
Enabled: true
|
1658
1689
|
VersionAdded: '0.51'
|
1690
|
+
VersionChanged: '0.86'
|
1659
1691
|
|
1660
1692
|
Lint/RequireParentheses:
|
1661
1693
|
Description: >-
|
@@ -1712,6 +1744,7 @@ Lint/SafeNavigationWithEmpty:
|
|
1712
1744
|
Description: 'Avoid `foo&.empty?` in conditionals.'
|
1713
1745
|
Enabled: true
|
1714
1746
|
VersionAdded: '0.62'
|
1747
|
+
VersionChanged: '0.87'
|
1715
1748
|
|
1716
1749
|
Lint/ScriptPermission:
|
1717
1750
|
Description: 'Grant script file execute permission.'
|
@@ -1878,9 +1911,10 @@ Metrics/BlockLength:
|
|
1878
1911
|
Description: 'Avoid long blocks with many lines.'
|
1879
1912
|
Enabled: true
|
1880
1913
|
VersionAdded: '0.44'
|
1881
|
-
VersionChanged: '0.
|
1914
|
+
VersionChanged: '0.87'
|
1882
1915
|
CountComments: false # count full line comments?
|
1883
1916
|
Max: 25
|
1917
|
+
CountAsOne: []
|
1884
1918
|
ExcludedMethods:
|
1885
1919
|
# By default, exclude the `#refine` method, as it tends to have larger
|
1886
1920
|
# associated blocks.
|
@@ -1901,8 +1935,10 @@ Metrics/ClassLength:
|
|
1901
1935
|
Description: 'Avoid classes longer than 100 lines of code.'
|
1902
1936
|
Enabled: true
|
1903
1937
|
VersionAdded: '0.25'
|
1938
|
+
VersionChanged: '0.87'
|
1904
1939
|
CountComments: false # count full line comments?
|
1905
1940
|
Max: 100
|
1941
|
+
CountAsOne: []
|
1906
1942
|
|
1907
1943
|
# Avoid complex methods.
|
1908
1944
|
Metrics/CyclomaticComplexity:
|
@@ -1913,24 +1949,27 @@ Metrics/CyclomaticComplexity:
|
|
1913
1949
|
VersionAdded: '0.25'
|
1914
1950
|
VersionChanged: '0.81'
|
1915
1951
|
IgnoredMethods: []
|
1916
|
-
Max:
|
1952
|
+
Max: 7
|
1917
1953
|
|
1918
1954
|
Metrics/MethodLength:
|
1919
1955
|
Description: 'Avoid methods longer than 10 lines of code.'
|
1920
1956
|
StyleGuide: '#short-methods'
|
1921
1957
|
Enabled: true
|
1922
1958
|
VersionAdded: '0.25'
|
1923
|
-
VersionChanged: '0.
|
1959
|
+
VersionChanged: '0.87'
|
1924
1960
|
CountComments: false # count full line comments?
|
1925
1961
|
Max: 10
|
1962
|
+
CountAsOne: []
|
1926
1963
|
ExcludedMethods: []
|
1927
1964
|
|
1928
1965
|
Metrics/ModuleLength:
|
1929
1966
|
Description: 'Avoid modules longer than 100 lines of code.'
|
1930
1967
|
Enabled: true
|
1931
1968
|
VersionAdded: '0.31'
|
1969
|
+
VersionChanged: '0.87'
|
1932
1970
|
CountComments: false # count full line comments?
|
1933
1971
|
Max: 100
|
1972
|
+
CountAsOne: []
|
1934
1973
|
|
1935
1974
|
Metrics/ParameterLists:
|
1936
1975
|
Description: 'Avoid parameter lists longer than three or four parameters.'
|
@@ -1968,10 +2007,12 @@ Naming/AccessorMethodName:
|
|
1968
2007
|
VersionAdded: '0.50'
|
1969
2008
|
|
1970
2009
|
Naming/AsciiIdentifiers:
|
1971
|
-
Description: 'Use only ascii symbols in identifiers.'
|
2010
|
+
Description: 'Use only ascii symbols in identifiers and constants.'
|
1972
2011
|
StyleGuide: '#english-identifiers'
|
1973
2012
|
Enabled: true
|
1974
2013
|
VersionAdded: '0.50'
|
2014
|
+
VersionChanged: '0.87'
|
2015
|
+
AsciiConstants: true
|
1975
2016
|
|
1976
2017
|
Naming/BinaryOperatorParameterName:
|
1977
2018
|
Description: 'When defining binary operators, name the argument other.'
|
@@ -1999,6 +2040,11 @@ Naming/ClassAndModuleCamelCase:
|
|
1999
2040
|
StyleGuide: '#camelcase-classes'
|
2000
2041
|
Enabled: true
|
2001
2042
|
VersionAdded: '0.50'
|
2043
|
+
VersionChanged: '0.85'
|
2044
|
+
# Allowed class/module names can be specified here.
|
2045
|
+
# These can be full or part of the name.
|
2046
|
+
AllowedNames:
|
2047
|
+
- module_parent
|
2002
2048
|
|
2003
2049
|
Naming/ConstantName:
|
2004
2050
|
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
@@ -2019,6 +2065,10 @@ Naming/FileName:
|
|
2019
2065
|
# It further expects it to be nested inside modules which match the names
|
2020
2066
|
# of subdirectories in its path.
|
2021
2067
|
ExpectMatchingDefinition: false
|
2068
|
+
# When `false`, changes the behavior of ExpectMatchingDefinition to match only
|
2069
|
+
# whether each source file's class or module name matches the file name --
|
2070
|
+
# not whether the nested module hierarchy matches the subdirectory path.
|
2071
|
+
CheckDefinitionPathHierarchy: true
|
2022
2072
|
# If non-`nil`, expect all source file names to match the following regex.
|
2023
2073
|
# Only the file name itself is matched, not the entire file path.
|
2024
2074
|
# Use anchors as necessary if you want to match the entire name rather than
|
@@ -2210,7 +2260,7 @@ Security/JSONLoad:
|
|
2210
2260
|
Description: >-
|
2211
2261
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
2212
2262
|
security issues. See reference for more information.
|
2213
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2263
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2214
2264
|
Enabled: true
|
2215
2265
|
VersionAdded: '0.43'
|
2216
2266
|
VersionChanged: '0.44'
|
@@ -2223,7 +2273,7 @@ Security/MarshalLoad:
|
|
2223
2273
|
Description: >-
|
2224
2274
|
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
2225
2275
|
security issues. See reference for more information.
|
2226
|
-
Reference: 'https://ruby-doc.org/core-2.
|
2276
|
+
Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
|
2227
2277
|
Enabled: true
|
2228
2278
|
VersionAdded: '0.47'
|
2229
2279
|
|
@@ -2237,7 +2287,7 @@ Security/YAMLLoad:
|
|
2237
2287
|
Description: >-
|
2238
2288
|
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
2239
2289
|
security issues. See reference for more information.
|
2240
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2290
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
2241
2291
|
Enabled: true
|
2242
2292
|
VersionAdded: '0.47'
|
2243
2293
|
SafeAutoCorrect: false
|
@@ -2255,6 +2305,17 @@ Style/AccessModifierDeclarations:
|
|
2255
2305
|
- group
|
2256
2306
|
AllowModifiersOnSymbols: true
|
2257
2307
|
|
2308
|
+
Style/AccessorGrouping:
|
2309
|
+
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
2310
|
+
Enabled: 'pending'
|
2311
|
+
VersionAdded: '0.87'
|
2312
|
+
EnforcedStyle: grouped
|
2313
|
+
SupportedStyles:
|
2314
|
+
# separated: each accessor goes in a separate statement.
|
2315
|
+
# grouped: accessors are grouped into a single statement.
|
2316
|
+
- separated
|
2317
|
+
- grouped
|
2318
|
+
|
2258
2319
|
Style/Alias:
|
2259
2320
|
Description: 'Use alias instead of alias_method.'
|
2260
2321
|
StyleGuide: '#alias-method-lexically'
|
@@ -2274,7 +2335,7 @@ Style/AndOr:
|
|
2274
2335
|
VersionChanged: '0.25'
|
2275
2336
|
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
2276
2337
|
# or completely (always).
|
2277
|
-
EnforcedStyle:
|
2338
|
+
EnforcedStyle: conditionals
|
2278
2339
|
SupportedStyles:
|
2279
2340
|
- always
|
2280
2341
|
- conditionals
|
@@ -2322,6 +2383,13 @@ Style/BeginBlock:
|
|
2322
2383
|
Enabled: true
|
2323
2384
|
VersionAdded: '0.9'
|
2324
2385
|
|
2386
|
+
Style/BisectedAttrAccessor:
|
2387
|
+
Description: >-
|
2388
|
+
Checks for places where `attr_reader` and `attr_writer`
|
2389
|
+
for the same method can be combined into single `attr_accessor`.
|
2390
|
+
Enabled: 'pending'
|
2391
|
+
VersionAdded: '0.87'
|
2392
|
+
|
2325
2393
|
Style/BlockComments:
|
2326
2394
|
Description: 'Do not use block comments.'
|
2327
2395
|
StyleGuide: '#no-block-comments'
|
@@ -2694,6 +2762,12 @@ Style/DoubleNegation:
|
|
2694
2762
|
StyleGuide: '#no-bang-bang'
|
2695
2763
|
Enabled: true
|
2696
2764
|
VersionAdded: '0.19'
|
2765
|
+
VersionChanged: '0.84'
|
2766
|
+
EnforcedStyle: allowed_in_returns
|
2767
|
+
SafeAutoCorrect: false
|
2768
|
+
SupportedStyles:
|
2769
|
+
- allowed_in_returns
|
2770
|
+
- forbidden
|
2697
2771
|
|
2698
2772
|
Style/EachForSimpleLoop:
|
2699
2773
|
Description: >-
|
@@ -2857,8 +2931,7 @@ Style/FrozenStringLiteralComment:
|
|
2857
2931
|
SupportedStyles:
|
2858
2932
|
# `always` will always add the frozen string literal comment to a file
|
2859
2933
|
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
2860
|
-
# string literal.
|
2861
|
-
# possible that this will create errors in Ruby 2.3.0+.
|
2934
|
+
# string literal. It is possible that this will create errors.
|
2862
2935
|
- always
|
2863
2936
|
# `always_true` will add the frozen string literal comment to a file,
|
2864
2937
|
# similarly to the `always` style, but will also change any disabled
|
@@ -2958,6 +3031,7 @@ Style/IfUnlessModifierOfIfUnless:
|
|
2958
3031
|
Avoid modifier if/unless usage on conditionals.
|
2959
3032
|
Enabled: true
|
2960
3033
|
VersionAdded: '0.39'
|
3034
|
+
VersionChanged: '0.87'
|
2961
3035
|
|
2962
3036
|
Style/IfWithSemicolon:
|
2963
3037
|
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
@@ -3214,6 +3288,7 @@ Style/MultilineTernaryOperator:
|
|
3214
3288
|
StyleGuide: '#no-multiline-ternary'
|
3215
3289
|
Enabled: true
|
3216
3290
|
VersionAdded: '0.9'
|
3291
|
+
VersionChanged: '0.86'
|
3217
3292
|
|
3218
3293
|
Style/MultilineWhenThen:
|
3219
3294
|
Description: 'Do not use then for multi-line when statement.'
|
@@ -3318,6 +3393,7 @@ Style/NestedTernaryOperator:
|
|
3318
3393
|
StyleGuide: '#no-nested-ternary'
|
3319
3394
|
Enabled: true
|
3320
3395
|
VersionAdded: '0.9'
|
3396
|
+
VersionChanged: '0.86'
|
3321
3397
|
|
3322
3398
|
Style/Next:
|
3323
3399
|
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
@@ -3542,6 +3618,11 @@ Style/RandomWithOffset:
|
|
3542
3618
|
Enabled: true
|
3543
3619
|
VersionAdded: '0.52'
|
3544
3620
|
|
3621
|
+
Style/RedundantAssignment:
|
3622
|
+
Description: 'Checks for redundant assignment before returning.'
|
3623
|
+
Enabled: 'pending'
|
3624
|
+
VersionAdded: '0.87'
|
3625
|
+
|
3545
3626
|
Style/RedundantBegin:
|
3546
3627
|
Description: "Don't use begin blocks when they are not needed."
|
3547
3628
|
StyleGuide: '#begin-implicit'
|
@@ -3571,6 +3652,19 @@ Style/RedundantException:
|
|
3571
3652
|
VersionAdded: '0.14'
|
3572
3653
|
VersionChanged: '0.29'
|
3573
3654
|
|
3655
|
+
Style/RedundantFetchBlock:
|
3656
|
+
Description: >-
|
3657
|
+
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
3658
|
+
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
3659
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
3660
|
+
Enabled: 'pending'
|
3661
|
+
Safe: false
|
3662
|
+
# If enabled, this cop will autocorrect usages of
|
3663
|
+
# `fetch` being called with block returning a constant.
|
3664
|
+
# This can be dangerous since constants will not be defined at that moment.
|
3665
|
+
SafeForConstants: false
|
3666
|
+
VersionAdded: '0.86'
|
3667
|
+
|
3574
3668
|
Style/RedundantFreeze:
|
3575
3669
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3576
3670
|
Enabled: true
|
@@ -3593,6 +3687,16 @@ Style/RedundantPercentQ:
|
|
3593
3687
|
Enabled: true
|
3594
3688
|
VersionAdded: '0.76'
|
3595
3689
|
|
3690
|
+
Style/RedundantRegexpCharacterClass:
|
3691
|
+
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
3692
|
+
Enabled: pending
|
3693
|
+
VersionAdded: '0.85'
|
3694
|
+
|
3695
|
+
Style/RedundantRegexpEscape:
|
3696
|
+
Description: 'Checks for redundant escapes in Regexps.'
|
3697
|
+
Enabled: pending
|
3698
|
+
VersionAdded: '0.85'
|
3699
|
+
|
3596
3700
|
Style/RedundantReturn:
|
3597
3701
|
Description: "Don't use return where it's not required."
|
3598
3702
|
StyleGuide: '#no-explicit-return'
|
@@ -3840,6 +3944,7 @@ Style/StructInheritance:
|
|
3840
3944
|
StyleGuide: '#no-extend-struct-new'
|
3841
3945
|
Enabled: true
|
3842
3946
|
VersionAdded: '0.29'
|
3947
|
+
VersionChanged: '0.86'
|
3843
3948
|
|
3844
3949
|
Style/SymbolArray:
|
3845
3950
|
Description: 'Use %i or %I for arrays of symbols.'
|
@@ -3861,7 +3966,7 @@ Style/SymbolLiteral:
|
|
3861
3966
|
Style/SymbolProc:
|
3862
3967
|
Description: 'Use symbols as procs instead of blocks when possible.'
|
3863
3968
|
Enabled: true
|
3864
|
-
|
3969
|
+
Safe: false
|
3865
3970
|
VersionAdded: '0.26'
|
3866
3971
|
VersionChanged: '0.64'
|
3867
3972
|
# A list of method names to be ignored by the check.
|