cookstyle 6.17.6 → 6.20.1

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.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -1
  3. data/bin/cookstyle +0 -1
  4. data/config/cookstyle.yml +89 -15
  5. data/config/disable_all.yml +14 -0
  6. data/config/upstream.yml +82 -3
  7. data/cookstyle.gemspec +2 -3
  8. data/lib/cookstyle.rb +5 -5
  9. data/lib/cookstyle/version.rb +2 -2
  10. data/lib/rubocop/cop/chef/correctness/block_guard_clause_string_only.rb +1 -1
  11. data/lib/rubocop/cop/chef/correctness/chef_application_fatal.rb +2 -1
  12. data/lib/rubocop/cop/chef/correctness/conditional_ruby_shellout.rb +1 -1
  13. data/lib/rubocop/cop/chef/correctness/incorrect_library_injection.rb +24 -14
  14. data/lib/rubocop/cop/chef/correctness/invalid_platform_family_values_in_case.rb +1 -1
  15. data/lib/rubocop/cop/chef/correctness/invalid_platform_metadata.rb +2 -2
  16. data/lib/rubocop/cop/chef/correctness/invalid_platform_values_in_case.rb +2 -1
  17. data/lib/rubocop/cop/chef/correctness/invalid_version_metadata.rb +1 -0
  18. data/lib/rubocop/cop/chef/correctness/lazy_eval_node_attribute_defaults.rb +1 -1
  19. data/lib/rubocop/cop/chef/correctness/lazy_in_resource_guard.rb +67 -0
  20. data/lib/rubocop/cop/chef/correctness/macos_userdefaults_invalid_type.rb +2 -2
  21. data/lib/rubocop/cop/chef/correctness/node_normal.rb +1 -0
  22. data/lib/rubocop/cop/chef/correctness/node_normal_unless.rb +1 -0
  23. data/lib/rubocop/cop/chef/correctness/node_save.rb +1 -0
  24. data/lib/rubocop/cop/chef/correctness/notifies_action_not_symbol.rb +1 -1
  25. data/lib/rubocop/cop/chef/correctness/property_without_type.rb +59 -0
  26. data/lib/rubocop/cop/chef/correctness/resource_with_none_action.rb +1 -1
  27. data/lib/rubocop/cop/chef/correctness/scoped_file_exist.rb +1 -1
  28. data/lib/rubocop/cop/chef/correctness/supports_must_be_float.rb +2 -2
  29. data/lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb +1 -1
  30. data/lib/rubocop/cop/chef/deprecation/chef_rewind.rb +2 -2
  31. data/lib/rubocop/cop/chef/deprecation/chef_shellout.rb +2 -2
  32. data/lib/rubocop/cop/chef/deprecation/chef_windows_platform_helper.rb +2 -1
  33. data/lib/rubocop/cop/chef/deprecation/chefdk_generators.rb +1 -1
  34. data/lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb +1 -1
  35. data/lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb +1 -1
  36. data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +1 -3
  37. data/lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb +1 -0
  38. data/lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_properties.rb +1 -1
  39. data/lib/rubocop/cop/chef/deprecation/epic_fail.rb +1 -1
  40. data/lib/rubocop/cop/chef/deprecation/execute_path_property.rb +1 -1
  41. data/lib/rubocop/cop/chef/deprecation/execute_relative_creates_without_cwd.rb +1 -1
  42. data/lib/rubocop/cop/chef/deprecation/inherits_compat_resource.rb +1 -1
  43. data/lib/rubocop/cop/chef/deprecation/legacy_notify_syntax.rb +2 -2
  44. data/lib/rubocop/cop/chef/deprecation/node_deep_fetch.rb +2 -0
  45. data/lib/rubocop/cop/chef/deprecation/node_methods_not_attributes.rb +22 -27
  46. data/lib/rubocop/cop/chef/deprecation/node_set.rb +1 -0
  47. data/lib/rubocop/cop/chef/deprecation/node_set_unless.rb +1 -0
  48. data/lib/rubocop/cop/chef/deprecation/node_set_without_level.rb +1 -0
  49. data/lib/rubocop/cop/chef/deprecation/partial_search_class_usage.rb +1 -0
  50. data/lib/rubocop/cop/chef/deprecation/powershell_cookbook_helpers.rb +2 -1
  51. data/lib/rubocop/cop/chef/deprecation/resource_overrides_provides_method.rb +2 -2
  52. data/lib/rubocop/cop/chef/deprecation/ruby_27_keyword_argument_warnings.rb +2 -2
  53. data/lib/rubocop/cop/chef/deprecation/ruby_block_create_action.rb +2 -2
  54. data/lib/rubocop/cop/chef/deprecation/search_uses_positional_parameters.rb +1 -1
  55. data/lib/rubocop/cop/chef/deprecation/user_supports_property.rb +1 -1
  56. data/lib/rubocop/cop/chef/deprecation/windows_package_installer_type_string.rb +1 -1
  57. data/lib/rubocop/cop/chef/deprecation/windows_task_change_action.rb +2 -2
  58. data/lib/rubocop/cop/chef/deprecation/windows_version_helpers.rb +5 -4
  59. data/lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb +1 -1
  60. data/lib/rubocop/cop/chef/effortless/chef_vault_used.rb +89 -0
  61. data/lib/rubocop/cop/chef/effortless/depends_chef_vault.rb +49 -0
  62. data/lib/rubocop/cop/chef/modernize/action_method_in_resource.rb +2 -2
  63. data/lib/rubocop/cop/chef/modernize/berksfile_source.rb +2 -2
  64. data/lib/rubocop/cop/chef/modernize/build_essential.rb +1 -1
  65. data/lib/rubocop/cop/chef/modernize/compile_time_resources.rb +1 -0
  66. data/lib/rubocop/cop/chef/modernize/conditional_using_test.rb +2 -2
  67. data/lib/rubocop/cop/chef/modernize/cron_manage_resource.rb +1 -1
  68. data/lib/rubocop/cop/chef/modernize/databag_helpers.rb +2 -1
  69. data/lib/rubocop/cop/chef/modernize/foodcritic_comments.rb +1 -1
  70. data/lib/rubocop/cop/chef/modernize/if_provides_default_action.rb +1 -1
  71. data/lib/rubocop/cop/chef/modernize/libarchive_file.rb +2 -2
  72. data/lib/rubocop/cop/chef/modernize/macos_user_defaults.rb +1 -1
  73. data/lib/rubocop/cop/chef/modernize/node_init_package.rb +5 -4
  74. data/lib/rubocop/cop/chef/modernize/node_roles_include.rb +2 -1
  75. data/lib/rubocop/cop/chef/modernize/openssl_rsa_key_resource.rb +1 -1
  76. data/lib/rubocop/cop/chef/modernize/openssl_x509_resource.rb +1 -1
  77. data/lib/rubocop/cop/chef/modernize/osx_config_profile_resource.rb +1 -1
  78. data/lib/rubocop/cop/chef/modernize/property_with_name_attribute.rb +1 -1
  79. data/lib/rubocop/cop/chef/modernize/respond_to_compile_time.rb +7 -4
  80. data/lib/rubocop/cop/chef/modernize/respond_to_metadata.rb +6 -6
  81. data/lib/rubocop/cop/chef/modernize/respond_to_provides.rb +10 -10
  82. data/lib/rubocop/cop/chef/modernize/respond_to_resource_name.rb +2 -2
  83. data/lib/rubocop/cop/chef/modernize/shell_out_helper.rb +2 -1
  84. data/lib/rubocop/cop/chef/modernize/simplify_apt_ppa_setup.rb +1 -1
  85. data/lib/rubocop/cop/chef/modernize/sysctl_param_resource.rb +1 -1
  86. data/lib/rubocop/cop/chef/modernize/use_multipackage_installs.rb +1 -1
  87. data/lib/rubocop/cop/chef/modernize/use_require_relative.rb +1 -1
  88. data/lib/rubocop/cop/chef/modernize/zypper_repo.rb +1 -1
  89. data/lib/rubocop/cop/chef/redundant/double_compile_time.rb +2 -1
  90. data/lib/rubocop/cop/chef/redundant/multiple_platform_checks.rb +1 -1
  91. data/lib/rubocop/cop/chef/redundant/name_property_and_required.rb +1 -0
  92. data/lib/rubocop/cop/chef/redundant/ohai_attribute_to_string.rb +2 -1
  93. data/lib/rubocop/cop/chef/redundant/property_splat_regex.rb +1 -0
  94. data/lib/rubocop/cop/chef/redundant/use_create_if_missing.rb +1 -1
  95. data/lib/rubocop/cop/chef/sharing/include_property_descriptions.rb +1 -1
  96. data/lib/rubocop/cop/chef/sharing/insecure_cookbook_url.rb +1 -1
  97. data/lib/rubocop/cop/chef/sharing/invalid_license_string.rb +1 -1
  98. data/lib/rubocop/cop/chef/style/attribute_keys.rb +2 -1
  99. data/lib/rubocop/cop/chef/style/chef_whaaat.rb +1 -1
  100. data/lib/rubocop/cop/chef/style/comment_sentence_spacing.rb +2 -2
  101. data/lib/rubocop/cop/chef/style/comments_copyright_format.rb +2 -2
  102. data/lib/rubocop/cop/chef/style/comments_default_copyright.rb +1 -1
  103. data/lib/rubocop/cop/chef/style/comments_format.rb +6 -13
  104. data/lib/rubocop/cop/chef/style/file_mode.rb +2 -2
  105. data/lib/rubocop/cop/chef/style/immediate_notification_timing.rb +2 -2
  106. data/lib/rubocop/cop/chef/style/include_recipe_with_parentheses.rb +2 -2
  107. data/lib/rubocop/cop/chef/style/negating_only_if.rb +2 -2
  108. data/lib/rubocop/cop/chef/style/overly_complex_supports_depends_metadata.rb +2 -2
  109. data/lib/rubocop/cop/chef/style/simplify_platform_major_version_check.rb +2 -1
  110. data/lib/rubocop/cop/chef/style/true_false_resource_properties.rb +2 -2
  111. data/lib/rubocop/cop/chef/style/unnecessary_os_check.rb +5 -4
  112. data/lib/rubocop/cop/chef/style/unnecessary_platform_case_statement.rb +2 -2
  113. data/lib/rubocop/cop/chef/style/use_platform_helpers.rb +7 -6
  114. metadata +9 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba71cee9089746fb000cf88734c03cd0017265baba00f7559ad9f31453ec8d78
