cookstyle 6.15.9 → 6.17.5

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 (214) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cookstyle +1 -1
  3. data/config/cookstyle.yml +56 -10
  4. data/config/disable_all.yml +20 -0
  5. data/config/upstream.yml +79 -12
  6. data/lib/cookstyle.rb +2 -2
  7. data/lib/cookstyle/version.rb +2 -2
  8. data/lib/rubocop/cop/chef/correctness/block_guard_clause_string_only.rb +7 -9
  9. data/lib/rubocop/cop/chef/correctness/chef_application_fatal.rb +5 -9
  10. data/lib/rubocop/cop/chef/correctness/conditional_ruby_shellout.rb +5 -9
  11. data/lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb +5 -8
  12. data/lib/rubocop/cop/chef/correctness/incorrect_library_injection.rb +11 -9
  13. data/lib/rubocop/cop/chef/correctness/invalid_default_action.rb +3 -2
  14. data/lib/rubocop/cop/chef/correctness/invalid_notification_timing.rb +3 -2
  15. data/lib/rubocop/cop/chef/correctness/invalid_platform_family_helper.rb +16 -21
  16. data/lib/rubocop/cop/chef/correctness/invalid_platform_family_values_in_case.rb +15 -23
  17. data/lib/rubocop/cop/chef/correctness/invalid_platform_helper.rb +3 -2
  18. data/lib/rubocop/cop/chef/correctness/invalid_platform_metadata.rb +13 -14
  19. data/lib/rubocop/cop/chef/correctness/invalid_platform_values_in_case.rb +13 -22
  20. data/lib/rubocop/cop/chef/correctness/invalid_value_for_platform_family_helper.rb +5 -3
  21. data/lib/rubocop/cop/chef/correctness/invalid_value_for_platform_helper.rb +5 -3
  22. data/lib/rubocop/cop/chef/correctness/invalid_version_metadata.rb +3 -4
  23. data/lib/rubocop/cop/chef/correctness/lazy_eval_node_attribute_defaults.rb +5 -8
  24. data/lib/rubocop/cop/chef/correctness/macos_userdefaults_invalid_type.rb +2 -3
  25. data/lib/rubocop/cop/chef/correctness/malformed_value_for_platform.rb +6 -7
  26. data/lib/rubocop/cop/chef/correctness/metadata_missing_name.rb +5 -12
  27. data/lib/rubocop/cop/chef/correctness/node_normal.rb +2 -2
  28. data/lib/rubocop/cop/chef/correctness/node_normal_unless.rb +2 -2
  29. data/lib/rubocop/cop/chef/correctness/node_save.rb +2 -2
  30. data/lib/rubocop/cop/chef/correctness/notifies_action_not_symbol.rb +7 -7
  31. data/lib/rubocop/cop/chef/correctness/openssl_password_helpers.rb +2 -2
  32. data/lib/rubocop/cop/chef/correctness/powershell_delete_file.rb +4 -4
  33. data/lib/rubocop/cop/chef/correctness/resource_sets_internal_properties.rb +2 -2
  34. data/lib/rubocop/cop/chef/correctness/resource_sets_name_property.rb +2 -2
  35. data/lib/rubocop/cop/chef/correctness/resource_with_none_action.rb +6 -2
  36. data/lib/rubocop/cop/chef/correctness/scoped_file_exist.rb +6 -8
  37. data/lib/rubocop/cop/chef/correctness/service_resource.rb +3 -2
  38. data/lib/rubocop/cop/chef/correctness/supports_must_be_float.rb +1 -0
  39. data/lib/rubocop/cop/chef/correctness/tmp_path.rb +4 -4
  40. data/lib/rubocop/cop/chef/deprecation/ use_automatic_resource_name.rb +1 -2
  41. data/lib/rubocop/cop/chef/{correctness → deprecation}/cb_depends_on_self.rb +7 -11
  42. data/lib/rubocop/cop/chef/deprecation/chef_handler_recipe.rb +6 -8
  43. data/lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb +7 -10
  44. data/lib/rubocop/cop/chef/deprecation/chef_rest.rb +4 -3
  45. data/lib/rubocop/cop/chef/deprecation/chef_rewind.rb +16 -28
  46. data/lib/rubocop/cop/chef/deprecation/chef_shellout.rb +86 -0
  47. data/lib/rubocop/cop/chef/deprecation/chef_windows_platform_helper.rb +5 -8
  48. data/lib/rubocop/cop/chef/deprecation/chefdk_generators.rb +3 -6
  49. data/lib/rubocop/cop/chef/deprecation/cheffile.rb +3 -5
  50. data/lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb +5 -8
  51. data/lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb +5 -8
  52. data/lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb +6 -8
  53. data/lib/rubocop/cop/chef/deprecation/depends_compat_resource.rb +6 -8
  54. data/lib/rubocop/cop/chef/deprecation/depends_partial_search.rb +3 -2
  55. data/lib/rubocop/cop/chef/deprecation/depends_poise.rb +3 -2
  56. data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +5 -9
  57. data/lib/rubocop/cop/chef/deprecation/deprecated_mixins.rb +12 -10
  58. data/lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb +10 -6
  59. data/lib/rubocop/cop/chef/deprecation/deprecated_shellout_methods.rb +11 -12
  60. data/lib/rubocop/cop/chef/deprecation/deprecated_windows_version_check.rb +3 -2
  61. data/lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_properties.rb +8 -8
  62. data/lib/rubocop/cop/chef/deprecation/easy_install.rb +3 -2
  63. data/lib/rubocop/cop/chef/deprecation/eol_audit_mode.rb +3 -2
  64. data/lib/rubocop/cop/chef/deprecation/epic_fail.rb +5 -6
  65. data/lib/rubocop/cop/chef/deprecation/erl_call.rb +3 -2
  66. data/lib/rubocop/cop/chef/deprecation/execute_path_property.rb +51 -0
  67. data/lib/rubocop/cop/chef/deprecation/execute_relative_creates_without_cwd.rb +67 -0
  68. data/lib/rubocop/cop/chef/deprecation/hwrp_without_provides.rb +11 -12
  69. data/lib/rubocop/cop/chef/deprecation/inherits_compat_resource.rb +6 -8
  70. data/lib/rubocop/cop/chef/deprecation/launchd_deprecated_hash_property.rb +6 -9
  71. data/lib/rubocop/cop/chef/deprecation/legacy_notify_syntax.rb +6 -9
  72. data/lib/rubocop/cop/chef/deprecation/legacy_yum_cookbook_recipes.rb +3 -2
  73. data/lib/rubocop/cop/chef/deprecation/locale_lc_all_property.rb +2 -2
  74. data/lib/rubocop/cop/chef/deprecation/name_property_and_default.rb +5 -9
  75. data/lib/rubocop/cop/chef/deprecation/node_methods_not_attributes.rb +6 -8
  76. data/lib/rubocop/cop/chef/deprecation/node_set.rb +6 -8
  77. data/lib/rubocop/cop/chef/deprecation/node_set_unless.rb +6 -8
  78. data/lib/rubocop/cop/chef/deprecation/node_set_without_level.rb +6 -4
  79. data/lib/rubocop/cop/chef/deprecation/partial_search_class_usage.rb +2 -2
  80. data/lib/rubocop/cop/chef/deprecation/partial_search_helper_usage.rb +3 -2
  81. data/lib/rubocop/cop/chef/deprecation/poise_archive.rb +4 -3
  82. data/lib/rubocop/cop/chef/deprecation/powershell_cookbook_helpers.rb +5 -9
  83. data/lib/rubocop/cop/chef/deprecation/require_recipe.rb +8 -7
  84. data/lib/rubocop/cop/chef/deprecation/resource_overrides_provides_method.rb +4 -4
  85. data/lib/rubocop/cop/chef/deprecation/resource_uses_dsl_name_method.rb +3 -2
  86. data/lib/rubocop/cop/chef/deprecation/resource_uses_only_resource_name.rb +6 -9
  87. data/lib/rubocop/cop/chef/deprecation/resource_uses_provider_base_method.rb +3 -2
  88. data/lib/rubocop/cop/chef/deprecation/resource_uses_updated_method.rb +2 -2
  89. data/lib/rubocop/cop/chef/deprecation/ruby_27_keyword_argument_warnings.rb +1 -0
  90. data/lib/rubocop/cop/chef/deprecation/ruby_block_create_action.rb +6 -8
  91. data/lib/rubocop/cop/chef/deprecation/run_command_helper.rb +5 -4
  92. data/lib/rubocop/cop/chef/deprecation/search_uses_positional_parameters.rb +11 -10
  93. data/lib/rubocop/cop/chef/deprecation/use_inline_resources.rb +10 -13
  94. data/lib/rubocop/cop/chef/deprecation/user_supports_property.rb +11 -14
  95. data/lib/rubocop/cop/chef/deprecation/verify_property_file_expansion.rb +6 -8
  96. data/lib/rubocop/cop/chef/deprecation/windows_feature_servermanagercmd.rb +2 -2
  97. data/lib/rubocop/cop/chef/deprecation/windows_package_installer_type_string.rb +61 -0
  98. data/lib/rubocop/cop/chef/deprecation/windows_task_change_action.rb +11 -16
  99. data/lib/rubocop/cop/chef/deprecation/windows_version_helpers.rb +4 -9
  100. data/lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb +7 -8
  101. data/lib/rubocop/cop/chef/deprecation/yum_dnf_compat_recipe.rb +6 -8
  102. data/lib/rubocop/cop/chef/effortless/berksfile.rb +3 -5
  103. data/lib/rubocop/cop/chef/effortless/data_bags.rb +3 -2
  104. data/lib/rubocop/cop/chef/effortless/node_environment.rb +6 -3
  105. data/lib/rubocop/cop/chef/effortless/node_policygroup.rb +6 -3
  106. data/lib/rubocop/cop/chef/effortless/node_roles.rb +6 -3
  107. data/lib/rubocop/cop/chef/effortless/search_for_environments_or_roles.rb +4 -3
  108. data/lib/rubocop/cop/chef/effortless/search_used.rb +3 -2
  109. data/lib/rubocop/cop/chef/modernize/allowed_actions_initializer.rb +16 -16
  110. data/lib/rubocop/cop/chef/modernize/apt_default_recipe.rb +3 -2
  111. data/lib/rubocop/cop/chef/modernize/berksfile_source.rb +10 -9
  112. data/lib/rubocop/cop/chef/modernize/build_essential.rb +7 -8
  113. data/lib/rubocop/cop/chef/modernize/chef_14_resources.rb +6 -8
  114. data/lib/rubocop/cop/chef/modernize/chef_gem_nokogiri.rb +12 -10
  115. data/lib/rubocop/cop/chef/modernize/compile_time_resources.rb +2 -2
  116. data/lib/rubocop/cop/chef/modernize/conditional_using_test.rb +6 -8
  117. data/lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb +2 -2
  118. data/lib/rubocop/cop/chef/modernize/cron_manage_resource.rb +4 -6
  119. data/lib/rubocop/cop/chef/modernize/databag_helpers.rb +7 -8
  120. data/lib/rubocop/cop/chef/modernize/default_action_initializer.rb +11 -13
  121. data/lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb +5 -8
  122. data/lib/rubocop/cop/chef/modernize/definitions.rb +2 -2
  123. data/lib/rubocop/cop/chef/modernize/depends_zypper_cookbook.rb +6 -8
  124. data/lib/rubocop/cop/chef/modernize/dsl_include_in_resource.rb +6 -8
  125. data/lib/rubocop/cop/chef/modernize/empty_resource_initialize.rb +5 -8
  126. data/lib/rubocop/cop/chef/modernize/execute_apt_update.rb +7 -4
  127. data/lib/rubocop/cop/chef/modernize/execute_sc_exe.rb +7 -9
  128. data/lib/rubocop/cop/chef/modernize/execute_sleep.rb +7 -11
  129. data/lib/rubocop/cop/chef/modernize/execute_sysctl.rb +6 -9
  130. data/lib/rubocop/cop/chef/modernize/execute_tzutil.rb +8 -4
  131. data/lib/rubocop/cop/chef/modernize/foodcritic_comments.rb +7 -12
  132. data/lib/rubocop/cop/chef/modernize/if_provides_default_action.rb +4 -6
  133. data/lib/rubocop/cop/chef/modernize/includes_mixin_shellout.rb +6 -8
  134. data/lib/rubocop/cop/chef/modernize/libarchive_file.rb +13 -9
  135. data/lib/rubocop/cop/chef/modernize/macos_user_defaults.rb +4 -6
  136. data/lib/rubocop/cop/chef/modernize/minitest_handler_usage.rb +6 -8
  137. data/lib/rubocop/cop/chef/modernize/node_roles_include.rb +5 -9
  138. data/lib/rubocop/cop/chef/modernize/ohai_default_recipe.rb +3 -2
  139. data/lib/rubocop/cop/chef/modernize/openssl_rsa_key_resource.rb +4 -6
  140. data/lib/rubocop/cop/chef/modernize/openssl_x509_resource.rb +4 -6
  141. data/lib/rubocop/cop/chef/modernize/osx_config_profile_resource.rb +5 -6
  142. data/lib/rubocop/cop/chef/modernize/powershell_expand_archive.rb +3 -4
  143. data/lib/rubocop/cop/chef/modernize/powershell_guard_interpreter.rb +5 -9
  144. data/lib/rubocop/cop/chef/modernize/powershell_install_package.rb +3 -4
  145. data/lib/rubocop/cop/chef/modernize/powershell_install_windowsfeature.rb +3 -4
  146. data/lib/rubocop/cop/chef/modernize/property_with_name_attribute.rb +6 -9
  147. data/lib/rubocop/cop/chef/modernize/provides_initializer.rb +13 -15
  148. data/lib/rubocop/cop/chef/modernize/resource_name_initializer.rb +10 -14
  149. data/lib/rubocop/cop/chef/modernize/resource_set_or_return.rb +3 -4
  150. data/lib/rubocop/cop/chef/modernize/resource_with_attributes.rb +8 -8
  151. data/lib/rubocop/cop/chef/modernize/respond_to_compile_time.rb +4 -9
  152. data/lib/rubocop/cop/chef/modernize/respond_to_metadata.rb +20 -16
  153. data/lib/rubocop/cop/chef/modernize/respond_to_provides.rb +6 -8
  154. data/lib/rubocop/cop/chef/modernize/respond_to_resource_name.rb +6 -8
  155. data/lib/rubocop/cop/chef/modernize/sc_windows_resource.rb +2 -1
  156. data/lib/rubocop/cop/chef/modernize/seven_zip_archive.rb +3 -2
  157. data/lib/rubocop/cop/chef/modernize/shell_out_helper.rb +3 -8
  158. data/lib/rubocop/cop/chef/modernize/shellouts_to_chocolatey.rb +5 -7
  159. data/lib/rubocop/cop/chef/modernize/simplify_apt_ppa_setup.rb +6 -10
  160. data/lib/rubocop/cop/chef/modernize/{systctl_param_resource.rb → sysctl_param_resource.rb} +4 -6
  161. data/lib/rubocop/cop/chef/modernize/unnecessary_mixlib_shellout_require.rb +6 -8
  162. data/lib/rubocop/cop/chef/modernize/use_multipackage_installs.rb +11 -10
  163. data/lib/rubocop/cop/chef/modernize/use_require_relative.rb +7 -9
  164. data/lib/rubocop/cop/chef/modernize/whyrun_supported_true.rb +5 -8
  165. data/lib/rubocop/cop/chef/modernize/windows_default_recipe.rb +6 -8
  166. data/lib/rubocop/cop/chef/modernize/windows_registry_uac.rb +6 -7
  167. data/lib/rubocop/cop/chef/modernize/windows_zipfile.rb +3 -2
  168. data/lib/rubocop/cop/chef/modernize/zipfile_resource.rb +4 -3
  169. data/lib/rubocop/cop/chef/modernize/zypper_repo.rb +4 -6
  170. data/lib/rubocop/cop/chef/redundant/apt_repository_distribution_default.rb +5 -8
  171. data/lib/rubocop/cop/chef/redundant/apt_repository_notifies_apt_update.rb +6 -8
  172. data/lib/rubocop/cop/chef/redundant/attribute_metadata.rb +4 -6
  173. data/lib/rubocop/cop/chef/redundant/conflicts_metadata.rb +4 -6
  174. data/lib/rubocop/cop/chef/redundant/custom_resource_with_allowed_actions.rb +8 -13
  175. data/lib/rubocop/cop/chef/redundant/grouping_metadata.rb +4 -6
  176. data/lib/rubocop/cop/chef/redundant/long_description_metadata.rb +4 -6
  177. data/lib/rubocop/cop/chef/redundant/multiple_platform_checks.rb +7 -9
  178. data/lib/rubocop/cop/chef/redundant/name_property_and_required.rb +2 -2
  179. data/lib/rubocop/cop/chef/redundant/ohai_attribute_to_string.rb +4 -8
  180. data/lib/rubocop/cop/chef/redundant/property_splat_regex.rb +8 -9
  181. data/lib/rubocop/cop/chef/redundant/property_with_default_and_required.rb +5 -9
  182. data/lib/rubocop/cop/chef/redundant/provides_metadata.rb +4 -6
  183. data/lib/rubocop/cop/chef/redundant/recipe_metadata.rb +4 -6
  184. data/lib/rubocop/cop/chef/redundant/replaces_metadata.rb +4 -6
  185. data/lib/rubocop/cop/chef/redundant/resource_with_nothing_action.rb +5 -8
  186. data/lib/rubocop/cop/chef/redundant/sensitive_property_in_resource.rb +6 -7
  187. data/lib/rubocop/cop/chef/redundant/string_property_with_nil_default.rb +7 -9
  188. data/lib/rubocop/cop/chef/redundant/suggests_metadata.rb +4 -6
  189. data/lib/rubocop/cop/chef/redundant/unnecessary_desired_state.rb +1 -0
  190. data/lib/rubocop/cop/chef/redundant/unnecessary_name_property.rb +10 -9
  191. data/lib/rubocop/cop/chef/redundant/use_create_if_missing.rb +7 -9
  192. data/lib/rubocop/cop/chef/sharing/default_maintainer_metadata.rb +3 -2
  193. data/lib/rubocop/cop/chef/sharing/empty_metadata_field.rb +3 -2
  194. data/lib/rubocop/cop/chef/sharing/include_property_descriptions.rb +1 -0
  195. data/lib/rubocop/cop/chef/sharing/include_resource_descriptions.rb +4 -4
  196. data/lib/rubocop/cop/chef/sharing/include_resource_examples.rb +4 -4
  197. data/lib/rubocop/cop/chef/sharing/insecure_cookbook_url.rb +7 -8
  198. data/lib/rubocop/cop/chef/sharing/invalid_license_string.rb +8 -12
  199. data/lib/rubocop/cop/chef/style/chef_whaaat.rb +3 -4
  200. data/lib/rubocop/cop/chef/style/comment_sentence_spacing.rb +5 -7
  201. data/lib/rubocop/cop/chef/style/comments_copyright_format.rb +5 -9
  202. data/lib/rubocop/cop/chef/style/comments_default_copyright.rb +5 -7
  203. data/lib/rubocop/cop/chef/style/comments_format.rb +13 -16
  204. data/lib/rubocop/cop/chef/style/file_mode.rb +1 -0
  205. data/lib/rubocop/cop/chef/style/immediate_notification_timing.rb +7 -8
  206. data/lib/rubocop/cop/chef/style/include_recipe_with_parentheses.rb +1 -0
  207. data/lib/rubocop/cop/chef/style/negating_only_if.rb +5 -9
  208. data/lib/rubocop/cop/chef/style/overly_complex_supports_depends_metadata.rb +5 -9
  209. data/lib/rubocop/cop/chef/style/simplify_platform_major_version_check.rb +6 -8
  210. data/lib/rubocop/cop/chef/style/true_false_resource_properties.rb +6 -9
  211. data/lib/rubocop/cop/chef/style/unnecessary_os_check.rb +17 -28
  212. data/lib/rubocop/cop/chef/style/unnecessary_platform_case_statement.rb +5 -9
  213. data/lib/rubocop/cop/chef/style/use_platform_helpers.rb +11 -19
  214. metadata +10 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e49171ce1ae18a21ed120dc5dcb5a19c0fa1923c4d0d34118c4315836a37043
