cookstyle 6.16.10 → 6.19.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cookstyle +1 -2
  3. data/config/cookstyle.yml +127 -16
  4. data/config/disable_all.yml +8 -0
  5. data/config/upstream.yml +50 -3
  6. data/cookstyle.gemspec +1 -2
  7. data/lib/cookstyle.rb +7 -7
  8. data/lib/cookstyle/version.rb +2 -2
  9. data/lib/rubocop/cop/chef/correctness/block_guard_clause_string_only.rb +1 -1
  10. data/lib/rubocop/cop/chef/correctness/chef_application_fatal.rb +1 -1
  11. data/lib/rubocop/cop/chef/correctness/conditional_ruby_shellout.rb +1 -1
  12. data/lib/rubocop/cop/chef/correctness/incorrect_library_injection.rb +23 -14
  13. data/lib/rubocop/cop/chef/correctness/invalid_platform_family_values_in_case.rb +1 -1
  14. data/lib/rubocop/cop/chef/correctness/invalid_platform_metadata.rb +2 -2
  15. data/lib/rubocop/cop/chef/correctness/invalid_platform_values_in_case.rb +1 -1
  16. data/lib/rubocop/cop/chef/correctness/lazy_eval_node_attribute_defaults.rb +1 -1
  17. data/lib/rubocop/cop/chef/correctness/lazy_in_resource_guard.rb +67 -0
  18. data/lib/rubocop/cop/chef/correctness/macos_userdefaults_invalid_type.rb +2 -2
  19. data/lib/rubocop/cop/chef/correctness/notifies_action_not_symbol.rb +1 -1
  20. data/lib/rubocop/cop/chef/correctness/property_without_type.rb +59 -0
  21. data/lib/rubocop/cop/chef/correctness/resource_with_none_action.rb +1 -1
  22. data/lib/rubocop/cop/chef/correctness/scoped_file_exist.rb +1 -1
  23. data/lib/rubocop/cop/chef/correctness/supports_must_be_float.rb +2 -2
  24. data/lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb +1 -1
  25. data/lib/rubocop/cop/chef/deprecation/chef_rewind.rb +2 -2
  26. data/lib/rubocop/cop/chef/deprecation/chef_shellout.rb +86 -0
  27. data/lib/rubocop/cop/chef/deprecation/chef_windows_platform_helper.rb +1 -1
  28. data/lib/rubocop/cop/chef/deprecation/chefdk_generators.rb +1 -1
  29. data/lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb +1 -1
  30. data/lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb +1 -1
  31. data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +1 -1
  32. data/lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb +8 -4
  33. data/lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_properties.rb +1 -1
  34. data/lib/rubocop/cop/chef/deprecation/epic_fail.rb +1 -1
  35. data/lib/rubocop/cop/chef/deprecation/execute_path_property.rb +51 -0
  36. data/lib/rubocop/cop/chef/deprecation/execute_relative_creates_without_cwd.rb +67 -0
  37. data/lib/rubocop/cop/chef/deprecation/inherits_compat_resource.rb +1 -1
  38. data/lib/rubocop/cop/chef/deprecation/legacy_notify_syntax.rb +1 -1
  39. data/lib/rubocop/cop/chef/deprecation/node_methods_not_attributes.rb +1 -1
  40. data/lib/rubocop/cop/chef/deprecation/powershell_cookbook_helpers.rb +1 -1
  41. data/lib/rubocop/cop/chef/deprecation/ruby_27_keyword_argument_warnings.rb +2 -2
  42. data/lib/rubocop/cop/chef/deprecation/ruby_block_create_action.rb +2 -2
  43. data/lib/rubocop/cop/chef/deprecation/search_uses_positional_parameters.rb +5 -3
  44. data/lib/rubocop/cop/chef/deprecation/user_supports_property.rb +1 -1
  45. data/lib/rubocop/cop/chef/deprecation/windows_feature_servermanagercmd.rb +1 -1
  46. data/lib/rubocop/cop/chef/deprecation/windows_package_installer_type_string.rb +61 -0
  47. data/lib/rubocop/cop/chef/deprecation/windows_task_change_action.rb +2 -2
  48. data/lib/rubocop/cop/chef/deprecation/windows_version_helpers.rb +4 -4
  49. data/lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb +1 -1
  50. data/lib/rubocop/cop/chef/effortless/chef_vault_used.rb +89 -0
  51. data/lib/rubocop/cop/chef/effortless/depends_chef_vault.rb +49 -0
  52. data/lib/rubocop/cop/chef/modernize/action_method_in_resource.rb +2 -2
  53. data/lib/rubocop/cop/chef/modernize/berksfile_source.rb +2 -2
  54. data/lib/rubocop/cop/chef/modernize/build_essential.rb +1 -1
  55. data/lib/rubocop/cop/chef/modernize/conditional_using_test.rb +1 -1
  56. data/lib/rubocop/cop/chef/modernize/cron_manage_resource.rb +1 -1
  57. data/lib/rubocop/cop/chef/modernize/databag_helpers.rb +1 -1
  58. data/lib/rubocop/cop/chef/modernize/foodcritic_comments.rb +1 -1
  59. data/lib/rubocop/cop/chef/modernize/if_provides_default_action.rb +1 -1
  60. data/lib/rubocop/cop/chef/modernize/libarchive_file.rb +2 -2
  61. data/lib/rubocop/cop/chef/modernize/macos_user_defaults.rb +1 -1
  62. data/lib/rubocop/cop/chef/modernize/node_init_package.rb +3 -3
  63. data/lib/rubocop/cop/chef/modernize/node_roles_include.rb +1 -1
  64. data/lib/rubocop/cop/chef/modernize/openssl_rsa_key_resource.rb +1 -1
  65. data/lib/rubocop/cop/chef/modernize/openssl_x509_resource.rb +1 -1
  66. data/lib/rubocop/cop/chef/modernize/osx_config_profile_resource.rb +1 -1
  67. data/lib/rubocop/cop/chef/modernize/property_with_name_attribute.rb +1 -1
  68. data/lib/rubocop/cop/chef/modernize/respond_to_compile_time.rb +7 -4
  69. data/lib/rubocop/cop/chef/modernize/respond_to_metadata.rb +5 -5
  70. data/lib/rubocop/cop/chef/modernize/respond_to_provides.rb +1 -1
  71. data/lib/rubocop/cop/chef/modernize/respond_to_resource_name.rb +1 -1
  72. data/lib/rubocop/cop/chef/modernize/shell_out_helper.rb +1 -1
  73. data/lib/rubocop/cop/chef/modernize/simplify_apt_ppa_setup.rb +1 -1
  74. data/lib/rubocop/cop/chef/modernize/sysctl_param_resource.rb +1 -1
  75. data/lib/rubocop/cop/chef/modernize/use_multipackage_installs.rb +1 -1
  76. data/lib/rubocop/cop/chef/modernize/use_require_relative.rb +1 -1
  77. data/lib/rubocop/cop/chef/modernize/zypper_repo.rb +1 -1
  78. data/lib/rubocop/cop/chef/redundant/double_compile_time.rb +1 -1
  79. data/lib/rubocop/cop/chef/redundant/multiple_platform_checks.rb +1 -1
  80. data/lib/rubocop/cop/chef/redundant/ohai_attribute_to_string.rb +1 -1
  81. data/lib/rubocop/cop/chef/redundant/use_create_if_missing.rb +1 -1
  82. data/lib/rubocop/cop/chef/sharing/include_property_descriptions.rb +1 -1
  83. data/lib/rubocop/cop/chef/sharing/insecure_cookbook_url.rb +1 -1
  84. data/lib/rubocop/cop/chef/sharing/invalid_license_string.rb +1 -1
  85. data/lib/rubocop/cop/chef/style/attribute_keys.rb +1 -1
  86. data/lib/rubocop/cop/chef/style/chef_whaaat.rb +1 -1
  87. data/lib/rubocop/cop/chef/style/comment_sentence_spacing.rb +2 -2
  88. data/lib/rubocop/cop/chef/style/comments_copyright_format.rb +2 -2
  89. data/lib/rubocop/cop/chef/style/comments_default_copyright.rb +1 -1
  90. data/lib/rubocop/cop/chef/style/comments_format.rb +6 -13
  91. data/lib/rubocop/cop/chef/style/file_mode.rb +2 -2
  92. data/lib/rubocop/cop/chef/style/immediate_notification_timing.rb +2 -2
  93. data/lib/rubocop/cop/chef/style/include_recipe_with_parentheses.rb +2 -2
  94. data/lib/rubocop/cop/chef/style/negating_only_if.rb +2 -2
  95. data/lib/rubocop/cop/chef/style/overly_complex_supports_depends_metadata.rb +2 -2
  96. data/lib/rubocop/cop/chef/style/simplify_platform_major_version_check.rb +1 -1
  97. data/lib/rubocop/cop/chef/style/true_false_resource_properties.rb +2 -2
  98. data/lib/rubocop/cop/chef/style/unnecessary_os_check.rb +4 -4
  99. data/lib/rubocop/cop/chef/style/unnecessary_platform_case_statement.rb +2 -2
  100. data/lib/rubocop/cop/chef/style/use_platform_helpers.rb +6 -6
  101. metadata +12 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e15b2148d2b58205dc5b6653e3824b59dda2a927c1e0753f42d522105682021