4
- data.tar.gz: 57599dee847f9240cd882bf777cdc5b6a45649851725f0520c9f2704ff181b14
3
+ metadata.gz: 0de6166c99ad16d4105a50c4e599aeecd6d4a98d6e18d3a3b0464de54bc96d69
4
+ data.tar.gz: a38e62ad11d0d8286cdd1132cb3580dc6cdf2114788ae88c01651edfe7eeb5e3
5
5
  SHA512:
6
- metadata.gz: e54c382931bae26f96ddad4d54ed69f630d4ab02464dae8f5bbce300d0a0b552d765151dbc912456a34e8344b4517e98f520a839d20266d0f9a7e1d09b4eac0d
7
- data.tar.gz: 2ed745d40e3538b0681cdce2e896a8ae1b99c29fd0ca7d74dd0c007ebf1b13458cbf39d383a26aa26a932289e1badf796e06ab6f145046f305c301b9b634a792
6
+ metadata.gz: d69265f1bcb040b18b3073112f1afddc8c70e748108f0aa6c0f4c2fb3d506113342ac6874565e48331a4560815ab4757a96bebf1c88e44e15dbd707ea3f5b432
7
+ data.tar.gz: 0fe0d04ce0fde1a1bbdd60d6b2d42675e80726895efb4f812c192ec53d6b5270bded94a1318549573ca08d139172f17e66faa6f538dcfe4bc3eddf1dd96bd408
data/Gemfile CHANGED
@@ -17,8 +17,12 @@ group :docs do
17
17
  end