4
- data.tar.gz: 77f7addb5541cb43836938196ba8fdfeebcbb75d10b940172e3a194652dc1c3b
3
+ metadata.gz: 76d0f2a3917c4ff1035541386d4edaa98f4cb782bd2f43a839d938b66aada708
4
+ data.tar.gz: ca7aff409b3d786fd71ac630c1d23b36f51a51ba495f7c2c4761c753c5e40624
5
5
  SHA512:
6
- metadata.gz: 52f6de8476deb4a8c0d01fb9d2258894baf9d27f3a4f0a9672f8dc7c35e1ba19ae6e0010c7f1096b6ae4004a16c784fc80351083904c7e13f6f38c7fda794b7c
7
- data.tar.gz: '0858305d54b66ec0b2d831377577efd5d609c64ccbec89c77c9f2acb41548f271d6d72cc00cc2c3a9a9db2439d7c503169d076e223e9f8f8460c7c9173e0c77a'
6
+ metadata.gz: 94bd535e28382dfd08776a053b8c6c9bb46e054a4dc3f10876b470de3755b3d6a78da9c71982ae3a7e0aee3856230e027ffe25457c77b8fd703df839acffeed4
7
+ data.tar.gz: f80c75e882aa27d4d4d81628c996acd2c2f5b1fc0226fafcd37b2ff86b2f9dddc9aa8f84c0b5cf4c8f71b1333757e2e239699966ac612902b426cae881ca91c1
@@ -2,7 +2,7 @@
2
2
  # -*- encoding: utf-8 -*-