4
- data.tar.gz: e2c9f7bb6727c8f97b7de581e29b4f18db002b17f10732e115652e728f844ded
3
+ metadata.gz: 47388999a2aa49c2d130f1a553e2d17efec6090b4207e39557fc78acb8c4e5a8
4
+ data.tar.gz: c622b97ecf8c86b337c7bc63ff444c4b305a6a249cc40c598ea800a1ba9cae67
5
5
  SHA512:
6
- metadata.gz: f9d1c969323e34fc6c58c987a9b339c625f2cfeb7b6ceeea83e7e7a0b5292dfe8d54e1f05dca2773ec582aaa6ad5b12914715d77b140906f14b8911406396d5e
7
- data.tar.gz: e343548e500f20767be5ce478d47969677e31d9ebd1f8661cab493e9777eadd0e8ed09921a22690ef61a5ade718b8ae954bc1fa3464c01abbcd12cd6843e1273
6
+ metadata.gz: 4b1f192f83d65beb1360ff7df9648176bbc54398b39eb7e8791f0342f5152e5361bae374514fcb60134cb6348101c78047ab53d57efcfad3cccfa60e03de2234
7
+ data.tar.gz: db704725caa2dbfa226e6693bee8ced4adeaaf45d531c5665ff3c602cb7d9b3392676917d814f44b5bb4e7fb015c3c52ce94e812b6ef017fd117210d0ff35252
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- # -*- encoding: utf-8 -*-
3
2
  # frozen_string_literal: true