18
18
 
19
19
  group :profiling do
20
- gem 'stackprof'
21
20
  gem 'memory_profiler'
21
+ gem 'stackprof'
22
+ end
23
+
24
+ group :rubocop_gems do
25
+ gem 'rubocop-performance'
22
26
  end
23
27
 
24
28
  group :development do
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- # -*- encoding: utf-8 -*-
3
2
  # frozen_string_literal: true
4
3
 
5
4
  $LOAD_PATH.unshift File.join(__dir__, %w(.. lib))
@@ -451,6 +451,24 @@ ChefCorrectness/MacosUserdefaultsInvalidType:
451
451
  - '**/metadata.rb'
452
452
  - '**/Berksfile'
453
453
 
454
+ ChefCorrectness/LazyInResourceGuard:
455
+ Description: Using `lazy {}` within a resource guard (not_if/only_if) will cause failures and is unnecessary as resource guards are always lazily evaluated.
456
+ StyleGuide: '#chefcorrectnesslazyinresourceguard'
457
+ Enabled: true
458
+ VersionAdded: '6.18.0'
459
+ Exclude:
460
+ - '**/metadata.rb'
461
+ - '**/Berksfile'
462
+
463
+ ChefCorrectness/PropertyWithoutType:
464
+ Description: Custom resource properties or attributes should always define a type to help users understand the correct allowed values.
465
+ StyleGuide: '#chefcorrectnesspropertywithouttype'
466
+ Enabled: true
467
+ VersionAdded: '6.18.0'
468
+ Include:
469
+ - '**/libraries/*.rb'
470
+ - '**/resources/*.rb'
471
+
454
472
  ###############################