3
3
  # frozen_string_literal: true
4
4
 
5
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w(.. lib))
5
+ $LOAD_PATH.unshift File.join(__dir__, %w(.. lib))
6
6
 
7
7
  require 'cookstyle'
8
8
 
@@ -210,14 +210,6 @@ ChefCorrectness/CookbookUsesNodeSave:
210
210
  - '**/metadata.rb'
211
211
  - '**/Berksfile'
212
212
 
213
- ChefCorrectness/CookbooksDependsOnSelf:
214
- Description: A cookbook cannot depend on itself
215
- StyleGuide: '#chefcorrectnesscookbooksdependonself'
216
- Enabled: true
217
- VersionAdded: '5.2.0'
218
- Include:
219
- - '**/metadata.rb'
220
-
221
213
  ChefCorrectness/MetadataMissingName:
222
214
  Description: The metadata.rb file is missing the name field which is required by Chef Infra Client 12 and later
223
215
  StyleGuide: '#chefcorrectnessmetadatamissingname'
@@ -916,10 +908,11 @@ ChefDeprecations/RubyBlockCreateAction:
916
908
  - '**/Berksfile'
917
909
 
918
910
  ChefDeprecations/DeprecatedPlatformMethods:
919
- Description: Use provider_for_action instead of the deprecated Chef::Platform methods in resources.
911
+ Description: Use provider_for_action or provides instead of the deprecated Chef::Platform methods in resources.
920
912
  StyleGuide: '#chefdeprecationsdeprecatedplatformmethods'