4
3
 
5
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w(.. lib))
4
+ $LOAD_PATH.unshift File.join(__dir__, %w(.. lib))
6
5
 
7
6
  require 'cookstyle'
8
7
 
@@ -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
  ###############################
@@ -908,10 +926,11 @@ ChefDeprecations/RubyBlockCreateAction:
908
926
  - '**/Berksfile'
909
927
 
910
928
  ChefDeprecations/DeprecatedPlatformMethods:
911
- Description: Use provider_for_action instead of the deprecated Chef::Platform methods in resources.
929
+ Description: Use provider_for_action or provides instead of the deprecated Chef::Platform methods in resources.
912
930
  StyleGuide: '#chefdeprecationsdeprecatedplatformmethods'
913
931
  Enabled: true
914
932
  VersionAdded: '5.16.0'
933
+ VersionChanged: '6.17.0'
915
934
  Include:
916
935
  - '**/libraries/*.rb'
917
936
  - '**/resources/*.rb'
@@ -1062,6 +1081,46 @@ ChefDeprecations/CookbooksDependsOnSelf:
1062
1081
  Include:
1063
1082
  - '**/metadata.rb'
1064
1083
 
1084
+ ChefDeprecations/ChefShellout:
1085
+ Description: Don't use deprecated Chef::ShellOut which was removed in Chef Infra Client 13. Use Mixlib::ShellOut instead, which behaves identically.
1086
+ StyleGuide: '#chefdeprecationschefshellout'
1087
+ Enabled: true
1088
+ VersionAdded: '6.17.0'
1089
+ Exclude:
1090
+ - '**/metadata.rb'
1091
+ - '**/attributes/*.rb'
1092
+ - '**/Berksfile'
1093
+
1094
+ ChefDeprecations/ExecutePathProperty:
1095
+ Description: In Chef Infra Client 13 and later you must set path env vars in `execute` resources using the `environment` property not the legacy `path` property.
1096
+ StyleGuide: '#chefdeprecationsexecutepathproperty'
1097
+ Enabled: true
1098
+ VersionAdded: '6.17.0'
1099
+ Exclude:
1100
+ - '**/metadata.rb'
1101
+ - '**/attributes/*.rb'
1102
+ - '**/Berksfile'
1103
+
1104
+ ChefDeprecations/ExecuteRelativeCreatesWithoutCwd:
1105
+ Description: In Chef Infra Client 13 and later you must either specify an absolute path when using the `execute` resource's `creates` property or also use the `cwd` property.
1106
+ StyleGuide: '#chefdeprecationsexecuterelativecreateswithoutcwd'
1107
+ Enabled: true
1108
+ VersionAdded: '6.17.0'
1109
+ Exclude:
1110
+ - '**/metadata.rb'
1111
+ - '**/attributes/*.rb'
1112
+ - '**/Berksfile'
1113
+
1114
+ ChefDeprecations/WindowsPackageInstallerTypeString:
1115
+ Description: In Chef Infra Client 13 and later the `windows_package` resource's `installer_type` property must be a symbol.
1116
+ StyleGuide: '#chefdeprecationswindowspackageinstallertypestring'
1117
+ Enabled: true
1118
+ VersionAdded: '6.17.0'
1119
+ Exclude:
1120
+ - '**/metadata.rb'
1121
+ - '**/attributes/*.rb'
1122
+ - '**/Berksfile'
1123
+
1065
1124
  ###############################