455
473
  # ChefSharing: Issues that prevent sharing code with other teams or with the Chef community in general
456
474
  ###############################
@@ -1912,6 +1930,25 @@ ChefEffortless/CookbookUsesDatabags:
1912
1930
  - '**/metadata.rb'
1913
1931
  - '**/Berksfile'
1914
1932
 
1933
+ # https://github.com/chef/cookstyle/issues/346
1934
+ ChefEffortless/ChefVaultUsed:
1935
+ Description: Cookbook uses Chef Vault, which cannot be used in the Effortless Infra pattern
1936
+ StyleGuide: '#chefeffortlesscookbookuseschefvault'
1937
+ Enabled: false
1938
+ VersionAdded: '6.19'
1939
+ Exclude:
1940
+ - '**/metadata.rb'
1941
+ - '**/Berksfile'
1942
+
1943
+ # https://github.com/chef/cookstyle/issues/346
1944
+ ChefEffortless/DependsChefVault:
1945
+ Description: Cookbook depends on Chef Vault, which cannot be used in the Effortless Infra pattern
1946
+ StyleGuide: '#chefeffortlesscookbookdependschefvault'
1947
+ Enabled: false
1948
+ VersionAdded: '6.19'
1949
+ Include:
1950
+ - '**/metadata.rb'
1951
+
1915
1952
  ChefEffortless/CookbookUsesEnvironments:
1916
1953
  Description: Cookbook uses environments, which cannot be used in the Effortless Infra pattern
1917
1954
  StyleGuide: '#chefeffortlesscookbookusesenvironments'
@@ -2343,21 +2380,6 @@ Lint/UselessSetterCall:
2343
2380
  Lint/Void:
2344
2381
  Enabled: true
2345
2382
 