921
913
  Enabled: true
922
914
  VersionAdded: '5.16.0'
915
+ VersionChanged: '6.17.0'
923
916
  Include:
924
917
  - '**/libraries/*.rb'
925
918
  - '**/resources/*.rb'
@@ -1061,6 +1054,55 @@ ChefDeprecations/MacosUserdefaultsGlobalProperty:
1061
1054
  - '**/metadata.rb'
1062
1055
  - '**/Berksfile'
1063
1056
 
1057
+ ChefDeprecations/CookbooksDependsOnSelf:
1058
+ Description: A cookbook cannot depend on itself in Chef Infra Client 13 or later.
1059
+ StyleGuide: '#chefdeprecationscookbooksdependonself'
1060
+ Enabled: true
1061
+ VersionAdded: '5.2.0'
1062
+ VersionChanged: '6.16.0'
1063
+ Include:
1064
+ - '**/metadata.rb'
1065
+
1066
+ ChefDeprecations/ChefShellout:
1067
+ Description: Don't use deprecated Chef::ShellOut which was removed in Chef Infra Client 13. Use Mixlib::ShellOut instead, which behaves identically.
1068
+ StyleGuide: '#chefdeprecationschefshellout'
1069
+ Enabled: true
1070
+ VersionAdded: '6.17.0'
1071
+ Exclude:
1072
+ - '**/metadata.rb'
1073
+ - '**/attributes/*.rb'
1074
+ - '**/Berksfile'
1075
+
1076
+ ChefDeprecations/ExecutePathProperty:
1077
+ 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.
1078
+ StyleGuide: '#chefdeprecationsexecutepathproperty'
1079
+ Enabled: true
1080
+ VersionAdded: '6.17.0'
1081
+ Exclude:
1082
+ - '**/metadata.rb'
1083
+ - '**/attributes/*.rb'
1084
+ - '**/Berksfile'
1085
+
1086
+ ChefDeprecations/ExecuteRelativeCreatesWithoutCwd:
1087
+ 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.
1088
+ StyleGuide: '#chefdeprecationsexecuterelativecreateswithoutcwd'
1089
+ Enabled: true
1090
+ VersionAdded: '6.17.0'
1091
+ Exclude:
1092
+ - '**/metadata.rb'
1093
+ - '**/attributes/*.rb'
1094
+ - '**/Berksfile'
1095
+
1096
+ ChefDeprecations/WindowsPackageInstallerTypeString:
1097
+ Description: In Chef Infra Client 13 and later the `windows_package` resource's `installer_type` property must be a symbol.
1098
+ StyleGuide: '#chefdeprecationswindowspackageinstallertypestring'
1099
+ Enabled: true
1100
+ VersionAdded: '6.17.0'
1101
+ Exclude:
1102
+ - '**/metadata.rb'
1103
+ - '**/attributes/*.rb'
1104
+ - '**/Berksfile'
1105
+
1064
1106
  ###############################