1066
1125
  # ChefModernize: Cleaning up legacy code and using new built-in resources
1067
1126
  ###############################
@@ -1870,6 +1929,25 @@ ChefEffortless/CookbookUsesDatabags:
1870
1929
  Exclude:
1871
1930
  - '**/metadata.rb'
1872
1931
  - '**/Berksfile'
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'
1873
1951
 
1874
1952
  ChefEffortless/CookbookUsesEnvironments:
1875
1953
  Description: Cookbook uses environments, which cannot be used in the Effortless Infra pattern
@@ -2302,21 +2380,6 @@ Lint/UselessSetterCall:
2302
2380
  Lint/Void:
2303
2381
  Enabled: true
2304
2382
 
2305
- ##### Additional rules we enable/disable over the rubocop 0.37 rules ago #####
2306
-
2307
- Layout/AlignParameters:
2308
- Enabled: false
2309
- Style/Encoding:
2310
- Enabled: false
2311
- Style/Alias:
2312
- Enabled: false
2313
- Layout/SpaceBeforeFirstArg:
2314
- Enabled: false
2315
- Style/ClassAndModuleChildren:
2316
- Enabled: false
2317
- Style/DoubleNegation:
2318
- Enabled: false
2319
-
2320
2383
  # file names don't matter in cookbooks