2346
- ##### Additional rules we enable/disable over the rubocop 0.37 rules ago #####
2347
-
2348
- Layout/AlignParameters:
2349
- Enabled: false
2350
- Style/Encoding:
2351
- Enabled: false
2352
- Style/Alias:
2353
- Enabled: false
2354
- Layout/SpaceBeforeFirstArg:
2355
- Enabled: false
2356
- Style/ClassAndModuleChildren:
2357
- Enabled: false
2358
- Style/DoubleNegation:
2359
- Enabled: false
2360
-
2361
2383
  # file names don't matter in cookbooks
2362
2384
  Naming/FileName:
2363
2385
  Enabled: false
@@ -2658,3 +2680,55 @@ Style/RedundantAssignment:
2658
2680
  # alert on invalid ruby
2659
2681
  Lint/Syntax:
2660
2682
  Enabled: true
2683
+
2684
+ # remove extra requires like 'thread'
2685
+ Lint/RedundantRequireStatement:
2686
+ Enabled: true
2687
+
2688
+ # simplify stripping strings
2689
+ Style/Strip:
2690
+ Enabled: true
2691
+
2692
+ # simplify how you warn
2693
+ Style/StderrPuts:
2694
+ Enabled: true
2695
+
2696
+ # more code simplification
2697
+ Style/Sample:
2698
+ Enabled: true
2699
+
2700
+ # simpler returns
2701
+ Style/ReturnNil:
2702
+ Enabled: true
2703
+
2704
+ # use .sort when .sort_by isn't needed
2705
+ Style/RedundantSortBy:
2706
+ Enabled: true
2707
+
2708
+ # simplify getting min/max
2709
+ Style/RedundantSort:
2710
+ Enabled: true
2711
+
2712
+ # no need for .rb in requires
2713
+ Style/RedundantFileExtensionInRequire:
2714
+ Enabled: true
2715
+
2716
+ # more code you don't need
2717
+ Style/RedundantCondition:
2718
+ Enabled: true
2719
+
2720
+ # Ruby 2 makes these pointless
2721
+ Style/Encoding:
2722
+ Enabled: true
2723
+
2724
+ # Use __dir__ to simplify things
2725
+ Style/Dir:
2726
+ Enabled: true
2727
+
2728
+ # Use __FILE__ or __dir__ to simplify expand_paths
2729
+ Style/ExpandPathArguments:
2730
+ Enabled: true
2731
+
2732
+ # Avoid a safe navigation operator if we don't need it
2733
+ Lint/RedundantSafeNavigation:
2734
+ Enabled: true
@@ -25,6 +25,8 @@ Layout/ArrayAlignment:
25
25
  Enabled: false
26
26
  Layout/AssignmentIndentation:
27
27
  Enabled: false
28
+ Layout/BeginEndAlignment:
29
+ Enabled: false
28
30
  Layout/BlockAlignment:
29
31
  Enabled: false
30
32
  Layout/BlockEndNewline:
@@ -215,6 +217,8 @@ Lint/BooleanSymbol:
215
217
  Enabled: false
216
218
  Lint/CircularArgumentReference:
217
219
  Enabled: false
220
+ Lint/ConstantDefinitionInBlock:
221
+ Enabled: false
218
222
  Lint/ConstantResolution:
219
223
  Enabled: false
220
224
  Lint/Debugger:
@@ -265,8 +269,12 @@ Lint/FloatOutOfRange:
265
269
  Enabled: false
266
270
  Lint/FormatParameterMismatch:
267
271
  Enabled: false
272
+ Lint/HashCompareByIdentity:
273
+ Enabled: false
268
274
  Lint/HeredocMethodCallPosition:
269
275
  Enabled: false
276
+ Lint/IdentityComparison:
277
+ Enabled: false
270
278
  Lint/ImplicitStringConcatenation:
271
279
  Enabled: false
272
280
  Lint/InheritException:
@@ -321,6 +329,8 @@ Lint/RedundantCopEnableDirective:
321
329
  Enabled: false
322
330
  Lint/RedundantRequireStatement:
323
331
  Enabled: false
332
+ Lint/RedundantSafeNavigation:
333
+ Enabled: false
324
334
  Lint/RedundantSplatExpansion:
325
335
  Enabled: false
