cookstyle 7.0.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -6
- data/config/cookstyle.yml +69 -13
- data/config/disable_all.yml +18 -0
- data/config/upstream.yml +165 -25
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/chef_sugar_helpers.rb +56 -0
- data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +2 -3
- data/lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_actions.rb +67 -0
- data/lib/rubocop/cop/chef/deprecation/foodcritic_testing.rb +43 -0
- data/lib/rubocop/cop/chef/deprecation/librarian_chefspec.rb +42 -0
- data/lib/rubocop/cop/chef/modernize/use_multipackage_installs.rb +16 -12
- data/lib/rubocop/cop/chef/style/comment_sentence_spacing.rb +1 -1
- metadata +8 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: afe67bc1be4b70753843d22598cd29dd7edded20c3762230d4cbfb08ba2ed240
|
|
4
|
+
data.tar.gz: f4f3c739c446a6560b8f9319c63b87dc48c2d338ad45316369a1ed848d40222a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 64ec5f89be1438ba7e29f1e19e9f8b6ebbac1320550f5b32d2a5d58b7ea1994ed4fe08f1243a1328beb46acca4da67608d6ba4b0f3944487adc8af90f9e8fc5e
|
|
7
|
+
data.tar.gz: 7b6118d966b9585555db7cd3d7b61114e5229a792d9bd9ee23e71a0330ca004187f8ca11cda4b6922c57007ddd0d8e57d30e925f957517dce27ee24532da7cfa
|
data/Gemfile
CHANGED
|
@@ -11,8 +11,6 @@ group :debug do
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
group :docs do
|
|
14
|
-
gem 'github-markup'
|
|
15
|
-
gem 'redcarpet'
|
|
16
14
|
gem 'yard'
|
|
17
15
|
end
|
|
18
16
|
|
|
@@ -26,9 +24,6 @@ group :rubocop_gems do
|
|
|
26
24
|
end
|
|
27
25
|
|
|
28
26
|
group :development do
|
|
29
|
-
gem 'adamantium'
|
|
30
|
-
gem 'anima'
|
|
31
|
-
gem 'concord'
|
|
32
27
|
gem 'rake'
|
|
33
28
|
gem 'rspec', '>= 3.4'
|
|
34
|
-
end
|
|
29
|
+
end
|
data/config/cookstyle.yml
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
+
SuggestExtensions: false
|
|
2
3
|
TargetRubyVersion: 2.4
|
|
3
4
|
TargetChefVersion: ~
|
|
4
5
|
Exclude:
|
|
@@ -11,7 +12,7 @@ AllCops:
|
|
|
11
12
|
###############################
|
|
12
13
|
|
|
13
14
|
Chef/Style:
|
|
14
|
-
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/
|
|
15
|
+
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chef_style.md
|
|
15
16
|
|
|
16
17
|
Chef/Style/AttributeKeys:
|
|
17
18
|
Description: Check which style of keys are used to access node attributes.
|
|
@@ -155,7 +156,7 @@ Chef/Style/IncludeRecipeWithParentheses:
|
|
|
155
156
|
###############################
|
|
156
157
|
|
|
157
158
|
Chef/Correctness:
|
|
158
|
-
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/
|
|
159
|
+
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chef_correctness.md
|
|
159
160
|
|
|
160
161
|
Chef/Correctness/ServiceResource:
|
|
161
162
|
Description: Use a service resource to start and stop services instead of execute resources
|
|
@@ -484,7 +485,7 @@ Chef/Correctness/OctalModeAsString:
|
|
|
484
485
|
###############################
|
|
485
486
|
|
|
486
487
|
Chef/Sharing:
|
|
487
|
-
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/
|
|
488
|
+
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chef_sharing.md
|
|
488
489
|
|
|
489
490
|
Chef/Sharing/InsecureCookbookURL:
|
|
490
491
|
Description: Insecure http Github or Gitlab URLs for metadata source_url/issues_url fields
|
|
@@ -552,7 +553,7 @@ Chef/Sharing/IncludeResourceExamples:
|
|
|
552
553
|
###############################
|
|
553
554
|
|
|
554
555
|
Chef/Deprecations:
|
|
555
|
-
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/
|
|
556
|
+
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chef_deprecations.md
|
|
556
557
|
|
|
557
558
|
Chef/Deprecations/NodeDeepFetch:
|
|
558
559
|
Description: Do not use the deprecated chef-sugar node.deep_fetch methods
|
|
@@ -819,7 +820,8 @@ Chef/Deprecations/UsesRunCommandHelper:
|
|
|
819
820
|
VersionAdded: '5.9.0'
|
|
820
821
|
Exclude:
|
|
821
822
|
- '**/metadata.rb'
|
|
822
|
-
- '
|
|
823
|
+
- '**/Berksfile'
|
|
824
|
+
- '**/Rakefile'
|
|
823
825
|
|
|
824
826
|
Chef/Deprecations/ChefHandlerUsesSupports:
|
|
825
827
|
Description: Use the type property instead of the deprecated supports property in the chef_handler resource. The supports property was removed in chef_handler cookbook version 3.0 (June 2017) and Chef Infra Client 14.0.
|
|
@@ -836,6 +838,8 @@ Chef/Deprecations/DeprecatedYumRepositoryProperties:
|
|
|
836
838
|
VersionAdded: '5.10.0'
|
|
837
839
|
Exclude:
|
|
838
840
|
- '**/metadata.rb'
|
|
841
|
+
- '**/attributes/*.rb'
|
|
842
|
+
- '**/Berksfile'
|
|
839
843
|
|
|
840
844
|
Chef/Deprecations/EOLAuditModeUsage:
|
|
841
845
|
Description: The beta Audit Mode feature in Chef Infra Client was removed in Chef Infra Client 15.0. Users should instead use InSpec and the audit cookbook. See https://www.inspec.io/ for more informmation.
|
|
@@ -844,6 +848,8 @@ Chef/Deprecations/EOLAuditModeUsage:
|
|
|
844
848
|
VersionAdded: '5.10.0'
|
|
845
849
|
Exclude:
|
|
846
850
|
- '**/metadata.rb'
|
|
851
|
+
- '**/attributes/*.rb'
|
|
852
|
+
- '**/Berksfile'
|
|
847
853
|
|
|
848
854
|
Chef/Deprecations/ResourceInheritsFromCompatResource:
|
|
849
855
|
Description: HWRP style resource should inherit from the 'Chef::Resource' class and not the 'ChefCompat::Resource' class from the deprecated compat_resource cookbook.
|
|
@@ -860,12 +866,18 @@ Chef/Deprecations/VerifyPropertyUsesFileExpansion:
|
|
|
860
866
|
VersionAdded: '5.10.0'
|
|
861
867
|
Exclude:
|
|
862
868
|
- '**/metadata.rb'
|
|
869
|
+
- '**/attributes/*.rb'
|
|
870
|
+
- '**/Berksfile'
|
|
863
871
|
|
|
864
872
|
Chef/Deprecations/PoiseArchiveUsage:
|
|
865
873
|
Description: The poise_archive resource in the deprecated poise-archive should be replaced with the archive_file resource found in Chef Infra Client 15+.
|
|
866
874
|
StyleGuide: '#chefdeprecationspoisearchiveusage'
|
|
867
875
|
Enabled: true
|
|
868
876
|
VersionAdded: '5.11.0'
|
|
877
|
+
Exclude:
|
|
878
|
+
- '**/metadata.rb'
|
|
879
|
+
- '**/attributes/*.rb'
|
|
880
|
+
- '**/Berksfile'
|
|
869
881
|
|
|
870
882
|
Chef/Deprecations/PartialSearchHelperUsage:
|
|
871
883
|
Description: Legacy partial_search usage should be updated to use :filter_result in the search helper instead.
|
|
@@ -906,6 +918,8 @@ Chef/Deprecations/LegacyNotifySyntax:
|
|
|
906
918
|
VersionAdded: '5.13.0'
|
|
907
919
|
Exclude:
|
|
908
920
|
- '**/metadata.rb'
|
|
921
|
+
- '**/attributes/*.rb'
|
|
922
|
+
- '**/Berksfile'
|
|
909
923
|
|
|
910
924
|
Chef/Deprecations/NodeSetWithoutLevel:
|
|
911
925
|
Description: When setting a node attribute in Chef Infra Client 11 and later you must specify the precedence level.
|
|
@@ -1137,12 +1151,50 @@ Chef/Deprecations/UseYamlDump:
|
|
|
1137
1151
|
Enabled: true
|
|
1138
1152
|
VersionAdded: '6.21.0'
|
|
1139
1153
|
|
|
1154
|
+
Chef/Deprecations/LibrarianChefSpec:
|
|
1155
|
+
Description: The Librarian-Chef depsolving project is no longer maintained and ChefSpec should not use Librarian-Chef for cookbook depsolving. Consider using Policyfiles instead.
|
|
1156
|
+
StyleGuide: '#chefdeprecationslibrarianchefspec'
|
|
1157
|
+
Enabled: true
|
|
1158
|
+
VersionAdded: '7.1.0'
|
|
1159
|
+
Include:
|
|
1160
|
+
- '**/specs/*.rb'
|
|
1161
|
+
|
|
1162
|
+
Chef/Deprecations/FoodcriticTesting:
|
|
1163
|
+
Description: The Foodcritic cookbook linter has been deprecated and should no longer be used for validating cookbooks
|
|
1164
|
+
StyleGuide: '#chefdeprecationsfoodcritictesting'
|
|
1165
|
+
Enabled: true
|
|
1166
|
+
VersionAdded: '7.1.0'
|
|
1167
|
+
Include:
|
|
1168
|
+
- '**/Rakefile'
|
|
1169
|
+
- '**/Gemfile'
|
|
1170
|
+
|
|
1171
|
+
Chef/Deprecations/DeprecatedYumRepositoryActions:
|
|
1172
|
+
Description: With the release of Chef Infra Client 12.14 and the yum cookbook 3.0 several actions in the yum_repository resource actions were renamed. The `add` action became `create` and `delete` became `remove` to better match other resources in Chef Infra Client.
|
|
1173
|
+
StyleGuide: '#chefdeprecationsdeprecatedyumrepositoryactions'
|
|
1174
|
+
Enabled: true
|
|
1175
|
+
VersionAdded: '7.3.0'
|
|
1176
|
+
Exclude:
|
|
1177
|
+
- '**/metadata.rb'
|
|
1178
|
+
- '**/attributes/*.rb'
|
|
1179
|
+
- '**/Berksfile'
|
|
1180
|
+
- '**/Rakefile'
|
|
1181
|
+
|
|
1182
|
+
Chef/Deprecations/ChefSugarHelpers:
|
|
1183
|
+
Description: Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/master/chef-utils#getting-started
|
|
1184
|
+
StyleGuide: '#chefdeprecationschefsugarhelpers'
|
|
1185
|
+
Enabled: true
|
|
1186
|
+
VersionAdded: '7.3.0'
|
|
1187
|
+
Exclude:
|
|
1188
|
+
- '**/metadata.rb'
|
|
1189
|
+
- '**/Berksfile'
|
|
1190
|
+
- '**/Rakefile'
|
|
1191
|
+
|
|
1140
1192
|
###############################
|
|
1141
1193
|
# Chef/Modernize: Cleaning up legacy code and using new built-in resources
|
|
1142
1194
|
###############################
|
|
1143
1195
|
|
|
1144
1196
|
Chef/Modernize:
|
|
1145
|
-
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/
|
|
1197
|
+
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chef_modernize.md
|
|
1146
1198
|
|
|
1147
1199
|
Chef/Modernize/LegacyBerksfileSource:
|
|
1148
1200
|
Description: Do not use legacy Berksfile community sources. Use Chef Supermarket instead.
|
|
@@ -1194,6 +1246,7 @@ Chef/Modernize/RespondToProvides:
|
|
|
1194
1246
|
VersionAdded: '5.2.0'
|
|
1195
1247
|
Include:
|
|
1196
1248
|
- '**/providers/*.rb'
|
|
1249
|
+
- '**/resources/*.rb'
|
|
1197
1250
|
- '**/libraries/*.rb'
|
|
1198
1251
|
|
|
1199
1252
|
Chef/Modernize/SetOrReturnInResources:
|
|
@@ -1697,14 +1750,13 @@ Chef/Modernize/ActionMethodInResource:
|
|
|
1697
1750
|
Include:
|
|
1698
1751
|
- '**/resources/*.rb'
|
|
1699
1752
|
- '**/providers/*.rb'
|
|
1700
|
-
- '**/libraries/*.rb'
|
|
1701
1753
|
|
|
1702
1754
|
###############################
|
|
1703
1755
|
# Chef/RedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
|
|
1704
1756
|
###############################
|
|
1705
1757
|
|
|
1706
1758
|
Chef/RedundantCode:
|
|
1707
|
-
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/
|
|
1759
|
+
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chef_redundantcode.md
|
|
1708
1760
|
|
|
1709
1761
|
Chef/RedundantCode/ConflictsMetadata:
|
|
1710
1762
|
Description: Don't use the deprecated 'conflicts' metadata value
|
|
@@ -1926,7 +1978,7 @@ Chef/RedundantCode/DoubleCompileTime:
|
|
|
1926
1978
|
###############################
|
|
1927
1979
|
|
|
1928
1980
|
Chef/Effortless:
|
|
1929
|
-
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/
|
|
1981
|
+
StyleGuideBaseURL: https://github.com/chef/cookstyle/blob/master/docs/cops_chef_effortless.md
|
|
1930
1982
|
|
|
1931
1983
|
Chef/Effortless/CookbookUsesSearch:
|
|
1932
1984
|
Description: Cookbook uses search, which cannot be used in the Effortless Infra pattern
|
|
@@ -2079,6 +2131,7 @@ Style/EmptyElse:
|
|
|
2079
2131
|
Enabled: true
|
|
2080
2132
|
Layout/EmptyLineBetweenDefs:
|
|
2081
2133
|
Enabled: true
|
|
2134
|
+
AllowAdjacentOneLineDefs: true
|
|
2082
2135
|
Layout/EmptyLines:
|
|
2083
2136
|
Enabled: true
|
|
2084
2137
|
Layout/EmptyLinesAroundAccessModifier:
|
|
@@ -2422,10 +2475,9 @@ Metrics/BlockNesting:
|
|
|
2422
2475
|
Metrics/ParameterLists:
|
|
2423
2476
|
Enabled: false
|
|
2424
2477
|
|
|
2425
|
-
#
|
|
2426
|
-
# Chef::Recipe.send(:include, ::Apt::Helpers) -> Chef::Recipe.include ::Apt::Helpers
|
|
2478
|
+
# The warning message from this is misleading and can lead to wrong but syntactically valid code.
|
|
2427
2479
|
Lint/SendWithMixinArgument:
|
|
2428
|
-
Enabled:
|
|
2480
|
+
Enabled: false
|
|
2429
2481
|
|
|
2430
2482
|
# this migrates old # rubocop: comments to use the latest namespaces, which prevents a ton of spam during cookstyle runs
|
|
2431
2483
|
Migration/DepartmentName:
|
|
@@ -2746,4 +2798,8 @@ Style/ExpandPathArguments:
|
|
|
2746
2798
|
|
|
2747
2799
|
# Avoid a safe navigation operator if we don't need it
|
|
2748
2800
|
Lint/RedundantSafeNavigation:
|
|
2749
|
-
Enabled: true
|
|
2801
|
+
Enabled: true
|
|
2802
|
+
|
|
2803
|
+
# Avoid using blocks to remove nils from a Hash/Array
|
|
2804
|
+
Style/CollectionCompact:
|
|
2805
|
+
Enabled: true
|
data/config/disable_all.yml
CHANGED
|
@@ -229,6 +229,8 @@ Lint/DeprecatedOpenSSLConstant:
|
|
|
229
229
|
Enabled: false
|
|
230
230
|
Lint/DisjunctiveAssignmentInConstructor:
|
|
231
231
|
Enabled: false
|
|
232
|
+
Lint/DuplicateBranch:
|
|
233
|
+
Enabled: false
|
|
232
234
|
Lint/DuplicateCaseCondition:
|
|
233
235
|
Enabled: false
|
|
234
236
|
Lint/DuplicateElsifCondition:
|
|
@@ -249,6 +251,8 @@ Lint/ElseLayout:
|
|
|
249
251
|
Enabled: false
|
|
250
252
|
Lint/EmptyBlock:
|
|
251
253
|
Enabled: false
|
|
254
|
+
Lint/EmptyClass:
|
|
255
|
+
Enabled: false
|
|
252
256
|
Lint/EmptyConditionalBody:
|
|
253
257
|
Enabled: false
|
|
254
258
|
Lint/EmptyEnsure:
|
|
@@ -307,6 +311,8 @@ Lint/NestedPercentLiteral:
|
|
|
307
311
|
Enabled: false
|
|
308
312
|
Lint/NextWithoutAccumulator:
|
|
309
313
|
Enabled: false
|
|
314
|
+
Lint/NoReturnInBeginEndBlocks:
|
|
315
|
+
Enabled: false
|
|
310
316
|
Lint/NonDeterministicRequireOrder:
|
|
311
317
|
Enabled: false
|
|
312
318
|
Lint/NonLocalExitFromIterator:
|
|
@@ -387,6 +393,8 @@ Lint/TrailingCommaInAttributeDeclaration:
|
|
|
387
393
|
Enabled: false
|
|
388
394
|
Lint/UnderscorePrefixedVariableName:
|
|
389
395
|
Enabled: false
|
|
396
|
+
Lint/UnexpectedBlockArity:
|
|
397
|
+
Enabled: false
|
|
390
398
|
Lint/UnifiedInteger:
|
|
391
399
|
Enabled: false
|
|
392
400
|
Lint/UnmodifiedReduceAccumulator:
|
|
@@ -515,6 +523,8 @@ Style/ClassMethodsDefinitions:
|
|
|
515
523
|
Enabled: false
|
|
516
524
|
Style/ClassVars:
|
|
517
525
|
Enabled: false
|
|
526
|
+
Style/CollectionCompact:
|
|
527
|
+
Enabled: false
|
|
518
528
|
Style/CollectionMethods:
|
|
519
529
|
Enabled: false
|
|
520
530
|
Style/ColonMethodCall:
|
|
@@ -653,6 +663,8 @@ Style/RedundantSelfAssignment:
|
|
|
653
663
|
Enabled: false
|
|
654
664
|
Style/SoleNestedConditional:
|
|
655
665
|
Enabled: false
|
|
666
|
+
Style/StaticClass:
|
|
667
|
+
Enabled: false
|
|
656
668
|
Style/MethodCalledOnDoEndBlock:
|
|
657
669
|
Enabled: false
|
|
658
670
|
Style/MethodDefParentheses:
|
|
@@ -689,6 +701,8 @@ Style/MutableConstant:
|
|
|
689
701
|
Enabled: false
|
|
690
702
|
Style/NegatedIf:
|
|
691
703
|
Enabled: false
|
|
704
|
+
Style/NegatedIfElseCondition:
|
|
705
|
+
Enabled: false
|
|
692
706
|
Style/NegatedUnless:
|
|
693
707
|
Enabled: false
|
|
694
708
|
Style/NegatedWhile:
|
|
@@ -703,6 +717,8 @@ Style/Next:
|
|
|
703
717
|
Enabled: false
|
|
704
718
|
Style/NilComparison:
|
|
705
719
|
Enabled: false
|
|
720
|
+
Style/NilLambda:
|
|
721
|
+
Enabled: false
|
|
706
722
|
Style/NonNilCheck:
|
|
707
723
|
Enabled: false
|
|
708
724
|
Style/Not:
|
|
@@ -741,6 +757,8 @@ Style/RaiseArgs:
|
|
|
741
757
|
Enabled: false
|
|
742
758
|
Style/RandomWithOffset:
|
|
743
759
|
Enabled: false
|
|
760
|
+
Style/RedundantArgument:
|
|
761
|
+
Enabled: false
|
|
744
762
|
Style/RedundantBegin:
|
|
745
763
|
Enabled: false
|
|
746
764
|
Style/RedundantCapitalW:
|
data/config/upstream.yml
CHANGED
|
@@ -139,6 +139,16 @@ AllCops:
|
|
|
139
139
|
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
|
|
140
140
|
# use the oldest officially supported Ruby version (currently Ruby 2.4).
|
|
141
141
|
TargetRubyVersion: ~
|
|
142
|
+
# Determines if a notification for extension libraries should be shown when
|
|
143
|
+
# rubocop is run. Keys are the name of the extension, and values are an array
|
|
144
|
+
# of gems in the Gemfile that the extension is suggested for, if not already
|
|
145
|
+
# included.
|
|
146
|
+
SuggestExtensions:
|
|
147
|
+
rubocop-rails: [rails]
|
|
148
|
+
rubocop-rspec: [rspec, rspec-rails]
|
|
149
|
+
rubocop-minitest: [minitest]
|
|
150
|
+
rubocop-sequel: [sequel]
|
|
151
|
+
rubocop-rake: [rake]
|
|
142
152
|
|
|
143
153
|
#################### Bundler ###############################
|
|
144
154
|
|
|
@@ -459,10 +469,14 @@ Layout/EmptyLineAfterMultilineCondition:
|
|
|
459
469
|
- https://github.com/airbnb/ruby#multiline-if-newline
|
|
460
470
|
|
|
461
471
|
Layout/EmptyLineBetweenDefs:
|
|
462
|
-
Description: 'Use empty lines between defs.'
|
|
472
|
+
Description: 'Use empty lines between class/module/method defs.'
|
|
463
473
|
StyleGuide: '#empty-lines-between-methods'
|
|
464
474
|
Enabled: true
|
|
465
475
|
VersionAdded: '0.49'
|
|
476
|
+
VersionChanged: '1.4'
|
|
477
|
+
EmptyLineBetweenMethodDefs: true
|
|
478
|
+
EmptyLineBetweenClassDefs: true
|
|
479
|
+
EmptyLineBetweenModuleDefs: true
|
|
466
480
|
# If `true`, this parameter means that single line method definitions don't
|
|
467
481
|
# need an empty line between them.
|
|
468
482
|
AllowAdjacentOneLineDefs: false
|
|
@@ -891,8 +905,8 @@ Layout/LineLength:
|
|
|
891
905
|
StyleGuide: '#max-line-length'
|
|
892
906
|
Enabled: true
|
|
893
907
|
VersionAdded: '0.25'
|
|
894
|
-
VersionChanged: '
|
|
895
|
-
AutoCorrect:
|
|
908
|
+
VersionChanged: '1.4'
|
|
909
|
+
AutoCorrect: true
|
|
896
910
|
Max: 120
|
|
897
911
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
|
898
912
|
# containing a URI to be longer than Max.
|
|
@@ -1176,7 +1190,7 @@ Layout/SpaceBeforeBlockBraces:
|
|
|
1176
1190
|
SupportedStylesForEmptyBraces:
|
|
1177
1191
|
- space
|
|
1178
1192
|
- no_space
|
|
1179
|
-
VersionChanged: '0.52
|
|
1193
|
+
VersionChanged: '0.52'
|
|
1180
1194
|
|
|
1181
1195
|
Layout/SpaceBeforeComma:
|
|
1182
1196
|
Description: 'No spaces before commas.'
|
|
@@ -1400,6 +1414,11 @@ Lint/ConstantDefinitionInBlock:
|
|
|
1400
1414
|
StyleGuide: '#no-constant-definition-in-block'
|
|
1401
1415
|
Enabled: true
|
|
1402
1416
|
VersionAdded: '0.91'
|
|
1417
|
+
VersionChanged: '1.3'
|
|
1418
|
+
# `enums` for Typed Enums via T::Enum in Sorbet.
|
|
1419
|
+
# https://sorbet.org/docs/tenum
|
|
1420
|
+
AllowedMethods:
|
|
1421
|
+
- enums
|
|
1403
1422
|
|
|
1404
1423
|
Lint/ConstantResolution:
|
|
1405
1424
|
Description: 'Check that constants are fully qualified with `::`.'
|
|
@@ -1415,6 +1434,22 @@ Lint/Debugger:
|
|
|
1415
1434
|
Enabled: true
|
|
1416
1435
|
VersionAdded: '0.14'
|
|
1417
1436
|
VersionChanged: '0.49'
|
|
1437
|
+
DebuggerReceivers:
|
|
1438
|
+
- binding
|
|
1439
|
+
- Kernel
|
|
1440
|
+
- Pry
|
|
1441
|
+
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
|
|
1418
1453
|
|
|
1419
1454
|
Lint/DeprecatedClassMethods:
|
|
1420
1455
|
Description: 'Check for deprecated class method calls.'
|
|
@@ -1433,6 +1468,11 @@ Lint/DisjunctiveAssignmentInConstructor:
|
|
|
1433
1468
|
VersionAdded: '0.62'
|
|
1434
1469
|
VersionChanged: '0.88'
|
|
1435
1470
|
|
|
1471
|
+
Lint/DuplicateBranch:
|
|
1472
|
+
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
|
1473
|
+
Enabled: pending
|
|
1474
|
+
VersionAdded: '1.3'
|
|
1475
|
+
|
|
1436
1476
|
Lint/DuplicateCaseCondition:
|
|
1437
1477
|
Description: 'Do not repeat values in case conditionals.'
|
|
1438
1478
|
Enabled: true
|
|
@@ -1478,12 +1518,21 @@ Lint/ElseLayout:
|
|
|
1478
1518
|
Description: 'Check for odd code arrangement in an else block.'
|
|
1479
1519
|
Enabled: true
|
|
1480
1520
|
VersionAdded: '0.17'
|
|
1521
|
+
VersionChanged: '1.2'
|
|
1481
1522
|
|
|
1482
1523
|
Lint/EmptyBlock:
|
|
1483
1524
|
Description: 'This cop checks for blocks without a body.'
|
|
1484
1525
|
Enabled: pending
|
|
1485
1526
|
VersionAdded: '1.1'
|
|
1527
|
+
VersionChanged: '1.3'
|
|
1486
1528
|
AllowComments: true
|
|
1529
|
+
AllowEmptyLambdas: true
|
|
1530
|
+
|
|
1531
|
+
Lint/EmptyClass:
|
|
1532
|
+
Description: 'Checks for classes and metaclasses without a body.'
|
|
1533
|
+
Enabled: pending
|
|
1534
|
+
VersionAdded: '1.3'
|
|
1535
|
+
AllowComments: false
|
|
1487
1536
|
|
|
1488
1537
|
Lint/EmptyConditionalBody:
|
|
1489
1538
|
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
|
@@ -1627,7 +1676,8 @@ Lint/Loop:
|
|
|
1627
1676
|
StyleGuide: '#loop-with-break'
|
|
1628
1677
|
Enabled: true
|
|
1629
1678
|
VersionAdded: '0.9'
|
|
1630
|
-
VersionChanged: '
|
|
1679
|
+
VersionChanged: '1.3'
|
|
1680
|
+
Safe: false
|
|
1631
1681
|
|
|
1632
1682
|
Lint/MissingCopEnableDirective:
|
|
1633
1683
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
|
@@ -1648,6 +1698,7 @@ Lint/MissingSuper:
|
|
|
1648
1698
|
without calls to `super`'.
|
|
1649
1699
|
Enabled: true
|
|
1650
1700
|
VersionAdded: '0.89'
|
|
1701
|
+
VersionChanged: '1.4'
|
|
1651
1702
|
|
|
1652
1703
|
Lint/MixedRegexpCaptureTypes:
|
|
1653
1704
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
|
@@ -1679,6 +1730,11 @@ Lint/NextWithoutAccumulator:
|
|
|
1679
1730
|
Enabled: true
|
|
1680
1731
|
VersionAdded: '0.36'
|
|
1681
1732
|
|
|
1733
|
+
Lint/NoReturnInBeginEndBlocks:
|
|
1734
|
+
Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
|
|
1735
|
+
Enabled: pending
|
|
1736
|
+
VersionAdded: '1.2'
|
|
1737
|
+
|
|
1682
1738
|
Lint/NonDeterministicRequireOrder:
|
|
1683
1739
|
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
|
1684
1740
|
Enabled: true
|
|
@@ -1824,7 +1880,7 @@ Lint/RescueException:
|
|
|
1824
1880
|
StyleGuide: '#no-blind-rescues'
|
|
1825
1881
|
Enabled: true
|
|
1826
1882
|
VersionAdded: '0.9'
|
|
1827
|
-
VersionChanged: '0.27
|
|
1883
|
+
VersionChanged: '0.27'
|
|
1828
1884
|
|
|
1829
1885
|
Lint/RescueType:
|
|
1830
1886
|
Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
|
|
@@ -1952,6 +2008,23 @@ Lint/UnderscorePrefixedVariableName:
|
|
|
1952
2008
|
VersionAdded: '0.21'
|
|
1953
2009
|
AllowKeywordBlockArguments: false
|
|
1954
2010
|
|
|
2011
|
+
Lint/UnexpectedBlockArity:
|
|
2012
|
+
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
|
|
2013
|
+
Enabled: pending
|
|
2014
|
+
Safe: false
|
|
2015
|
+
VersionAdded: '1.5'
|
|
2016
|
+
Methods:
|
|
2017
|
+
chunk_while: 2
|
|
2018
|
+
each_with_index: 2
|
|
2019
|
+
each_with_object: 2
|
|
2020
|
+
inject: 2
|
|
2021
|
+
max: 2
|
|
2022
|
+
min: 2
|
|
2023
|
+
minmax: 2
|
|
2024
|
+
reduce: 2
|
|
2025
|
+
slice_when: 2
|
|
2026
|
+
sort: 2
|
|
2027
|
+
|
|
1955
2028
|
Lint/UnifiedInteger:
|
|
1956
2029
|
Description: 'Use Integer instead of Fixnum or Bignum.'
|
|
1957
2030
|
Enabled: true
|
|
@@ -1961,6 +2034,7 @@ Lint/UnmodifiedReduceAccumulator:
|
|
|
1961
2034
|
Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
|
|
1962
2035
|
Enabled: pending
|
|
1963
2036
|
VersionAdded: '1.1'
|
|
2037
|
+
VersionChanged: '1.5'
|
|
1964
2038
|
|
|
1965
2039
|
Lint/UnreachableCode:
|
|
1966
2040
|
Description: 'Unreachable code.'
|
|
@@ -2036,8 +2110,9 @@ Lint/UselessMethodDefinition:
|
|
|
2036
2110
|
Lint/UselessSetterCall:
|
|
2037
2111
|
Description: 'Checks for useless setter call to a local variable.'
|
|
2038
2112
|
Enabled: true
|
|
2113
|
+
SafeAutoCorrect: false
|
|
2039
2114
|
VersionAdded: '0.13'
|
|
2040
|
-
VersionChanged: '
|
|
2115
|
+
VersionChanged: '1.2'
|
|
2041
2116
|
Safe: false
|
|
2042
2117
|
|
|
2043
2118
|
Lint/UselessTimes:
|
|
@@ -2063,21 +2138,23 @@ Metrics/AbcSize:
|
|
|
2063
2138
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
|
2064
2139
|
Enabled: true
|
|
2065
2140
|
VersionAdded: '0.27'
|
|
2066
|
-
VersionChanged: '
|
|
2141
|
+
VersionChanged: '1.5'
|
|
2067
2142
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
|
2068
2143
|
# a Float.
|
|
2069
2144
|
IgnoredMethods: []
|
|
2145
|
+
CountRepeatedAttributes: true
|
|
2070
2146
|
Max: 17
|
|
2071
2147
|
|
|
2072
2148
|
Metrics/BlockLength:
|
|
2073
2149
|
Description: 'Avoid long blocks with many lines.'
|
|
2074
2150
|
Enabled: true
|
|
2075
2151
|
VersionAdded: '0.44'
|
|
2076
|
-
VersionChanged: '
|
|
2152
|
+
VersionChanged: '1.5'
|
|
2077
2153
|
CountComments: false # count full line comments?
|
|
2078
2154
|
Max: 25
|
|
2079
2155
|
CountAsOne: []
|
|
2080
|
-
ExcludedMethods:
|
|
2156
|
+
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
|
2157
|
+
IgnoredMethods:
|
|
2081
2158
|
# By default, exclude the `#refine` method, as it tends to have larger
|
|
2082
2159
|
# associated blocks.
|
|
2083
2160
|
- refine
|
|
@@ -2118,11 +2195,12 @@ Metrics/MethodLength:
|
|
|
2118
2195
|
StyleGuide: '#short-methods'
|
|
2119
2196
|
Enabled: true
|
|
2120
2197
|
VersionAdded: '0.25'
|
|
2121
|
-
VersionChanged: '
|
|
2198
|
+
VersionChanged: '1.5'
|
|
2122
2199
|
CountComments: false # count full line comments?
|
|
2123
2200
|
Max: 10
|
|
2124
2201
|
CountAsOne: []
|
|
2125
|
-
ExcludedMethods: []
|
|
2202
|
+
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
|
2203
|
+
IgnoredMethods: []
|
|
2126
2204
|
|
|
2127
2205
|
Metrics/ModuleLength:
|
|
2128
2206
|
Description: 'Avoid modules longer than 100 lines of code.'
|
|
@@ -2138,8 +2216,10 @@ Metrics/ParameterLists:
|
|
|
2138
2216
|
StyleGuide: '#too-many-params'
|
|
2139
2217
|
Enabled: true
|
|
2140
2218
|
VersionAdded: '0.25'
|
|
2219
|
+
VersionChanged: '1.5'
|
|
2141
2220
|
Max: 5
|
|
2142
2221
|
CountKeywordArgs: true
|
|
2222
|
+
MaxOptionalParameters: 3
|
|
2143
2223
|
|
|
2144
2224
|
Metrics/PerceivedComplexity:
|
|
2145
2225
|
Description: >-
|
|
@@ -2181,6 +2261,7 @@ Naming/BinaryOperatorParameterName:
|
|
|
2181
2261
|
StyleGuide: '#other-arg'
|
|
2182
2262
|
Enabled: true
|
|
2183
2263
|
VersionAdded: '0.50'
|
|
2264
|
+
VersionChanged: '1.2'
|
|
2184
2265
|
|
|
2185
2266
|
Naming/BlockParameterName:
|
|
2186
2267
|
Description: >-
|
|
@@ -2287,6 +2368,7 @@ Naming/HeredocDelimiterCase:
|
|
|
2287
2368
|
StyleGuide: '#heredoc-delimiters'
|
|
2288
2369
|
Enabled: true
|
|
2289
2370
|
VersionAdded: '0.50'
|
|
2371
|
+
VersionChanged: '1.2'
|
|
2290
2372
|
EnforcedStyle: uppercase
|
|
2291
2373
|
SupportedStyles:
|
|
2292
2374
|
- lowercase
|
|
@@ -2305,7 +2387,7 @@ Naming/MemoizedInstanceVariableName:
|
|
|
2305
2387
|
Memoized method name should match memo instance variable name.
|
|
2306
2388
|
Enabled: true
|
|
2307
2389
|
VersionAdded: '0.53'
|
|
2308
|
-
VersionChanged: '
|
|
2390
|
+
VersionChanged: '1.2'
|
|
2309
2391
|
EnforcedStyleForLeadingUnderscores: disallowed
|
|
2310
2392
|
SupportedStylesForLeadingUnderscores:
|
|
2311
2393
|
- disallowed
|
|
@@ -2403,14 +2485,25 @@ Naming/VariableName:
|
|
|
2403
2485
|
- camelCase
|
|
2404
2486
|
|
|
2405
2487
|
Naming/VariableNumber:
|
|
2406
|
-
Description: 'Use the configured style when numbering variables.'
|
|
2488
|
+
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
|
2489
|
+
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
|
|
2407
2490
|
Enabled: true
|
|
2408
2491
|
VersionAdded: '0.50'
|
|
2492
|
+
VersionChanged: '1.4'
|
|
2409
2493
|
EnforcedStyle: normalcase
|
|
2410
2494
|
SupportedStyles:
|
|
2411
2495
|
- snake_case
|
|
2412
2496
|
- normalcase
|
|
2413
2497
|
- non_integer
|
|
2498
|
+
CheckMethodNames: true
|
|
2499
|
+
CheckSymbols: true
|
|
2500
|
+
AllowedIdentifiers:
|
|
2501
|
+
- capture3 # Open3.capture3
|
|
2502
|
+
- iso8601 # Time#iso8601
|
|
2503
|
+
- rfc1123_date # CGI.rfc1123_date
|
|
2504
|
+
- rfc822 # Time#rfc822
|
|
2505
|
+
- rfc2822 # Time#rfc2822
|
|
2506
|
+
- rfc3339 # DateTime.rfc3339
|
|
2414
2507
|
|
|
2415
2508
|
#################### Security ##############################
|
|
2416
2509
|
|
|
@@ -2789,6 +2882,13 @@ Style/ClassVars:
|
|
|
2789
2882
|
Enabled: true
|
|
2790
2883
|
VersionAdded: '0.13'
|
|
2791
2884
|
|
|
2885
|
+
Style/CollectionCompact:
|
|
2886
|
+
Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
|
|
2887
|
+
Enabled: pending
|
|
2888
|
+
Safe: false
|
|
2889
|
+
VersionAdded: '1.2'
|
|
2890
|
+
VersionChanged: '1.3'
|
|
2891
|
+
|
|
2792
2892
|
# Align with the style guide.
|
|
2793
2893
|
Style/CollectionMethods:
|
|
2794
2894
|
Description: 'Preferred collection methods.'
|
|
@@ -2852,17 +2952,18 @@ Style/CommandLiteral:
|
|
|
2852
2952
|
Style/CommentAnnotation:
|
|
2853
2953
|
Description: >-
|
|
2854
2954
|
Checks formatting of special comments
|
|
2855
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
|
2955
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
|
|
2856
2956
|
StyleGuide: '#annotate-keywords'
|
|
2857
2957
|
Enabled: true
|
|
2858
2958
|
VersionAdded: '0.10'
|
|
2859
|
-
VersionChanged: '
|
|
2959
|
+
VersionChanged: '1.3'
|
|
2860
2960
|
Keywords:
|
|
2861
2961
|
- TODO
|
|
2862
2962
|
- FIXME
|
|
2863
2963
|
- OPTIMIZE
|
|
2864
2964
|
- HACK
|
|
2865
2965
|
- REVIEW
|
|
2966
|
+
- NOTE
|
|
2866
2967
|
|
|
2867
2968
|
Style/CommentedKeyword:
|
|
2868
2969
|
Description: 'Do not place comments on the same line as certain keywords.'
|
|
@@ -2958,6 +3059,7 @@ Style/DocumentDynamicEvalDefinition:
|
|
|
2958
3059
|
StyleGuide: '#eval-comment-docs'
|
|
2959
3060
|
Enabled: pending
|
|
2960
3061
|
VersionAdded: '1.1'
|
|
3062
|
+
VersionChanged: '1.3'
|
|
2961
3063
|
|
|
2962
3064
|
Style/Documentation:
|
|
2963
3065
|
Description: 'Document classes and non-namespace modules.'
|
|
@@ -2986,7 +3088,7 @@ Style/DoubleNegation:
|
|
|
2986
3088
|
StyleGuide: '#no-bang-bang'
|
|
2987
3089
|
Enabled: true
|
|
2988
3090
|
VersionAdded: '0.19'
|
|
2989
|
-
VersionChanged: '
|
|
3091
|
+
VersionChanged: '1.2'
|
|
2990
3092
|
EnforcedStyle: allowed_in_returns
|
|
2991
3093
|
SafeAutoCorrect: false
|
|
2992
3094
|
SupportedStyles:
|
|
@@ -3107,9 +3209,10 @@ Style/ExponentialNotation:
|
|
|
3107
3209
|
Style/FloatDivision:
|
|
3108
3210
|
Description: 'For performing float division, coerce one side only.'
|
|
3109
3211
|
StyleGuide: '#float-division'
|
|
3110
|
-
Reference: 'https://
|
|
3212
|
+
Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
|
3111
3213
|
Enabled: true
|
|
3112
3214
|
VersionAdded: '0.72'
|
|
3215
|
+
VersionChanged: '1.6'
|
|
3113
3216
|
EnforcedStyle: single_coerce
|
|
3114
3217
|
SupportedStyles:
|
|
3115
3218
|
- left_coerce
|
|
@@ -3285,6 +3388,7 @@ Style/IfInsideElse:
|
|
|
3285
3388
|
Enabled: true
|
|
3286
3389
|
AllowIfModifier: false
|
|
3287
3390
|
VersionAdded: '0.36'
|
|
3391
|
+
VersionChanged: '1.3'
|
|
3288
3392
|
|
|
3289
3393
|
Style/IfUnlessModifier:
|
|
3290
3394
|
Description: >-
|
|
@@ -3317,12 +3421,14 @@ Style/ImplicitRuntimeError:
|
|
|
3317
3421
|
VersionAdded: '0.41'
|
|
3318
3422
|
|
|
3319
3423
|
Style/InfiniteLoop:
|
|
3320
|
-
Description:
|
|
3424
|
+
Description: >-
|
|
3425
|
+
Use Kernel#loop for infinite loops.
|
|
3426
|
+
This cop is unsafe in the body may raise a `StopIteration` exception.
|
|
3427
|
+
Safe: false
|
|
3321
3428
|
StyleGuide: '#infinite-loop'
|
|
3322
3429
|
Enabled: true
|
|
3323
3430
|
VersionAdded: '0.26'
|
|
3324
3431
|
VersionChanged: '0.61'
|
|
3325
|
-
SafeAutoCorrect: true
|
|
3326
3432
|
|
|
3327
3433
|
Style/InlineComment:
|
|
3328
3434
|
Description: 'Avoid trailing inline comments.'
|
|
@@ -3611,6 +3717,13 @@ Style/NegatedIf:
|
|
|
3611
3717
|
- prefix
|
|
3612
3718
|
- postfix
|
|
3613
3719
|
|
|
3720
|
+
Style/NegatedIfElseCondition:
|
|
3721
|
+
Description: >-
|
|
3722
|
+
This cop checks for uses of `if-else` and ternary operators with a negated condition
|
|
3723
|
+
which can be simplified by inverting condition and swapping branches.
|
|
3724
|
+
Enabled: pending
|
|
3725
|
+
VersionAdded: '1.2'
|
|
3726
|
+
|
|
3614
3727
|
Style/NegatedUnless:
|
|
3615
3728
|
Description: 'Favor if over unless for negative conditions.'
|
|
3616
3729
|
StyleGuide: '#if-for-negatives'
|
|
@@ -3698,6 +3811,11 @@ Style/NilComparison:
|
|
|
3698
3811
|
- predicate
|
|
3699
3812
|
- comparison
|
|
3700
3813
|
|
|
3814
|
+
Style/NilLambda:
|
|
3815
|
+
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
|
3816
|
+
Enabled: pending
|
|
3817
|
+
VersionAdded: '1.3'
|
|
3818
|
+
|
|
3701
3819
|
Style/NonNilCheck:
|
|
3702
3820
|
Description: 'Checks for redundant nil checks.'
|
|
3703
3821
|
StyleGuide: '#no-non-nil-checks'
|
|
@@ -3847,7 +3965,7 @@ Style/PercentLiteralDelimiters:
|
|
|
3847
3965
|
'%r': '{}'
|
|
3848
3966
|
'%w': '[]'
|
|
3849
3967
|
'%W': '[]'
|
|
3850
|
-
VersionChanged: '0.48
|
|
3968
|
+
VersionChanged: '0.48'
|
|
3851
3969
|
|
|
3852
3970
|
Style/PercentQLiterals:
|
|
3853
3971
|
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
|
@@ -3888,11 +4006,12 @@ Style/RaiseArgs:
|
|
|
3888
4006
|
StyleGuide: '#exception-class-messages'
|
|
3889
4007
|
Enabled: true
|
|
3890
4008
|
VersionAdded: '0.14'
|
|
3891
|
-
VersionChanged: '
|
|
4009
|
+
VersionChanged: '1.2'
|
|
3892
4010
|
EnforcedStyle: exploded
|
|
3893
4011
|
SupportedStyles:
|
|
3894
4012
|
- compact # raise Exception.new(msg)
|
|
3895
4013
|
- exploded # raise Exception, msg
|
|
4014
|
+
AllowedCompactTypes: []
|
|
3896
4015
|
|
|
3897
4016
|
Style/RandomWithOffset:
|
|
3898
4017
|
Description: >-
|
|
@@ -3902,6 +4021,18 @@ Style/RandomWithOffset:
|
|
|
3902
4021
|
Enabled: true
|
|
3903
4022
|
VersionAdded: '0.52'
|
|
3904
4023
|
|
|
4024
|
+
Style/RedundantArgument:
|
|
4025
|
+
Description: 'Check for a redundant argument passed to certain methods.'
|
|
4026
|
+
Enabled: pending
|
|
4027
|
+
Safe: false
|
|
4028
|
+
VersionAdded: '1.4'
|
|
4029
|
+
VersionChanged: '1.6'
|
|
4030
|
+
Methods:
|
|
4031
|
+
# Array#join
|
|
4032
|
+
join: ''
|
|
4033
|
+
# String#split
|
|
4034
|
+
split: ' '
|
|
4035
|
+
|
|
3905
4036
|
Style/RedundantAssignment:
|
|
3906
4037
|
Description: 'Checks for redundant assignment before returning.'
|
|
3907
4038
|
Enabled: true
|
|
@@ -4143,7 +4274,7 @@ Style/SingleLineBlockParams:
|
|
|
4143
4274
|
Description: 'Enforces the names of some block params.'
|
|
4144
4275
|
Enabled: false
|
|
4145
4276
|
VersionAdded: '0.16'
|
|
4146
|
-
VersionChanged: '
|
|
4277
|
+
VersionChanged: '1.6'
|
|
4147
4278
|
Methods:
|
|
4148
4279
|
- reduce:
|
|
4149
4280
|
- acc
|
|
@@ -4172,6 +4303,7 @@ Style/SoleNestedConditional:
|
|
|
4172
4303
|
which can be merged into outer conditional node.
|
|
4173
4304
|
Enabled: true
|
|
4174
4305
|
VersionAdded: '0.89'
|
|
4306
|
+
VersionChanged: '1.5'
|
|
4175
4307
|
AllowModifier: false
|
|
4176
4308
|
|
|
4177
4309
|
Style/SpecialGlobalVars:
|
|
@@ -4196,6 +4328,13 @@ Style/StabbyLambdaParentheses:
|
|
|
4196
4328
|
- require_parentheses
|
|
4197
4329
|
- require_no_parentheses
|
|
4198
4330
|
|
|
4331
|
+
Style/StaticClass:
|
|
4332
|
+
Description: 'Prefer modules to classes with only class methods.'
|
|
4333
|
+
StyleGuide: '#modules-vs-classes'
|
|
4334
|
+
Enabled: false
|
|
4335
|
+
Safe: false
|
|
4336
|
+
VersionAdded: '1.3'
|
|
4337
|
+
|
|
4199
4338
|
Style/StderrPuts:
|
|
4200
4339
|
Description: 'Use `warn` instead of `$stderr.puts`.'
|
|
4201
4340
|
StyleGuide: '#warn'
|
|
@@ -4208,6 +4347,7 @@ Style/StringConcatenation:
|
|
|
4208
4347
|
Enabled: true
|
|
4209
4348
|
Safe: false
|
|
4210
4349
|
VersionAdded: '0.89'
|
|
4350
|
+
VersionChanged: '1.6'
|
|
4211
4351
|
|
|
4212
4352
|
Style/StringHashKeys:
|
|
4213
4353
|
Description: 'Prefer symbols instead of strings as hash keys.'
|
|
@@ -4246,7 +4386,7 @@ Style/StringMethods:
|
|
|
4246
4386
|
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
|
4247
4387
|
Enabled: false
|
|
4248
4388
|
VersionAdded: '0.34'
|
|
4249
|
-
VersionChanged: '0.34
|
|
4389
|
+
VersionChanged: '0.34'
|
|
4250
4390
|
# Mapping from undesired method to desired_method
|
|
4251
4391
|
# e.g. to use `to_sym` over `intern`:
|
|
4252
4392
|
#
|
|
@@ -4297,7 +4437,7 @@ Style/SymbolProc:
|
|
|
4297
4437
|
Enabled: true
|
|
4298
4438
|
Safe: false
|
|
4299
4439
|
VersionAdded: '0.26'
|
|
4300
|
-
VersionChanged: '
|
|
4440
|
+
VersionChanged: '1.5'
|
|
4301
4441
|
# A list of method names to be ignored by the check.
|
|
4302
4442
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
|
4303
4443
|
IgnoredMethods:
|
data/lib/cookstyle/version.rb
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# Copyright:: 2020, 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
|
+
# Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/master/chef-utils#getting-started
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
#
|
|
26
|
+
# # bad
|
|
27
|
+
# vagrant_key?
|
|
28
|
+
# vagrant_domain?
|
|
29
|
+
# vagrant_user?
|
|
30
|
+
# require_chef_gem
|
|
31
|
+
# best_ip_for(node)
|
|
32
|
+
# nexus?
|
|
33
|
+
# ios_xr?
|
|
34
|
+
# ruby_20?
|
|
35
|
+
# ruby_19?
|
|
36
|
+
# includes_recipe?('foo::bar')
|
|
37
|
+
# wrlinux?
|
|
38
|
+
# dev_null
|
|
39
|
+
# nexentacore_platform?
|
|
40
|
+
# opensolaris_platform?
|
|
41
|
+
# nexentacore?
|
|
42
|
+
# opensolaris?
|
|
43
|
+
#
|
|
44
|
+
module Deprecations
|
|
45
|
+
class ChefSugarHelpers < Base
|
|
46
|
+
MSG = 'Do not use legacy chef-sugar helper methods, which will not be moved into Chef Infra Client itself. For a complete set of chef-sugar helpers now shipping in Chef Infra Client itself see https://github.com/chef/chef/tree/master/chef-utils#getting-started'
|
|
47
|
+
RESTRICT_ON_SEND = [:vagrant_key?, :vagrant_domain?, :vagrant_user?, :require_chef_gem, :best_ip_for, :nexus?, :ios_xr?, :ruby_20?, :ruby_19?, :includes_recipe?, :wrlinux?, :dev_null, :nexentacore_platform?, :opensolaris_platform?, :nexentacore?, :opensolaris?].freeze
|
|
48
|
+
|
|
49
|
+
def on_send(node)
|
|
50
|
+
add_offense(node, message: MSG, severity: :refactor)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -55,7 +55,7 @@ module RuboCop
|
|
|
55
55
|
'< 11' => true,
|
|
56
56
|
},
|
|
57
57
|
'mac_os_x' => {
|
|
58
|
-
'< 10.
|
|
58
|
+
'< 10.14' => '10.15',
|
|
59
59
|
},
|
|
60
60
|
'suse' => {
|
|
61
61
|
'~> 12.0, < 12.4' => '12',
|
|
@@ -67,8 +67,7 @@ module RuboCop
|
|
|
67
67
|
'= 15.0' => '15',
|
|
68
68
|
},
|
|
69
69
|
'debian' => {
|
|
70
|
-
'<
|
|
71
|
-
'> 8.0, < 8.11' => '8',
|
|
70
|
+
'< 9' => true,
|
|
72
71
|
'> 9.0, < 9.11' => '9',
|
|
73
72
|
},
|
|
74
73
|
'centos' => {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# Copyright:: 2020, 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 Deprecations
|
|
22
|
+
# With the release of Chef Infra Client 12.14 and the yum cookbook 3.0 the actions the yum_repository resource actions were renamed. The `add` action became `create` and `delete` became `remove` to better match other resources in Chef Infra Client.
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
#
|
|
26
|
+
# # bad
|
|
27
|
+
# yum_repository 'OurCo' do
|
|
28
|
+
# description 'OurCo yum repository'
|
|
29
|
+
# baseurl 'http://artifacts.ourco.org/foo/bar'
|
|
30
|
+
# gpgkey 'http://artifacts.ourco.org/pub/yum/RPM-GPG-KEY-OURCO-6'
|
|
31
|
+
# action :add
|
|
32
|
+
# end
|
|
33
|
+
#
|
|
34
|
+
# # good
|
|
35
|
+
# yum_repository 'OurCo' do
|
|
36
|
+
# description 'OurCo yum repository'
|
|
37
|
+
# baseurl 'http://artifacts.ourco.org/foo/bar'
|
|
38
|
+
# gpgkey 'http://artifacts.ourco.org/pub/yum/RPM-GPG-KEY-OURCO-6'
|
|
39
|
+
# action :create
|
|
40
|
+
# end
|
|
41
|
+
#
|
|
42
|
+
class DeprecatedYumRepositoryActions < Base
|
|
43
|
+
include RuboCop::Chef::CookbookHelpers
|
|
44
|
+
extend TargetChefVersion
|
|
45
|
+
extend AutoCorrector
|
|
46
|
+
|
|
47
|
+
minimum_target_chef_version '12.14'
|
|
48
|
+
|
|
49
|
+
MSG = 'With the release of Chef Infra Client 12.14 and the yum cookbook 3.0 several properties in the yum_repository resource the actions the yum_repository resource actions were renamed. The `add` action became `create` and `delete` became `remove` to better match other resources in Chef Infra Client.'
|
|
50
|
+
|
|
51
|
+
def on_block(node)
|
|
52
|
+
match_property_in_resource?(:yum_repository, 'action', node) do |prop_node|
|
|
53
|
+
next unless prop_node.arguments.first.sym_type?
|
|
54
|
+
next unless [s(:sym, :add), s(:sym, :delete)].include?(prop_node.arguments.first)
|
|
55
|
+
|
|
56
|
+
add_offense(prop_node, message: MSG, severity: :warning) do |corrector|
|
|
57
|
+
corrector.replace(prop_node, prop_node.source
|
|
58
|
+
.gsub('add', 'create')
|
|
59
|
+
.gsub('delete', 'remove'))
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# Copyright:: 2020, 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 Deprecations
|
|
22
|
+
# The Foodcritic cookbook linter has been deprecated and should no longer be used for validating cookbooks.
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
#
|
|
26
|
+
# # bad
|
|
27
|
+
# gem 'foodcritic'
|
|
28
|
+
# require 'foodcritic'
|
|
29
|
+
#
|
|
30
|
+
class FoodcriticTesting < Base
|
|
31
|
+
MSG = 'The Foodcritic cookbook linter has been deprecated and should no longer be used for validating cookbooks.'
|
|
32
|
+
RESTRICT_ON_SEND = [:require, :gem].freeze
|
|
33
|
+
|
|
34
|
+
def on_send(node)
|
|
35
|
+
return unless node.arguments.first == s(:str, 'foodcritic')
|
|
36
|
+
|
|
37
|
+
add_offense(node, message: MSG, severity: :warning)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# Copyright:: 2020, 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 Deprecations
|
|
22
|
+
# The Librarian-Chef depsolving project is no longer maintained and a Cheffile should not be used for cookbook depsolving. Consider using Policyfiles instead.
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
#
|
|
26
|
+
# # bad
|
|
27
|
+
# require 'chefspec/librarian'
|
|
28
|
+
#
|
|
29
|
+
class LibrarianChefSpec < Base
|
|
30
|
+
MSG = 'The Librarian-Chef depsolving project is no longer maintained and ChefSpec should not use Librarian-Chef for cookbook depsolving. Consider using Policyfiles instead.'
|
|
31
|
+
RESTRICT_ON_SEND = [:require].freeze
|
|
32
|
+
|
|
33
|
+
def on_send(node)
|
|
34
|
+
return unless node.arguments.first == s(:str, 'chefspec/librarian')
|
|
35
|
+
|
|
36
|
+
add_offense(node, message: MSG, severity: :warning)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -60,8 +60,8 @@ module RuboCop
|
|
|
60
60
|
(lvar _))}) nil?)
|
|
61
61
|
PATTERN
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
(block
|
|
63
|
+
def_node_search :package_array_install, <<-PATTERN
|
|
64
|
+
$(block
|
|
65
65
|
(send
|
|
66
66
|
$(array ... ) :each)
|
|
67
67
|
(args ... )
|
|
@@ -78,27 +78,31 @@ module RuboCop
|
|
|
78
78
|
# see if all platforms in the when condition are multi-package compliant
|
|
79
79
|
def multipackage_platforms?(condition_obj)
|
|
80
80
|
condition_obj.all? do |p|
|
|
81
|
-
|
|
81
|
+
# make sure it's a string (not a regex) and it's in the array
|
|
82
|
+
p.str_type? && MULTIPACKAGE_PLATS.include?(p.value)
|
|
82
83
|
end
|
|
83
84
|
end
|
|
84
85
|
|
|
85
86
|
def on_when(node)
|
|
86
87
|
return unless platform_or_platform_family?(node.parent.condition) &&
|
|
87
|
-
package_array_install?(node.body) &&
|
|
88
88
|
multipackage_platforms?(node.conditions)
|
|
89
|
-
|
|
89
|
+
return if node.body.nil? # don't blow up on empty whens
|
|
90
|
+
|
|
91
|
+
package_array_install(node.body) do |install_block, pkgs|
|
|
92
|
+
add_offense(install_block, message: MSG, severity: :refactor) do |corrector|
|
|
93
|
+
corrector.replace(install_block, "package #{pkgs.source}")
|
|
94
|
+
end
|
|
95
|
+
end
|
|
90
96
|
end
|
|
91
97
|
|
|
92
98
|
def on_if(node)
|
|
93
99
|
platform_helper?(node) do |plats, blk, _pkgs|
|
|
94
|
-
|
|
95
|
-
end
|
|
96
|
-
end
|
|
100
|
+
return unless multipackage_platforms?(plats)
|
|
97
101
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
add_offense(blk, message: MSG, severity: :refactor) do |corrector|
|
|
103
|
+
package_array_install(blk) do |install_block, pkgs|
|
|
104
|
+
corrector.replace(install_block, "package #{pkgs.source}")
|
|
105
|
+
end
|
|
102
106
|
end
|
|
103
107
|
end
|
|
104
108
|
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.4.0
|
|
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
|
+
date: 2020-12-21 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.1
|
|
20
|
+
version: 1.6.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.1
|
|
27
|
+
version: 1.6.1
|
|
28
28
|
description:
|
|
29
29
|
email:
|
|
30
30
|
- thom@chef.io
|
|
@@ -92,6 +92,7 @@ files:
|
|
|
92
92
|
- lib/rubocop/cop/chef/deprecation/chef_rest.rb
|
|
93
93
|
- lib/rubocop/cop/chef/deprecation/chef_rewind.rb
|
|
94
94
|
- lib/rubocop/cop/chef/deprecation/chef_shellout.rb
|
|
95
|
+
- lib/rubocop/cop/chef/deprecation/chef_sugar_helpers.rb
|
|
95
96
|
- lib/rubocop/cop/chef/deprecation/chef_windows_platform_helper.rb
|
|
96
97
|
- lib/rubocop/cop/chef/deprecation/chefdk_generators.rb
|
|
97
98
|
- lib/rubocop/cop/chef/deprecation/cheffile.rb
|
|
@@ -106,6 +107,7 @@ files:
|
|
|
106
107
|
- lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb
|
|
107
108
|
- lib/rubocop/cop/chef/deprecation/deprecated_shellout_methods.rb
|
|
108
109
|
- lib/rubocop/cop/chef/deprecation/deprecated_windows_version_check.rb
|
|
110
|
+
- lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_actions.rb
|
|
109
111
|
- lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_properties.rb
|
|
110
112
|
- lib/rubocop/cop/chef/deprecation/easy_install.rb
|
|
111
113
|
- lib/rubocop/cop/chef/deprecation/eol_audit_mode.rb
|
|
@@ -113,11 +115,13 @@ files:
|
|
|
113
115
|
- lib/rubocop/cop/chef/deprecation/erl_call.rb
|
|
114
116
|
- lib/rubocop/cop/chef/deprecation/execute_path_property.rb
|
|
115
117
|
- lib/rubocop/cop/chef/deprecation/execute_relative_creates_without_cwd.rb
|
|
118
|
+
- lib/rubocop/cop/chef/deprecation/foodcritic_testing.rb
|
|
116
119
|
- lib/rubocop/cop/chef/deprecation/hwrp_without_provides.rb
|
|
117
120
|
- lib/rubocop/cop/chef/deprecation/inherits_compat_resource.rb
|
|
118
121
|
- lib/rubocop/cop/chef/deprecation/launchd_deprecated_hash_property.rb
|
|
119
122
|
- lib/rubocop/cop/chef/deprecation/legacy_notify_syntax.rb
|
|
120
123
|
- lib/rubocop/cop/chef/deprecation/legacy_yum_cookbook_recipes.rb
|
|
124
|
+
- lib/rubocop/cop/chef/deprecation/librarian_chefspec.rb
|
|
121
125
|
- lib/rubocop/cop/chef/deprecation/locale_lc_all_property.rb
|
|
122
126
|
- lib/rubocop/cop/chef/deprecation/log_resource_notifications.rb
|
|
123
127
|
- lib/rubocop/cop/chef/deprecation/macos_userdefaults_global_property.rb
|