cookstyle 6.17.7 → 6.20.2

Sign up to get free protection for your applications and to get access to all the features.
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 +80 -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 +19 -37
  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: '0385aed05c2f7b990958984ace106ea1f8b12d62feae5ba63fc0c382a880f678'
4
- data.tar.gz: e7888f5a8f5959069e00a5d3be8ce8a80325b34fe0d943baddb8a414f97947fd
3
+ metadata.gz: a36b09fd24530545b460de33db7f7239f2f64af587d5ccdf417335b9726be284
4
+ data.tar.gz: d2e4de150fee0df25842ced5f5b073b684e37922703111ac18e06125c68b0a41
5
5
  SHA512:
6
- metadata.gz: a89eab0482fd1c1c158b9f5ead6f61b4693a391fd88855bba6b5e46f60ae3ebb28074ef7782e4d249cd097ebd8093461c25baaff2c699ae214bc12d8584b95ef
7
- data.tar.gz: b125b09055b3388353ac3374ea1aa5061dc6dfe75f051a538004ed13d064820e40920d2d13fd2a0557cfe3b602237f346b7316adaa2e1174f9b0e4400ff7e71b
6
+ metadata.gz: 7b5dac93d379ff0a7445e9eb2d5743e1c547ec0c3e8c5bff64e1d6c44b45817131b9f7c24ae94dc02b969fd652cb917529a74305b37827d9c317093223a11949
7
+ data.tar.gz: f7dc13cb996e1d78e7660e50b3431401e85a64cd54529c99ccee33fd6f273c73e3ffe54f0cbaa6dd5b9bd0c500a40b0a5d0bbe94c7ae87f5b563aeb4e4b669f5
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,19 @@ 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
+ AllowedMethods:
1761
+ - instance_of?
1762
+ - kind_of?
1763
+ - is_a?
1764
+ - eql?
1765
+ - respond_to?
1766
+ - equal?
1767
+ Safe: false
1768
+
1722
1769
  Lint/RedundantSplatExpansion:
1723
1770
  Description: 'Checks for splat unnecessarily being called on literals.'
1724
1771
  Enabled: true
@@ -1784,6 +1831,7 @@ Lint/SafeNavigationChain:
1784
1831
  - presence
1785
1832
  - try
1786
1833
  - try!
1834
+ - in?
1787
1835
 
1788
1836
  Lint/SafeNavigationConsistency:
1789
1837
  Description: >-
@@ -1861,6 +1909,7 @@ Lint/Syntax:
1861
1909
  Enabled: true
1862
1910
  VersionAdded: '0.9'
1863
1911
 
1912
+
1864
1913
  Lint/ToJSON:
1865
1914
  Description: 'Ensure #to_json includes an optional argument.'
1866
1915
  Enabled: true
@@ -1965,6 +2014,12 @@ Lint/UselessSetterCall:
1965
2014
  VersionChanged: '0.80'
1966
2015
  Safe: false
1967
2016
 
2017
+ Lint/UselessTimes:
2018
+ Description: 'Checks for useless `Integer#times` calls.'
2019
+ Enabled: pending
2020
+ VersionAdded: '0.91'
2021
+ Safe: false
2022
+
1968
2023
  Lint/Void:
1969
2024
  Description: 'Possible use of operator/literal/variable in void context.'
1970
2025
  Enabled: true
@@ -2428,7 +2483,7 @@ Style/ArrayCoercion:
2428
2483
  with a variable you want to treat as an Array, but you're not certain it's an array.
2429
2484
  StyleGuide: '#array-coercion'
2430
2485
  Safe: false
2431
- Enabled: 'pending'
2486
+ Enabled: false
2432
2487
  VersionAdded: '0.88'
2433
2488
 
2434
2489
  Style/ArrayJoin:
@@ -2667,6 +2722,16 @@ Style/ClassCheck:
2667
2722
  - is_a?
2668
2723
  - kind_of?
2669
2724
 
2725
+ Style/ClassEqualityComparison:
2726
+ Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
2727
+ StyleGuide: '#instance-of-vs-class-comparison'
2728
+ Enabled: pending
2729
+ VersionAdded: '0.93'
2730
+ IgnoredMethods:
2731
+ - ==
2732
+ - equal?
2733
+ - eql?
2734
+
2670
2735
  Style/ClassMethods:
2671
2736
  Description: 'Use self when defining module/class methods.'
2672
2737
  StyleGuide: '#def-self-class-methods'
@@ -2828,7 +2893,8 @@ Style/DateTime:
2828
2893
  StyleGuide: '#date--time'
2829
2894
  Enabled: false
2830
2895
  VersionAdded: '0.51'
2831
- VersionChanged: '0.59'
2896
+ VersionChanged: '0.92'
2897
+ SafeAutoCorrect: false
2832
2898
  AllowCoercion: false
2833
2899
 
2834
2900
  Style/DefWithParentheses:
@@ -3073,6 +3139,7 @@ Style/GlobalStdStream:
3073
3139
  StyleGuide: '#global-stdout'
3074
3140
  Enabled: pending
3075
3141
  VersionAdded: '0.89'
3142
+ SafeAutoCorrect: false
3076
3143
 
3077
3144
  Style/GlobalVars:
3078
3145
  Description: 'Do not introduce global variables.'
@@ -3247,11 +3314,16 @@ Style/IpAddresses:
3247
3314
  Description: "Don't include literal IP addresses in code."
3248
3315
  Enabled: false
3249
3316
  VersionAdded: '0.58'
3250
- VersionChanged: '0.77'
3317
+ VersionChanged: '0.91'
3251
3318
  # Allow addresses to be permitted
3252
3319
  AllowedAddresses:
3253
3320
  - "::"
3254
3321
  # :: is a valid IPv6 address, but could potentially be legitimately in code
3322
+ Exclude:
3323
+ - '**/*.gemfile'
3324
+ - '**/Gemfile'
3325
+ - '**/gems.rb'
3326
+ - '**/*.gemspec'
3255
3327
 
3256
3328
  Style/KeywordParametersOrder:
3257
3329
  Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
@@ -3684,6 +3756,8 @@ Style/OptionalBooleanParameter:
3684
3756
  Enabled: pending
3685
3757
  Safe: false
3686
3758
  VersionAdded: '0.89'
3759
+ AllowedMethods:
3760
+ - respond_to_missing?
3687
3761
 
3688
3762
  Style/OrAssignment:
3689
3763
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
@@ -3952,6 +4026,8 @@ Style/SafeNavigation:
3952
4026
  This cop transforms usages of a method call safeguarded by
3953
4027
  a check for the existence of the object to
3954
4028
  safe navigation (`&.`).
4029
+ Auto-correction is unsafe as it assumes the object will
4030
+ be `nil` or truthy, but never `false`.
3955
4031
  Enabled: true
3956
4032
  VersionAdded: '0.43'
3957
4033
  VersionChanged: '0.77'
@@ -3964,6 +4040,7 @@ Style/SafeNavigation:
3964
4040
  - presence
3965
4041
  - try
3966
4042
  - try!
4043
+ SafeAutoCorrect: false
3967
4044
 
3968
4045
  Style/Sample:
3969
4046
  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