326
336
  Lint/RedundantStringCoercion:
@@ -395,6 +405,8 @@ Lint/UselessMethodDefinition:
395
405
  Enabled: false
396
406
  Lint/UselessSetterCall:
397
407
  Enabled: false
408
+ Lint/UselessTimes:
409
+ Enabled: false
398
410
  Lint/Void:
399
411
  Enabled: false
400
412
  Metrics/CyclomaticComplexity:
@@ -485,6 +497,8 @@ Style/ClassAndModuleChildren:
485
497
  Enabled: false
486
498
  Style/ClassCheck:
487
499
  Enabled: false
500
+ Style/ClassEqualityComparison:
501
+ Enabled: false
488
502
  Style/ClassMethods:
489
503
  Enabled: false
490
504
  Style/ClassMethodsDefinitions:
@@ -117,6 +117,8 @@ AllCops:
117
117
  # CacheRootDirectory is ~ (nil), which it is by default, the root will be
118
118
  # taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
119
119
  # `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
120
+ # The CacheRootDirectory can be overwritten by passing the `--cache-root` command
121
+ # line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.
120
122
  CacheRootDirectory: ~
121
123
  # It is possible for a malicious user to know the location of RuboCop's cache
122
124
  # directory by looking at CacheRootDirectory, and create a symlink in its
@@ -309,6 +311,19 @@ Layout/AssignmentIndentation:
309
311
  # But it can be overridden by setting this parameter
310
312
  IndentationWidth: ~
311
313
 
314
+ Layout/BeginEndAlignment:
315
+ Description: 'Align ends corresponding to begins correctly.'
316
+ Enabled: pending
317
+ VersionAdded: '0.91'
318
+ # The value `start_of_line` means that `end` should be aligned the start of the line
319
+ # where the `begin` keyword is.
320
+ # The value `begin` means that `end` should be aligned with the `begin` keyword.
321
+ EnforcedStyleAlignWith: start_of_line
322
+ SupportedStylesAlignWith:
323
+ - start_of_line
324
+ - begin
325
+ Severity: warning
326
+
312
327
  Layout/BlockAlignment:
313
328
  Description: 'Align block ends correctly.'
314
329
  Enabled: true
@@ -1380,6 +1395,12 @@ Lint/CircularArgumentReference:
1380
1395
  Enabled: true
1381
1396
  VersionAdded: '0.33'
1382
1397
 
1398
+ Lint/ConstantDefinitionInBlock:
1399
+ Description: 'Do not define constants within a block.'
1400
+ StyleGuide: '#no-constant-definition-in-block'
1401
+ Enabled: pending
1402
+ VersionAdded: '0.91'
1403
+
1383
1404
  Lint/ConstantResolution:
1384
1405
  Description: 'Check that constants are fully qualified with `::`.'
1385
1406
  Enabled: false
@@ -1525,6 +1546,13 @@ Lint/FormatParameterMismatch:
1525
1546
  Enabled: true
1526
1547
  VersionAdded: '0.33'
1527
1548
 
1549
+ Lint/HashCompareByIdentity:
1550
+ Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
1551
+ StyleGuide: '#identity-comparison'
1552
+ Enabled: pending
1553
+ Safe: false
1554
+ VersionAdded: '0.93'
1555
+
1528
1556
  Lint/HeredocMethodCallPosition:
1529
1557
  Description: >-
1530
1558
  Checks for the ordering of a method call where
@@ -1533,6 +1561,12 @@ Lint/HeredocMethodCallPosition:
1533
1561
  StyleGuide: '#heredoc-method-calls'
1534
1562
  VersionAdded: '0.68'
1535
1563
 
1564
+ Lint/IdentityComparison:
1565
+ Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
1566
+ Enabled: pending
1567
+ StyleGuide: '#identity-comparison'
1568
+ VersionAdded: '0.91'
1569
+
1536
1570
  Lint/ImplicitStringConcatenation:
1537
1571
  Description: >-
1538
1572
  Checks for adjacent string literals on the same line, which