1065
1107
  # ChefModernize: Cleaning up legacy code and using new built-in resources
1066
1108
  ###############################
@@ -2611,4 +2653,8 @@ Style/BisectedAttrAccessor:
2611
2653
 
2612
2654
  # avoid assignments that aren't needed
2613
2655
  Style/RedundantAssignment:
2614
- Enabled: true
2656
+ Enabled: true
2657
+
2658
+ # alert on invalid ruby
2659
+ Lint/Syntax:
2660
+ Enabled: true
@@ -53,6 +53,8 @@ Layout/EmptyLineAfterGuardClause:
53
53
  Enabled: false
54
54
  Layout/EmptyLineAfterMagicComment:
55
55
  Enabled: false
56
+ Layout/EmptyLineAfterMultilineCondition:
57
+ Enabled: false
56
58
  Layout/EmptyLineBetweenDefs:
57
59
  Enabled: false
58
60
  Layout/EmptyLinesAroundAccessModifier:
@@ -231,6 +233,8 @@ Lint/DuplicateHashKey:
231
233
  Enabled: false
232
234
  Lint/DuplicateMethods:
233
235
  Enabled: false
236
+ Lint/DuplicateRequire:
237
+ Enabled: false
234
238
  Lint/DuplicateRescueException:
235
239
  Enabled: false