2321
2384
  Naming/FileName:
2322
2385
  Enabled: false
@@ -2616,4 +2679,52 @@ Style/RedundantAssignment:
2616
2679
 
2617
2680
  # alert on invalid ruby
2618
2681
  Lint/Syntax:
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:
2619
2730
  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:
@@ -267,6 +271,8 @@ Lint/FormatParameterMismatch:
267
271
  Enabled: false
268
272
  Lint/HeredocMethodCallPosition:
269
273
  Enabled: false
274
+ Lint/IdentityComparison:
275
+ Enabled: false
270
276
  Lint/ImplicitStringConcatenation:
271
277
  Enabled: false
272
278
  Lint/InheritException:
@@ -395,6 +401,8 @@ Lint/UselessMethodDefinition:
395
401
  Enabled: false
396
402
  Lint/UselessSetterCall:
397
403
  Enabled: false
404
+ Lint/UselessTimes:
405
+ Enabled: false
398
406
  Lint/Void:
399
407
  Enabled: false
400
408
  Metrics/CyclomaticComplexity:
@@ -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
@@ -1533,6 +1554,12 @@ Lint/HeredocMethodCallPosition:
1533
1554
  StyleGuide: '#heredoc-method-calls'
1534
1555
  VersionAdded: '0.68'
1535
1556
 
1557
+ Lint/IdentityComparison:
1558
+ Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
1559
+ Enabled: pending
1560
+ StyleGuide: '#identity-comparison'
1561
+ VersionAdded: '0.91'
1562
+
1536
1563
  Lint/ImplicitStringConcatenation:
1537
1564
  Description: >-
1538
1565
  Checks for adjacent string literals on the same line, which
@@ -1784,6 +1811,7 @@ Lint/SafeNavigationChain:
1784
1811
  - presence
1785
1812
  - try
1786
1813
  - try!
1814
+ - in?
1787
1815
 
1788
1816
  Lint/SafeNavigationConsistency:
1789
1817
  Description: >-
@@ -1861,6 +1889,7 @@ Lint/Syntax:
1861
1889
  Enabled: true
1862
1890
  VersionAdded: '0.9'
1863
1891
 
1892
+
1864
1893
  Lint/ToJSON:
1865
1894
  Description: 'Ensure #to_json includes an optional argument.'
1866
1895
  Enabled: true
@@ -1965,6 +1994,12 @@ Lint/UselessSetterCall:
1965
1994
  VersionChanged: '0.80'
1966
1995
  Safe: false
1967
1996
 
1997
+ Lint/UselessTimes:
1998
+ Description: 'Checks for useless `Integer#times` calls.'
1999
+ Enabled: pending
2000
+ VersionAdded: '0.91'
2001
+ Safe: false
2002
+
1968
2003
  Lint/Void:
1969
2004
  Description: 'Possible use of operator/literal/variable in void context.'
1970
2005
  Enabled: true
@@ -2428,7 +2463,7 @@ Style/ArrayCoercion:
2428
2463
  with a variable you want to treat as an Array, but you're not certain it's an array.
2429
2464
  StyleGuide: '#array-coercion'
2430
2465
  Safe: false
2431
- Enabled: 'pending'
2466
+ Enabled: false
2432
2467
  VersionAdded: '0.88'
2433
2468
 
2434
2469
  Style/ArrayJoin:
@@ -2828,7 +2863,8 @@ Style/DateTime:
2828
2863
  StyleGuide: '#date--time'
2829
2864
  Enabled: false
2830
2865
  VersionAdded: '0.51'
2831
- VersionChanged: '0.59'
2866
+ VersionChanged: '0.92'
2867
+ SafeAutoCorrect: false
2832
2868
  AllowCoercion: false
2833
2869
 
2834
2870
  Style/DefWithParentheses:
@@ -3073,6 +3109,7 @@ Style/GlobalStdStream:
3073
3109
  StyleGuide: '#global-stdout'