@@ -1719,6 +1753,21 @@ Lint/RedundantRequireStatement:
1719
1753
  Enabled: true
1720
1754
  VersionAdded: '0.76'
1721
1755
 
1756
+ Lint/RedundantSafeNavigation:
1757
+ Description: 'Checks for redundant safe navigation calls.'
1758
+ Enabled: pending
1759
+ VersionAdded: '0.93'
1760
+ Safe: false
1761
+ IgnoredMethods:
1762
+ - to_c
1763
+ - to_f
1764
+ - to_i
1765
+ - to_r
1766
+ - rationalize
1767
+ - public_send
1768
+ - send
1769
+ - __send__
1770
+
1722
1771
  Lint/RedundantSplatExpansion:
1723
1772
  Description: 'Checks for splat unnecessarily being called on literals.'
1724
1773
  Enabled: true
@@ -1784,6 +1833,7 @@ Lint/SafeNavigationChain:
1784
1833
  - presence
1785
1834
  - try
1786
1835
  - try!
1836
+ - in?
1787
1837
 
1788
1838
  Lint/SafeNavigationConsistency:
1789
1839
  Description: >-
@@ -1861,6 +1911,7 @@ Lint/Syntax:
1861
1911
  Enabled: true
1862
1912
  VersionAdded: '0.9'
1863
1913
 
1914
+
1864
1915
  Lint/ToJSON:
1865
1916
  Description: 'Ensure #to_json includes an optional argument.'
1866
1917
  Enabled: true
@@ -1965,6 +2016,12 @@ Lint/UselessSetterCall:
1965
2016
  VersionChanged: '0.80'
1966
2017
  Safe: false
1967
2018
 
2019
+ Lint/UselessTimes:
2020
+ Description: 'Checks for useless `Integer#times` calls.'
2021
+ Enabled: pending
2022
+ VersionAdded: '0.91'
2023
+ Safe: false
2024
+
1968
2025
  Lint/Void:
1969
2026
  Description: 'Possible use of operator/literal/variable in void context.'
1970
2027
  Enabled: true
@@ -2428,7 +2485,7 @@ Style/ArrayCoercion:
2428
2485
  with a variable you want to treat as an Array, but you're not certain it's an array.
2429
2486
  StyleGuide: '#array-coercion'
2430
2487
  Safe: false
2431
- Enabled: 'pending'
2488
+ Enabled: false
2432
2489
  VersionAdded: '0.88'
2433
2490
 
2434
2491
  Style/ArrayJoin:
@@ -2667,6 +2724,16 @@ Style/ClassCheck:
2667
2724
  - is_a?
2668
2725
  - kind_of?
2669
2726
 
2727
+ Style/ClassEqualityComparison:
2728
+ Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
2729
+ StyleGuide: '#instance-of-vs-class-comparison'
2730
+ Enabled: pending
2731
+ VersionAdded: '0.93'
2732
+ IgnoredMethods:
2733
+ - ==
2734
+ - equal?
2735
+ - eql?
2736
+
2670
2737
  Style/ClassMethods:
2671
2738
  Description: 'Use self when defining module/class methods.'
2672
2739
  StyleGuide: '#def-self-class-methods'
@@ -2828,7 +2895,8 @@ Style/DateTime:
2828
2895
  StyleGuide: '#date--time'
2829
2896
  Enabled: false
2830
2897
  VersionAdded: '0.51'
2831
- VersionChanged: '0.59'
2898
+ VersionChanged: '0.92'
2899
+ SafeAutoCorrect: false
2832
2900
  AllowCoercion: false
2833
2901
 
2834
2902
  Style/DefWithParentheses:
@@ -3073,6 +3141,7 @@ Style/GlobalStdStream:
3073
3141
  StyleGuide: '#global-stdout'
3074
3142
  Enabled: pending
3075
3143
  VersionAdded: '0.89'
3144
+ SafeAutoCorrect: false
3076
3145
 
3077
3146
  Style/GlobalVars:
3078
3147
  Description: 'Do not introduce global variables.'
@@ -3247,11 +3316,16 @@ Style/IpAddresses:
3247
3316
  Description: "Don't include literal IP addresses in code."
3248
3317
  Enabled: false
3249
3318
  VersionAdded: '0.58'
3250
- VersionChanged: '0.77'
3319
+ VersionChanged: '0.91'
3251
3320
  # Allow addresses to be permitted
3252
3321
  AllowedAddresses:
3253
3322
  - "::"
3254
3323
  # :: is a valid IPv6 address, but could potentially be legitimately in code
3324
+ Exclude:
3325
+ - '**/*.gemfile'
3326
+ - '**/Gemfile'
3327
+ - '**/gems.rb'
3328
+ - '**/*.gemspec'
3255
3329
 
3256
3330
  Style/KeywordParametersOrder:
3257
3331
  Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
@@ -3684,6 +3758,8 @@ Style/OptionalBooleanParameter:
3684
3758
  Enabled: pending
3685
3759
  Safe: false
3686
3760
  VersionAdded: '0.89'
3761
+ AllowedMethods:
3762
+ - respond_to_missing?
3687
3763
 
3688
3764
  Style/OrAssignment:
3689
3765
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
@@ -3952,6 +4028,8 @@ Style/SafeNavigation:
3952
4028
  This cop transforms usages of a method call safeguarded by
3953
4029
  a check for the existence of the object to
3954
4030
  safe navigation (`&.`).
4031
+ Auto-correction is unsafe as it assumes the object will
4032
+ be `nil` or truthy, but never `false`.
3955
4033
  Enabled: true
3956
4034
  VersionAdded: '0.43'
3957
4035
  VersionChanged: '0.77'
@@ -3964,6 +4042,7 @@ Style/SafeNavigation:
3964
4042
  - presence
3965
4043
  - try
3966
4044
  - try!
4045
+ SafeAutoCorrect: false
3967
4046
 
3968
4047
  Style/Sample:
3969
4048
  Description: >-
@@ -1,6 +1,5 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path('lib', __dir__)
4
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
4
  require 'cookstyle/version'
6
5
 
@@ -25,7 +24,7 @@ Gem::Specification.new do |spec|
25
24
  'homepage_uri' => 'https://github.com/chef/cookstyle',
26
25
  'changelog_uri' => 'https://github.com/chef/cookstyle/blob/master/CHANGELOG.md',
27
26
  'source_code_uri' => 'https://github.com/chef/cookstyle',
28
- 'documentation_uri' => 'https://docs.chef.io/cookstyle.html',
27
+ 'documentation_uri' => 'https://docs.chef.io/workstation/cookstyle/',
29
28
  'bug_tracker_uri' => 'https://github.com/chef/cookstyle/issues',
30
29
  }
31
30
  end
@@ -7,13 +7,13 @@ require 'yaml' unless defined?(YAML)
7
7
  # ensure the desired target version of RuboCop is gem activated
8
8
  gem 'rubocop', "= #{Cookstyle::RUBOCOP_VERSION}"
9
9
  require 'rubocop'
10
- require_relative 'rubocop/monkey_patches/comment_config.rb'
10
+ require_relative 'rubocop/monkey_patches/comment_config'
11
11
 
12
12
  # monkey patches needed for the TargetChefVersion config option
13
- require_relative 'rubocop/monkey_patches/config.rb'
14
- require_relative 'rubocop/monkey_patches/base.rb'
15
- require_relative 'rubocop/monkey_patches/team.rb'
16
- require_relative 'rubocop/monkey_patches/registry_cop.rb'
13
+ require_relative 'rubocop/monkey_patches/config'
14
+ require_relative 'rubocop/monkey_patches/base'
15
+ require_relative 'rubocop/monkey_patches/team'
16
+ require_relative 'rubocop/monkey_patches/registry_cop'
17
17
 
18
18
  module RuboCop
19
19
  class ConfigLoader