236
240
  Lint/EachWithObjectArgument:
@@ -243,6 +247,8 @@ Lint/EmptyEnsure:
243
247
  Enabled: false
244
248
  Lint/EmptyExpression:
245
249
  Enabled: false
250
+ Lint/EmptyFile:
251
+ Enabled: false
246
252
  Lint/EmptyInterpolation:
247
253
  Enabled: false
248
254
  Lint/EmptyWhen:
@@ -361,6 +367,8 @@ Lint/ToJSON:
361
367
  Enabled: false
362
368
  Lint/TopLevelReturnWithArgument:
363
369
  Enabled: false
370
+ Lint/TrailingCommaInAttributeDeclaration:
371
+ Enabled: false
364
372
  Lint/UnderscorePrefixedVariableName:
365
373
  Enabled: false
366
374
  Lint/UnifiedInteger:
@@ -383,6 +391,8 @@ Lint/UselessAssignment:
383
391
  Enabled: false
384
392
  Lint/UselessElseWithoutRescue:
385
393
  Enabled: false
394
+ Lint/UselessMethodDefinition:
395
+ Enabled: false
386
396
  Lint/UselessSetterCall:
387
397
  Enabled: false
388
398
  Lint/Void:
@@ -477,6 +487,8 @@ Style/ClassCheck:
477
487
  Enabled: false
478
488
  Style/ClassMethods:
479
489
  Enabled: false
490
+ Style/ClassMethodsDefinitions:
491
+ Enabled: false
480
492
  Style/ClassVars:
481
493
  Enabled: false
482
494
  Style/CollectionMethods:
@@ -485,6 +497,8 @@ Style/ColonMethodCall:
485
497
  Enabled: false
486
498
  Style/ColonMethodDefinition:
487
499
  Enabled: false
500
+ Style/CombinableLoops:
501
+ Enabled: false
488
502
  Style/CommandLiteral:
489
503
  Enabled: false
490
504
  Style/CommentAnnotation:
@@ -591,6 +605,8 @@ Style/InlineComment:
591
605
  Enabled: false
592
606
  Style/IpAddresses:
593
607
  Enabled: false
608
+ Style/KeywordParametersOrder:
609
+ Enabled: false
594
610
  Style/Lambda:
595
611
  Enabled: false
596
612
  Style/LambdaCall:
@@ -607,6 +623,10 @@ Style/RedundantFetchBlock:
607
623
  Enabled: false
608
624
  Style/RedundantFileExtensionInRequire:
609
625
  Enabled: false
626
+ Style/RedundantSelfAssignment:
627
+ Enabled: false
628
+ Style/SoleNestedConditional:
629
+ Enabled: false
610
630
  Style/MethodCalledOnDoEndBlock:
611
631
  Enabled: false
612
632
  Style/MethodDefParentheses:
@@ -399,7 +399,6 @@ Layout/DefEndAlignment:
399
399
  SupportedStylesAlignWith:
400
400
  - start_of_line
401
401
  - def
402
- AutoCorrect: false
403
402
  Severity: warning
404
403
 
405
404
  Layout/DotPosition:
@@ -436,6 +435,14 @@ Layout/EmptyLineAfterMagicComment:
436
435
  Enabled: true
437
436
  VersionAdded: '0.49'
438
437
 