3074
3110
  Enabled: pending
3075
3111
  VersionAdded: '0.89'
3112
+ SafeAutoCorrect: false
3076
3113
 
3077
3114
  Style/GlobalVars:
3078
3115
  Description: 'Do not introduce global variables.'
@@ -3247,11 +3284,16 @@ Style/IpAddresses:
3247
3284
  Description: "Don't include literal IP addresses in code."
3248
3285
  Enabled: false
3249
3286
  VersionAdded: '0.58'
3250
- VersionChanged: '0.77'
3287
+ VersionChanged: '0.91'
3251
3288
  # Allow addresses to be permitted
3252
3289
  AllowedAddresses:
3253
3290
  - "::"
3254
3291
  # :: is a valid IPv6 address, but could potentially be legitimately in code
3292
+ Exclude:
3293
+ - '**/*.gemfile'
3294
+ - '**/Gemfile'
3295
+ - '**/gems.rb'
3296
+ - '**/*.gemspec'
3255
3297
 
3256
3298
  Style/KeywordParametersOrder:
3257
3299
  Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
@@ -3684,6 +3726,8 @@ Style/OptionalBooleanParameter:
3684
3726
  Enabled: pending
3685
3727
  Safe: false
3686
3728
  VersionAdded: '0.89'
3729
+ AllowedMethods:
3730
+ - respond_to_missing?
3687
3731
 
3688
3732
  Style/OrAssignment:
3689
3733
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
@@ -3952,6 +3996,8 @@ Style/SafeNavigation:
3952
3996
  This cop transforms usages of a method call safeguarded by
3953
3997
  a check for the existence of the object to
3954
3998
  safe navigation (`&.`).
3999
+ Auto-correction is unsafe as it assumes the object will
4000
+ be `nil` or truthy, but never `false`.
3955
4001
  Enabled: true
3956
4002
  VersionAdded: '0.43'
3957
4003
  VersionChanged: '0.77'
@@ -3964,6 +4010,7 @@ Style/SafeNavigation:
3964
4010
  - presence
3965
4011
  - try
3966
4012
  - try!
4013
+ SafeAutoCorrect: false
3967
4014
 
3968
4015
  Style/Sample:
3969
4016
  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
 
@@ -7,19 +7,19 @@ 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
20
20
  RUBOCOP_HOME.gsub!(
21
21
  /^.*$/,
22
- File.realpath(File.join(File.dirname(__FILE__), '..'))
22
+ File.realpath(File.join(__dir__, '..'))
23
23
  )
24
24
 
25
25
  DEFAULT_FILE.gsub!(
@@ -46,7 +46,7 @@ require_relative 'rubocop/chef/cookbook_only'
46
46
  require_relative 'rubocop/cop/target_chef_version'
47
47
 
48
48
  # Chef Infra specific cops
49
- Dir.glob(File.dirname(__FILE__) + '/rubocop/cop/chef/**/*.rb') do |file|
49
+ Dir.glob(__dir__ + '/rubocop/cop/chef/**/*.rb') do |file|
50
50
  next if File.directory?(file)
51
51
 
52
52
  require_relative file # not actually relative but require_relative is faster
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Cookstyle
3
- VERSION = "6.16.10" # rubocop: disable Style/StringLiterals
4
- RUBOCOP_VERSION = '0.90.0'
3
+ VERSION = "6.19.5" # rubocop: disable Style/StringLiterals
4
+ RUBOCOP_VERSION = '0.92.0'
5
5
  end
@@ -50,7 +50,7 @@ module RuboCop
50
50
  block_guard_with_only_string?(node) do
51
51
  add_offense(node, message: MSG, severity: :refactor) do |corrector|
52
52
  new_val = "#{node.method_name} #{node.body.source}"
53
- corrector.replace(node.loc.expression, new_val)
53
+ corrector.replace(node, new_val)
54
54
  end
55
55
  end
56
56
  end