438
+ Layout/EmptyLineAfterMultilineCondition:
439
+ Description: 'Enforces empty line after multiline condition.'
440
+ # This is disabled, because this style is not very common in practice.
441
+ Enabled: false
442
+ VersionAdded: '0.90'
443
+ Reference:
444
+ - https://github.com/airbnb/ruby#multiline-if-newline
445
+
439
446
  Layout/EmptyLineBetweenDefs:
440
447
  Description: 'Use empty lines between defs.'
441
448
  StyleGuide: '#empty-lines-between-methods'
@@ -555,7 +562,6 @@ Layout/EndAlignment:
555
562
  - keyword
556
563
  - variable
557
564
  - start_of_line
558
- AutoCorrect: false
559
565
  Severity: warning
560
566
 
561
567
  Layout/EndOfLine:
@@ -1427,6 +1433,11 @@ Lint/DuplicateMethods:
1427
1433
  Enabled: true
1428
1434
  VersionAdded: '0.29'
1429
1435
 
1436
+ Lint/DuplicateRequire:
1437
+ Description: 'Check for duplicate `require`s and `require_relative`s.'
1438
+ Enabled: pending
1439
+ VersionAdded: '0.90'
1440
+
1430
1441
  Lint/DuplicateRescueException:
1431
1442
  Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
1432
1443
  Enabled: pending
@@ -1453,13 +1464,18 @@ Lint/EmptyEnsure:
1453
1464
  Enabled: true
1454
1465
  VersionAdded: '0.10'
1455
1466
  VersionChanged: '0.48'
1456
- AutoCorrect: false
1457
1467
 
1458
1468
  Lint/EmptyExpression:
1459
1469
  Description: 'Checks for empty expressions.'
1460
1470
  Enabled: true
1461
1471
  VersionAdded: '0.45'
1462
1472
 
1473
+ Lint/EmptyFile:
1474
+ Description: 'Enforces that Ruby source files are not empty.'
1475
+ Enabled: pending
1476
+ AllowComments: true
1477
+ VersionAdded: '0.90'
1478
+
1463
1479
  Lint/EmptyInterpolation:
1464
1480
  Description: 'Checks for empty string interpolation.'
1465
1481
  Enabled: true
@@ -1845,7 +1861,6 @@ Lint/Syntax:
1845
1861
  Enabled: true
1846
1862
  VersionAdded: '0.9'
1847
1863
 
1848
-
1849
1864
  Lint/ToJSON:
1850
1865
  Description: 'Ensure #to_json includes an optional argument.'
1851
1866
  Enabled: true
@@ -1856,6 +1871,11 @@ Lint/TopLevelReturnWithArgument:
1856
1871
  Enabled: 'pending'
1857
1872
  VersionAdded: '0.89'
1858
1873
 
1874
+ Lint/TrailingCommaInAttributeDeclaration:
1875
+ Description: 'This cop checks for trailing commas in attribute declarations.'
1876
+ Enabled: pending
1877
+ VersionAdded: '0.90'
1878
+
1859
1879
  Lint/UnderscorePrefixedVariableName:
1860
1880
  Description: 'Do not use prefix `_` for a variable that is used.'
1861
1881
  Enabled: true
@@ -1931,6 +1951,13 @@ Lint/UselessElseWithoutRescue:
1931
1951
  Enabled: true
1932
1952
  VersionAdded: '0.17'
1933
1953
 
1954
+ Lint/UselessMethodDefinition:
1955
+ Description: 'Checks for useless method definitions.'
1956
+ Enabled: pending
1957
+ VersionAdded: '0.90'
1958
+ Safe: false
1959
+ AllowComments: true
1960
+
1934
1961
  Lint/UselessSetterCall:
1935
1962
  Description: 'Checks for useless setter call to a local variable.'
1936
1963
  Enabled: true
@@ -2591,6 +2618,7 @@ Style/CaseLikeIf:
2591
2618
  Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2592
2619
  StyleGuide: '#case-vs-if-else'
2593
2620
  Enabled: 'pending'
2621
+ Safe: false
2594
2622
  VersionAdded: '0.88'
2595
2623
 
2596
2624
  Style/CharacterLiteral:
@@ -2608,7 +2636,6 @@ Style/ClassAndModuleChildren:
2608
2636
  # have the knowledge to perform either operation safely and thus requires
2609
2637
  # manual oversight.
2610
2638
  SafeAutoCorrect: false
2611
- AutoCorrect: false
2612
2639
  Enabled: true
2613
2640
  VersionAdded: '0.19'
2614
2641
  #
@@ -2647,6 +2674,16 @@ Style/ClassMethods:
2647
2674
  VersionAdded: '0.9'
2648
2675
  VersionChanged: '0.20'
2649
2676
 
2677
+ Style/ClassMethodsDefinitions:
2678
+ Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
2679
+ StyleGuide: '#def-self-class-methods'
2680
+ Enabled: false
2681
+ VersionAdded: '0.89'
2682
+ EnforcedStyle: def_self
2683
+ SupportedStyles:
2684
+ - def_self
2685
+ - self_class
2686
+
2650
2687
  Style/ClassVars:
2651
2688
  Description: 'Avoid the use of class variables.'
2652
2689
  StyleGuide: '#no-class-vars'
@@ -2687,6 +2724,14 @@ Style/ColonMethodDefinition:
2687
2724
  Enabled: true
2688
2725
  VersionAdded: '0.52'
2689
2726
 
2727
+ Style/CombinableLoops:
2728
+ Description: >-
2729
+ Checks for places where multiple consecutive loops over the same data
2730
+ can be combined into a single loop.
2731
+ Enabled: pending
2732
+ Safe: false
2733
+ VersionAdded: '0.90'
2734
+
2690
2735
  Style/CommandLiteral:
2691
2736
  Description: 'Use `` or %x around command literals.'
2692
2737
  StyleGuide: '#percent-x'
@@ -3021,7 +3066,7 @@ Style/FrozenStringLiteralComment:
3021
3066
  # `never` will enforce that the frozen string literal comment does not
3022
3067
  # exist in a file.
3023
3068
  - never
3024
- Safe: false
3069
+ SafeAutoCorrect: false
3025
3070
 
3026
3071
  Style/GlobalStdStream:
3027
3072
  Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
@@ -3101,15 +3146,17 @@ Style/HashSyntax:
3101
3146
  PreferHashRocketsForNonAlnumEndingSymbols: false
3102
3147
 
3103
3148
  Style/HashTransformKeys:
3104
- Description: 'Prefer `transform_keys` over `each_with_object` and `map`.'
3149
+ Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
3105
3150
  Enabled: 'pending'
3106
3151
  VersionAdded: '0.80'
3152
+ VersionChanged: '0.90'
3107
3153
  Safe: false
3108
3154
 
3109
3155
  Style/HashTransformValues:
3110
- Description: 'Prefer `transform_values` over `each_with_object` and `map`.'
3156
+ Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
3111
3157
  Enabled: 'pending'
3112
3158
  VersionAdded: '0.80'
3159
+ VersionChanged: '0.90'
3113
3160
  Safe: false
3114
3161
 
3115
3162
  Style/IdenticalConditionalBranches:
@@ -3206,6 +3253,12 @@ Style/IpAddresses:
3206
3253
  - "::"
3207
3254
  # :: is a valid IPv6 address, but could potentially be legitimately in code
3208
3255
 
3256
+ Style/KeywordParametersOrder:
3257
+ Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
3258
+ StyleGuide: '#keyword-parameters-order'
3259
+ Enabled: pending
3260
+ VersionAdded: '0.90'
3261
+
3209
3262
  Style/Lambda:
3210
3263
  Description: 'Use the new lambda literal syntax for single-line blocks.'
3211
3264
  StyleGuide: '#lambda-multi-line'
@@ -3579,7 +3632,6 @@ Style/NumericPredicate:
3579
3632
  # object. Switching these methods has to be done with knowledge of the types
3580
3633
  # of the variables which rubocop doesn't have.
3581
3634
  SafeAutoCorrect: false
3582
- AutoCorrect: false
3583
3635
  Enabled: true
3584
3636
  VersionAdded: '0.42'
3585
3637
  VersionChanged: '0.59'
@@ -3595,12 +3647,13 @@ Style/NumericPredicate:
3595
3647
 
3596
3648
  Style/OneLineConditional:
3597
3649
  Description: >-
3598
- Favor the ternary operator(?:) over
3599
- if/then/else/end constructs.
3650
+ Favor the ternary operator (?:) or multi-line constructs over
3651
+ single-line if/then/else/end constructs.
3600
3652
  StyleGuide: '#ternary-operator'
3601
3653
  Enabled: true
3654
+ AlwaysCorrectToMultiline: false
3602
3655
  VersionAdded: '0.9'
3603
- VersionChanged: '0.38'
3656
+ VersionChanged: '0.90'
3604
3657
 
3605
3658
  Style/OptionHash:
3606
3659
  Description: "Don't use option hashes when you can use keyword arguments."
@@ -3831,6 +3884,12 @@ Style/RedundantSelf:
3831
3884
  VersionAdded: '0.10'
3832
3885
  VersionChanged: '0.13'
3833
3886
 
3887
+ Style/RedundantSelfAssignment:
3888
+ Description: 'Checks for places where redundant assignments are made for in place modification methods.'
3889
+ Enabled: pending
3890
+ Safe: false
3891
+ VersionAdded: '0.90'
3892
+
3834
3893
  Style/RedundantSort:
3835
3894
  Description: >-
3836
3895
  Use `min` instead of `sort.first`,
@@ -3983,6 +4042,14 @@ Style/SlicingWithRange:
3983
4042
  VersionAdded: '0.83'
3984
4043
  Safe: false
3985
4044
 
4045
+ Style/SoleNestedConditional:
4046
+ Description: >-
4047
+ Finds sole nested conditional nodes
4048
+ which can be merged into outer conditional node.
4049
+ Enabled: pending
4050
+ VersionAdded: '0.89'
4051
+ AllowModifier: false
4052
+
3986
4053
  Style/SpecialGlobalVars:
3987
4054
  Description: 'Avoid Perl-style global variables.'
3988
4055
  StyleGuide: '#no-cryptic-perlisms'
@@ -19,7 +19,7 @@ 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.15.9" # rubocop: disable Style/StringLiterals
4
- RUBOCOP_VERSION = '0.89.1'
3
+ VERSION = "6.17.5" # rubocop: disable Style/StringLiterals
4
+ RUBOCOP_VERSION = '0.90.0'
5
5
  end