cookstyle 6.9.0 → 6.14.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -0
  3. data/bin/cookstyle +1 -0
  4. data/bin/cookstyle-profile +31 -0
  5. data/config/cookstyle.yml +146 -28
  6. data/config/disable_all.yml +18 -0
  7. data/config/upstream.yml +103 -10
  8. data/cookstyle.gemspec +1 -0
  9. data/lib/cookstyle.rb +6 -4
  10. data/lib/cookstyle/version.rb +3 -2
  11. data/lib/rubocop/chef.rb +1 -0
  12. data/lib/rubocop/chef/autocorrect_helpers.rb +1 -0
  13. data/lib/rubocop/chef/cookbook_helpers.rb +1 -0
  14. data/lib/rubocop/chef/platform_helpers.rb +1 -0
  15. data/lib/rubocop/cop/chef/correctness/block_guard_clause_string_only.rb +2 -1
  16. data/lib/rubocop/cop/chef/correctness/cb_depends_on_self.rb +2 -1
  17. data/lib/rubocop/cop/chef/correctness/chef_application_fatal.rb +2 -1
  18. data/lib/rubocop/cop/chef/correctness/conditional_ruby_shellout.rb +2 -1
  19. data/lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb +2 -1
  20. data/lib/rubocop/cop/chef/correctness/incorrect_library_injection.rb +12 -1
  21. data/lib/rubocop/cop/chef/correctness/invalid_default_action.rb +48 -0
  22. data/lib/rubocop/cop/chef/correctness/invalid_notification_timing.rb +2 -1
  23. data/lib/rubocop/cop/chef/correctness/invalid_platform_family_helper.rb +28 -4
  24. data/lib/rubocop/cop/chef/correctness/invalid_platform_family_values_in_case.rb +2 -1
  25. data/lib/rubocop/cop/chef/correctness/invalid_platform_helper.rb +2 -1
  26. data/lib/rubocop/cop/chef/correctness/invalid_platform_metadata.rb +2 -1
  27. data/lib/rubocop/cop/chef/correctness/invalid_platform_values_in_case.rb +2 -1
  28. data/lib/rubocop/cop/chef/correctness/invalid_value_for_platform_family_helper.rb +2 -1
  29. data/lib/rubocop/cop/chef/correctness/invalid_value_for_platform_helper.rb +2 -1
  30. data/lib/rubocop/cop/chef/correctness/invalid_version_metadata.rb +2 -1
  31. data/lib/rubocop/cop/chef/correctness/lazy_eval_node_attribute_defaults.rb +2 -1
  32. data/lib/rubocop/cop/chef/correctness/macos_userdefaults_invalid_type.rb +68 -0
  33. data/lib/rubocop/cop/chef/correctness/malformed_value_for_platform.rb +1 -0
  34. data/lib/rubocop/cop/chef/correctness/metadata_missing_name.rb +2 -1
  35. data/lib/rubocop/cop/chef/correctness/node_normal.rb +2 -1
  36. data/lib/rubocop/cop/chef/correctness/node_normal_unless.rb +2 -1
  37. data/lib/rubocop/cop/chef/correctness/node_save.rb +2 -1
  38. data/lib/rubocop/cop/chef/correctness/notifies_action_not_symbol.rb +6 -5
  39. data/lib/rubocop/cop/chef/correctness/openssl_password_helpers.rb +2 -1
  40. data/lib/rubocop/cop/chef/correctness/powershell_delete_file.rb +2 -1
  41. data/lib/rubocop/cop/chef/correctness/resource_sets_internal_properties.rb +2 -1
  42. data/lib/rubocop/cop/chef/correctness/resource_sets_name_property.rb +2 -1
  43. data/lib/rubocop/cop/chef/correctness/resource_with_none_action.rb +2 -1
  44. data/lib/rubocop/cop/chef/correctness/scoped_file_exist.rb +2 -1
  45. data/lib/rubocop/cop/chef/correctness/service_resource.rb +2 -1
  46. data/lib/rubocop/cop/chef/correctness/supports_must_be_float.rb +52 -0
  47. data/lib/rubocop/cop/chef/correctness/tmp_path.rb +2 -1
  48. data/lib/rubocop/cop/chef/deprecation/ use_automatic_resource_name.rb +52 -0
  49. data/lib/rubocop/cop/chef/deprecation/chef_handler_recipe.rb +55 -0
  50. data/lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb +2 -1
  51. data/lib/rubocop/cop/chef/deprecation/chef_rest.rb +2 -1
  52. data/lib/rubocop/cop/chef/deprecation/chef_rewind.rb +2 -1
  53. data/lib/rubocop/cop/chef/deprecation/chef_windows_platform_helper.rb +2 -1
  54. data/lib/rubocop/cop/chef/deprecation/chefdk_generators.rb +60 -0
  55. data/lib/rubocop/cop/chef/deprecation/cheffile.rb +3 -2
  56. data/lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb +2 -1
  57. data/lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb +2 -1
  58. data/lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb +2 -1
  59. data/lib/rubocop/cop/chef/deprecation/depends_compat_resource.rb +2 -1
  60. data/lib/rubocop/cop/chef/deprecation/depends_partial_search.rb +2 -1
  61. data/lib/rubocop/cop/chef/deprecation/depends_poise.rb +2 -1
  62. data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +2 -1
  63. data/lib/rubocop/cop/chef/deprecation/deprecated_mixins.rb +2 -1
  64. data/lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb +2 -1
  65. data/lib/rubocop/cop/chef/deprecation/deprecated_shellout_methods.rb +2 -1
  66. data/lib/rubocop/cop/chef/deprecation/deprecated_windows_version_check.rb +2 -1
  67. data/lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_properties.rb +2 -1
  68. data/lib/rubocop/cop/chef/deprecation/easy_install.rb +2 -1
  69. data/lib/rubocop/cop/chef/deprecation/eol_audit_mode.rb +3 -2
  70. data/lib/rubocop/cop/chef/deprecation/epic_fail.rb +2 -1
  71. data/lib/rubocop/cop/chef/deprecation/erl_call.rb +2 -1
  72. data/lib/rubocop/cop/chef/deprecation/hwrp_without_provides.rb +2 -1
  73. data/lib/rubocop/cop/chef/deprecation/inherits_compat_resource.rb +2 -1
  74. data/lib/rubocop/cop/chef/deprecation/launchd_deprecated_hash_property.rb +2 -1
  75. data/lib/rubocop/cop/chef/deprecation/legacy_notify_syntax.rb +3 -2
  76. data/lib/rubocop/cop/chef/deprecation/legacy_yum_cookbook_recipes.rb +2 -1
  77. data/lib/rubocop/cop/chef/deprecation/locale_lc_all_property.rb +2 -1
  78. data/lib/rubocop/cop/chef/deprecation/log_resource_notifications.rb +2 -1
  79. data/lib/rubocop/cop/chef/deprecation/macos_userdefaults_global_property.rb +61 -0
  80. data/lib/rubocop/cop/chef/deprecation/name_property_and_default.rb +2 -1
  81. data/lib/rubocop/cop/chef/deprecation/node_deep_fetch.rb +8 -21
  82. data/lib/rubocop/cop/chef/deprecation/node_methods_not_attributes.rb +2 -1
  83. data/lib/rubocop/cop/chef/deprecation/node_set.rb +2 -1
  84. data/lib/rubocop/cop/chef/deprecation/node_set_unless.rb +2 -1
  85. data/lib/rubocop/cop/chef/deprecation/node_set_without_level.rb +2 -1
  86. data/lib/rubocop/cop/chef/deprecation/partial_search_class_usage.rb +2 -1
  87. data/lib/rubocop/cop/chef/deprecation/partial_search_helper_usage.rb +2 -1
  88. data/lib/rubocop/cop/chef/deprecation/poise_archive.rb +4 -3
  89. data/lib/rubocop/cop/chef/deprecation/powershell_cookbook_helpers.rb +2 -1
  90. data/lib/rubocop/cop/chef/deprecation/require_recipe.rb +2 -1
  91. data/lib/rubocop/cop/chef/deprecation/resource_overrides_provides_method.rb +2 -1
  92. data/lib/rubocop/cop/chef/deprecation/resource_uses_dsl_name_method.rb +2 -1
  93. data/lib/rubocop/cop/chef/deprecation/resource_uses_only_resource_name.rb +3 -2
  94. data/lib/rubocop/cop/chef/deprecation/resource_uses_provider_base_method.rb +2 -1
  95. data/lib/rubocop/cop/chef/deprecation/resource_uses_updated_method.rb +2 -1
  96. data/lib/rubocop/cop/chef/deprecation/ruby_27_keyword_argument_warnings.rb +3 -2
  97. data/lib/rubocop/cop/chef/deprecation/ruby_block_create_action.rb +2 -1
  98. data/lib/rubocop/cop/chef/deprecation/run_command_helper.rb +2 -1
  99. data/lib/rubocop/cop/chef/deprecation/search_uses_positional_parameters.rb +2 -1
  100. data/lib/rubocop/cop/chef/deprecation/use_inline_resources.rb +2 -1
  101. data/lib/rubocop/cop/chef/deprecation/user_supports_property.rb +2 -1
  102. data/lib/rubocop/cop/chef/deprecation/verify_property_file_expansion.rb +2 -1
  103. data/lib/rubocop/cop/chef/deprecation/windows_feature_servermanagercmd.rb +2 -1
  104. data/lib/rubocop/cop/chef/deprecation/windows_task_change_action.rb +2 -1
  105. data/lib/rubocop/cop/chef/deprecation/windows_version_helpers.rb +2 -1
  106. data/lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb +2 -1
  107. data/lib/rubocop/cop/chef/deprecation/yum_dnf_compat_recipe.rb +2 -1
  108. data/lib/rubocop/cop/chef/effortless/berksfile.rb +2 -1
  109. data/lib/rubocop/cop/chef/effortless/data_bags.rb +2 -1
  110. data/lib/rubocop/cop/chef/effortless/node_environment.rb +3 -2
  111. data/lib/rubocop/cop/chef/effortless/node_policygroup.rb +2 -1
  112. data/lib/rubocop/cop/chef/effortless/node_roles.rb +5 -4
  113. data/lib/rubocop/cop/chef/effortless/search_for_environments_or_roles.rb +2 -1
  114. data/lib/rubocop/cop/chef/effortless/search_used.rb +2 -1
  115. data/lib/rubocop/cop/chef/modernize/action_method_in_resource.rb +57 -0
  116. data/lib/rubocop/cop/chef/modernize/allowed_actions_initializer.rb +4 -3
  117. data/lib/rubocop/cop/chef/modernize/apt_default_recipe.rb +2 -1
  118. data/lib/rubocop/cop/chef/modernize/berksfile_source.rb +2 -1
  119. data/lib/rubocop/cop/chef/modernize/build_essential.rb +2 -1
  120. data/lib/rubocop/cop/chef/modernize/chef_14_resources.rb +2 -1
  121. data/lib/rubocop/cop/chef/modernize/chef_gem_nokogiri.rb +2 -1
  122. data/lib/rubocop/cop/chef/modernize/compile_time_resources.rb +2 -1
  123. data/lib/rubocop/cop/chef/modernize/conditional_using_test.rb +57 -0
  124. data/lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb +88 -0
  125. data/lib/rubocop/cop/chef/modernize/cron_manage_resource.rb +2 -1
  126. data/lib/rubocop/cop/chef/modernize/databag_helpers.rb +2 -1
  127. data/lib/rubocop/cop/chef/modernize/default_action_initializer.rb +5 -4
  128. data/lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb +2 -1
  129. data/lib/rubocop/cop/chef/modernize/definitions.rb +3 -2
  130. data/lib/rubocop/cop/chef/modernize/depends_zypper_cookbook.rb +2 -1
  131. data/lib/rubocop/cop/chef/modernize/dsl_include_in_resource.rb +2 -1
  132. data/lib/rubocop/cop/chef/modernize/empty_resource_initialize.rb +2 -1
  133. data/lib/rubocop/cop/chef/modernize/execute_apt_update.rb +3 -2
  134. data/lib/rubocop/cop/chef/modernize/execute_sc_exe.rb +2 -1
  135. data/lib/rubocop/cop/chef/modernize/execute_sleep.rb +2 -1
  136. data/lib/rubocop/cop/chef/modernize/execute_sysctl.rb +2 -1
  137. data/lib/rubocop/cop/chef/modernize/execute_tzutil.rb +2 -1
  138. data/lib/rubocop/cop/chef/modernize/foodcritic_comments.rb +2 -1
  139. data/lib/rubocop/cop/chef/modernize/if_provides_default_action.rb +2 -1
  140. data/lib/rubocop/cop/chef/modernize/includes_mixin_shellout.rb +2 -1
  141. data/lib/rubocop/cop/chef/modernize/libarchive_file.rb +2 -1
  142. data/lib/rubocop/cop/chef/modernize/macos_user_defaults.rb +2 -1
  143. data/lib/rubocop/cop/chef/modernize/minitest_handler_usage.rb +2 -1
  144. data/lib/rubocop/cop/chef/modernize/node_init_package.rb +18 -9
  145. data/lib/rubocop/cop/chef/modernize/node_roles_include.rb +2 -1
  146. data/lib/rubocop/cop/chef/modernize/ohai_default_recipe.rb +2 -1
  147. data/lib/rubocop/cop/chef/modernize/openssl_rsa_key_resource.rb +2 -1
  148. data/lib/rubocop/cop/chef/modernize/openssl_x509_resource.rb +2 -1
  149. data/lib/rubocop/cop/chef/modernize/osx_config_profile_resource.rb +2 -1
  150. data/lib/rubocop/cop/chef/modernize/powershell_expand_archive.rb +2 -1
  151. data/lib/rubocop/cop/chef/modernize/powershell_guard_interpreter.rb +2 -1
  152. data/lib/rubocop/cop/chef/modernize/powershell_install_package.rb +2 -1
  153. data/lib/rubocop/cop/chef/modernize/powershell_install_windowsfeature.rb +2 -1
  154. data/lib/rubocop/cop/chef/modernize/property_with_name_attribute.rb +2 -1
  155. data/lib/rubocop/cop/chef/modernize/provides_initializer.rb +5 -4
  156. data/lib/rubocop/cop/chef/modernize/resource_name_initializer.rb +4 -3
  157. data/lib/rubocop/cop/chef/modernize/resource_set_or_return.rb +2 -1
  158. data/lib/rubocop/cop/chef/modernize/resource_with_attributes.rb +2 -1
  159. data/lib/rubocop/cop/chef/modernize/respond_to_compile_time.rb +2 -1
  160. data/lib/rubocop/cop/chef/modernize/respond_to_metadata.rb +2 -1
  161. data/lib/rubocop/cop/chef/modernize/respond_to_provides.rb +2 -1
  162. data/lib/rubocop/cop/chef/modernize/respond_to_resource_name.rb +2 -1
  163. data/lib/rubocop/cop/chef/modernize/sc_windows_resource.rb +2 -1
  164. data/lib/rubocop/cop/chef/modernize/seven_zip_archive.rb +2 -1
  165. data/lib/rubocop/cop/chef/modernize/shell_out_helper.rb +2 -1
  166. data/lib/rubocop/cop/chef/modernize/shellouts_to_chocolatey.rb +2 -1
  167. data/lib/rubocop/cop/chef/modernize/simplify_apt_ppa_setup.rb +2 -1
  168. data/lib/rubocop/cop/chef/modernize/systctl_param_resource.rb +2 -1
  169. data/lib/rubocop/cop/chef/modernize/unnecessary_mixlib_shellout_require.rb +2 -1
  170. data/lib/rubocop/cop/chef/modernize/use_multipackage_installs.rb +4 -3
  171. data/lib/rubocop/cop/chef/modernize/use_require_relative.rb +2 -1
  172. data/lib/rubocop/cop/chef/modernize/whyrun_supported_true.rb +2 -1
  173. data/lib/rubocop/cop/chef/modernize/windows_default_recipe.rb +2 -1
  174. data/lib/rubocop/cop/chef/modernize/windows_registry_uac.rb +2 -1
  175. data/lib/rubocop/cop/chef/modernize/windows_zipfile.rb +2 -1
  176. data/lib/rubocop/cop/chef/modernize/zipfile_resource.rb +2 -1
  177. data/lib/rubocop/cop/chef/modernize/zypper_repo.rb +2 -1
  178. data/lib/rubocop/cop/chef/redundant/apt_repository_distribution_default.rb +2 -1
  179. data/lib/rubocop/cop/chef/redundant/apt_repository_notifies_apt_update.rb +2 -1
  180. data/lib/rubocop/cop/chef/redundant/attribute_metadata.rb +2 -1
  181. data/lib/rubocop/cop/chef/redundant/conflicts_metadata.rb +2 -1
  182. data/lib/rubocop/cop/chef/redundant/custom_resource_with_allowed_actions.rb +2 -1
  183. data/lib/rubocop/cop/chef/redundant/double_compile_time.rb +65 -0
  184. data/lib/rubocop/cop/chef/redundant/grouping_metadata.rb +2 -1
  185. data/lib/rubocop/cop/chef/redundant/long_description_metadata.rb +2 -1
  186. data/lib/rubocop/cop/chef/redundant/multiple_platform_checks.rb +61 -0
  187. data/lib/rubocop/cop/chef/redundant/name_property_and_required.rb +2 -1
  188. data/lib/rubocop/cop/chef/redundant/ohai_attribute_to_string.rb +69 -0
  189. data/lib/rubocop/cop/chef/redundant/property_splat_regex.rb +2 -1
  190. data/lib/rubocop/cop/chef/redundant/property_with_default_and_required.rb +2 -1
  191. data/lib/rubocop/cop/chef/redundant/provides_metadata.rb +2 -1
  192. data/lib/rubocop/cop/chef/redundant/recipe_metadata.rb +2 -1
  193. data/lib/rubocop/cop/chef/redundant/replaces_metadata.rb +2 -1
  194. data/lib/rubocop/cop/chef/redundant/resource_with_nothing_action.rb +2 -1
  195. data/lib/rubocop/cop/chef/redundant/sensitive_property_in_resource.rb +2 -1
  196. data/lib/rubocop/cop/chef/redundant/string_property_with_nil_default.rb +2 -1
  197. data/lib/rubocop/cop/chef/redundant/suggests_metadata.rb +2 -1
  198. data/lib/rubocop/cop/chef/redundant/unnecessary_desired_state.rb +2 -1
  199. data/lib/rubocop/cop/chef/redundant/unnecessary_name_property.rb +2 -1
  200. data/lib/rubocop/cop/chef/redundant/use_create_if_missing.rb +2 -1
  201. data/lib/rubocop/cop/chef/sharing/default_maintainer_metadata.rb +2 -1
  202. data/lib/rubocop/cop/chef/sharing/empty_metadata_field.rb +2 -1
  203. data/lib/rubocop/cop/chef/sharing/include_property_descriptions.rb +3 -2
  204. data/lib/rubocop/cop/chef/sharing/include_resource_descriptions.rb +3 -2
  205. data/lib/rubocop/cop/chef/sharing/include_resource_examples.rb +60 -0
  206. data/lib/rubocop/cop/chef/sharing/insecure_cookbook_url.rb +2 -1
  207. data/lib/rubocop/cop/chef/sharing/invalid_license_string.rb +2 -1
  208. data/lib/rubocop/cop/chef/style/attribute_keys.rb +2 -1
  209. data/lib/rubocop/cop/chef/style/chef_whaaat.rb +2 -1
  210. data/lib/rubocop/cop/chef/style/comment_sentence_spacing.rb +2 -1
  211. data/lib/rubocop/cop/chef/style/comments_copyright_format.rb +2 -1
  212. data/lib/rubocop/cop/chef/style/comments_default_copyright.rb +2 -1
  213. data/lib/rubocop/cop/chef/style/comments_format.rb +2 -1
  214. data/lib/rubocop/cop/chef/style/file_mode.rb +39 -19
  215. data/lib/rubocop/cop/chef/style/immediate_notification_timing.rb +2 -1
  216. data/lib/rubocop/cop/chef/style/include_recipe_with_parentheses.rb +58 -0
  217. data/lib/rubocop/cop/chef/style/negating_only_if.rb +2 -1
  218. data/lib/rubocop/cop/chef/style/overly_complex_supports_depends_metadata.rb +2 -1
  219. data/lib/rubocop/cop/chef/style/simplify_platform_major_version_check.rb +2 -1
  220. data/lib/rubocop/cop/chef/style/true_false_resource_properties.rb +2 -1
  221. data/lib/rubocop/cop/chef/style/unnecessary_os_check.rb +3 -3
  222. data/lib/rubocop/cop/chef/style/unnecessary_platform_case_statement.rb +3 -2
  223. data/lib/rubocop/cop/chef/style/use_platform_helpers.rb +3 -3
  224. data/lib/rubocop/monkey_patches/{cop.rb → base.rb} +2 -1
  225. data/lib/rubocop/monkey_patches/comment_config.rb +1 -0
  226. data/lib/rubocop/monkey_patches/registry_cop.rb +15 -0
  227. metadata +22 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b65eaf5352ddaf7aa98b395f94211e6c8ff7f408d17d869a4fa4e0dd7f33931a
4
- data.tar.gz: 7f09b6880e5301bc2e41c97b9d6dc4eb2d6e8cc33d6ed1621c7cd4b7c04ba530
3
+ metadata.gz: 07d286963f81d70ccc2e4eeb9b3c7fb557485877c5bb95ac2b8c2bf5aa79bd50
4
+ data.tar.gz: 73e58cae888fc04614c21a724257f5833b146afddc6339ae8b3dd969ea9b5f35
5
5
  SHA512:
6
- metadata.gz: 942e6f7efeb10b18996de509b6c9af74f2e33b691e3778df3e0a8c1b6530d7b848362bfb45a0521531cb2a143e68b27f8b1d9867606e6b6132f9f0a92e286d3b
7
- data.tar.gz: b6356cf4266f6bd9162f13de266e3f8390614004b4a7cb13f2a50f3c9e2be70338b7d6dc8bdeb3fb5d8605f5acbf9b87e4f42fd293c4ad280999650ad3023c0f
6
+ metadata.gz: af409a2dbf43a42e874f8b8e40006c9b97450d8b1048b765a57774c999d0e3e3163cc391239c82e117fd1e7f5ae9de4435625994d6ef0516ba71c2716502fc87
7
+ data.tar.gz: 7118a2999c086064f8d0be2cea95d7b1bbe3ea00ceb7a1e0a018f683ff676d993d591127ed35450daddf402e75f84c5fecf4252d450f535b525966f0469f127c
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  source 'https://rubygems.org'
2
3
 
3
4
  # Specify your gem's dependencies in cookstyle.gemspec
@@ -15,6 +16,11 @@ group :docs do
15
16
  gem 'yard'
16
17
  end
17
18
 
19
+ group :profiling do
20
+ gem 'stackprof'
21
+ gem 'memory_profiler'
22
+ end
23
+
18
24
  group :development do
19
25
  gem 'adamantium'
20
26
  gem 'anima'
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- encoding: utf-8 -*-
3
+ # frozen_string_literal: true
3
4
 
4
5
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w(.. lib))
5
6
 
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ if ARGV.include?('-h') || ARGV.include?('--help')
5
+ puts 'Usage: same as main `cookstyle` command but gathers profiling info'
6
+ puts 'Additional option: `--memory` to print memory usage'
7
+ exit(0)
8
+ end
9
+ with_mem = ARGV.delete('--memory')
10
+
11
+ require 'stackprof'
12
+ if with_mem
13
+ require 'memory_profiler'
14
+ MemoryProfiler.start
15
+ end
16
+ StackProf.start
17
+ start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
18
+ begin
19
+ load "#{__dir__}/cookstyle"
20
+ ensure
21
+ delta = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
22
+ puts "Finished in #{delta.round(1)} seconds"
23
+ StackProf.stop
24
+ if with_mem
25
+ puts 'Building memory report...'
26
+ report = MemoryProfiler.stop
27
+ end
28
+ Dir.mkdir('tmp') unless File.exist?('tmp')
29
+ StackProf.results('tmp/stackprof.dump')
30
+ report&.pretty_print(scale_bytes: true)
31
+ end
@@ -5,27 +5,6 @@ AllCops:
5
5
  - '/**/files/**/*'
6
6
  - '/**/vendor/**/*'
7
7
  - Guardfile
8
- ChefAttributes:
9
- Patterns:
10
- - attributes/.*\.rb
11
- ChefDefinitions:
12
- Patterns:
13
- - definitions/.*\.rb
14
- ChefLibraries:
15
- Patterns:
16
- - libraries/.*\.rb
17
- ChefMetadata:
18
- Patterns:
19
- - metadata\.rb
20
- ChefProviders:
21
- Patterns:
22
- - providers/.*\.rb
23
- ChefRecipes:
24
- Patterns:
25
- - recipes/.*\.rb
26
- ChefResources:
27
- Patterns:
28
- - resources/.*\.rb
29
8
 
30
9
  ###############################
31
10
  # ChefStyle: Making cookbooks look better
@@ -67,7 +46,7 @@ ChefStyle/CommentFormat:
67
46
  - '**/Berksfile'
68
47
 
69
48
  ChefStyle/FileMode:
70
- Description: Use strings to represent file modes in Chef resources
49
+ Description: Use strings to represent file modes to avoid confusion between octal and base 10 integer formats.
71
50
  StyleGuide: '#chefstylefilemode'
72
51
  Enabled: true
73
52
  VersionAdded: '5.0.0'
@@ -161,6 +140,16 @@ ChefStyle/NegatingOnlyIf:
161
140
  - '**/metadata.rb'
162
141
  - '**/Berksfile'
163
142
 
143
+ ChefStyle/IncludeRecipeWithParentheses:
144
+ Description: There is no need to wrap the recipe in parentheses when using the include_recipe helper
145
+ StyleGuide: '#includerecipewithparentheses'
146
+ VersionAdded: '6.11.0'
147
+ Enabled: true
148
+ Exclude:
149
+ - '**/attributes/*.rb'
150
+ - '**/metadata.rb'
151
+ - '**/Berksfile'
152
+
164
153
  ###############################
165
154
  # ChefCorrectness: Avoiding potential problems
166
155
  ###############################
@@ -300,8 +289,9 @@ ChefCorrectness/IncorrectLibraryInjection:
300
289
  StyleGuide: '#chefcorrectnessincorrectlibraryinjection'
301
290
  Enabled: true
302
291
  VersionAdded: '5.10.0'
303
- Include:
304
- - '**/libraries/*.rb'
292
+ Exclude:
293
+ - '**/metadata.rb'
294
+ - '**/Berksfile'
305
295
 
306
296
  ChefCorrectness/InvalidPlatformHelper:
307
297
  Description: Pass valid platforms to the platform? helper.
@@ -443,6 +433,32 @@ ChefCorrectness/InvalidPlatformInCase:
443
433
  - '**/metadata.rb'
444
434
  - '**/Berksfile'
445
435
 
436
+ ChefCorrectness/InvalidDefaultAction:
437
+ Description: Default actions in resources should be a symbol or an array of symbols.
438
+ StyleGuide: '#chefcorrectnessinvaliddefaultaction'
439
+ Enabled: true
440
+ VersionAdded: '6.13.0'
441
+ Include:
442
+ - '**/libraries/*.rb'
443
+ - '**/resources/*.rb'
444
+
445
+ ChefCorrectness/SupportsMustBeFloat:
446
+ Description: Versions used in metadata.rb supports calls should be floats not integers.
447
+ StyleGuide: '#chefcorrectnesssupportsmustbefloat'
448
+ Enabled: true
449
+ VersionAdded: '6.13.0'
450
+ Include:
451
+ - '**/metadata.rb'
452
+
453
+ ChefCorrectness/MacosUserdefaultsInvalidType:
454
+ Description: The macos_userdefaults resource prior to Chef Infra Client 16.3 would silently continue if invalid types were passed resulting in unexpected behavior. Valid values are 'array', 'bool', 'dict', 'float', 'int', and 'string'.
455
+ StyleGuide: '#chefcorrectnessmacosuserdefaultsinvalidtype'
456
+ Enabled: true
457
+ VersionAdded: '6.14.0'
458
+ Exclude:
459
+ - '**/metadata.rb'
460
+ - '**/Berksfile'
461
+
446
462
  ###############################
447
463
  # ChefSharing: Issues that prevent sharing code with other teams or with the Chef community in general
448
464
  ###############################
@@ -487,7 +503,7 @@ ChefSharing/EmptyMetadataField:
487
503
  - '**/metadata.rb'
488
504
 
489
505
  ChefSharing/IncludePropertyDescriptions:
490
- Description: Properties should include description fields to allow automated documention. Requires Chef Infra Client 13.9 or later.
506
+ Description: Properties should include description fields to allow automated documentation. Requires Chef Infra Client 13.9 or later.
491
507
  StyleGuide: '#chefsharingincludepropetydescriptions'
492
508
  Enabled: false
493
509
  VersionAdded: '6.1.0'
@@ -496,13 +512,21 @@ ChefSharing/IncludePropertyDescriptions:
496
512
  - '**/resources/*.rb'
497
513
 
498
514
  ChefSharing/IncludeResourceDescriptions:
499
- Description: Resources should include description fields to allow automated documention. Requires Chef Infra Client 13.9 or later.
515
+ Description: Resources should include description fields to allow automated documentation. Requires Chef Infra Client 13.9 or later.
500
516
  StyleGuide: '#chefsharingincluderesourcedescriptions'
501
517
  Enabled: false
502
518
  VersionAdded: '6.1.0'
503
519
  Include:
504
520
  - '**/resources/*.rb'
505
521
 
522
+ ChefSharing/IncludeResourceExamples:
523
+ Description: Resources should include examples field to allow automated documentation. Requires Chef Infra Client 13.9 or later.
524
+ StyleGuide: '#chefsharingincluderesourceexamples'
525
+ Enabled: false
526
+ VersionAdded: '6.10.0'
527
+ Include:
528
+ - '**/resources/*.rb'
529
+
506
530
  ###############################
507
531
  # ChefDeprecations: Resolving Deprecations that block upgrading Chef Infra Client
508
532
  ###############################
@@ -1001,6 +1025,42 @@ ChefDeprecations/ResourceUsesOnlyResourceName:
1001
1025
  - '**/libraries/*.rb'
1002
1026
  - '**/resources/*.rb'
1003
1027
 
1028
+ ChefDeprecations/ChefDKGenerators:
1029
+ Description: Chef Workstation 0.8 and later renamed the ChefDK module used when writing custom cookbook generators from ChefDK to ChefCLI. For compatibility with the latest Chef Workstation releases you'll need to reference the new class names.
1030
+ StyleGuide: '#chefdeprecationschefdkgenerators'
1031
+ Enabled: true
1032
+ VersionAdded: '6.12.0'
1033
+ Exclude:
1034
+ - '**/metadata.rb'
1035
+ - '**/Berksfile'
1036
+
1037
+ ChefDeprecations/ChefHandlerRecipe:
1038
+ Description: There is no need to include the empty and deprecated chef_handler::default recipe in order to use the chef_handler resource.
1039
+ StyleGuide: '#chefdeprecationschefhandlerrecipe'
1040
+ Enabled: true
1041
+ VersionAdded: '6.12.0'
1042
+ Exclude:
1043
+ - '**/metadata.rb'
1044
+ - '**/Berksfile'
1045
+
1046
+ ChefDeprecations/UseAutomaticResourceName:
1047
+ Description: The use_automatic_resource_name method was removed in Chef Infra Client 16. The resource name/provides should be set explicitly instead.
1048
+ StyleGuide: '#chefdeprecationsuseautomaticresourcename'
1049
+ Enabled: true
1050
+ VersionAdded: '6.12.0'
1051
+ Include:
1052
+ - '**/libraries/*.rb'
1053
+ - '**/resources/*.rb'
1054
+
1055
+ ChefDeprecations/MacosUserdefaultsGlobalProperty:
1056
+ Description: The `global` property in the macos_userdefaults resource was deprecated in Chef Infra Client 16.3. Omitting the `domain` property will now set global defaults.
1057
+ StyleGuide: '#chefdeprecationsmacosuserdefaultsglobalproperty'
1058
+ Enabled: true
1059
+ VersionAdded: '6.14.0'
1060
+ Exclude:
1061
+ - '**/metadata.rb'
1062
+ - '**/Berksfile'
1063
+
1004
1064
  ###############################
1005
1065
  # ChefModernize: Cleaning up legacy code and using new built-in resources
1006
1066
  ###############################
@@ -1477,7 +1537,7 @@ ChefModernize/WindowsRegistryUAC:
1477
1537
  - '**/Berksfile'
1478
1538
 
1479
1539
  ChefModernize/UseMultipackageInstalls:
1480
- Description: Pass an array of packages to package resources instead of interating over an array of packages when using multi-package capable package subystem such as apt, yum, chocolatey, dnf, or zypper. Multipackage installs are faster and simplify logs.
1540
+ Description: Pass an array of packages to package resources instead of iterating over an array of packages when using multi-package capable package subsystem such as apt, yum, chocolatey, dnf, or zypper. Multi-package installs are faster and simplify logs.
1481
1541
  StyleGuide: '#chefmodernizeusemultipackageinstalls'
1482
1542
  Enabled: true
1483
1543
  VersionAdded: '6.0.0'
@@ -1533,6 +1593,36 @@ ChefModernize/ShellOutHelper:
1533
1593
  - '**/Berksfile'
1534
1594
  - '**/libraries/*.rb'
1535
1595
 
1596
+ ChefModernize/ConditionalUsingTest:
1597
+ Description: Use ::File.exist?('/foo/bar') instead of the slower 'test -f /foo/bar' which requires shelling out.
1598
+ StyleGuide: '#chefmodernizeconditionalusingtest'
1599
+ Enabled: true
1600
+ VersionAdded: '6.11.0'
1601
+ Exclude:
1602
+ - '**/metadata.rb'
1603
+ - '**/Berksfile'
1604
+ - '**/attributes/*.rb'
1605
+
1606
+ ChefModernize/CronDFileOrTemplate:
1607
+ Description: Use the cron_d resource that ships with Chef Infra Client 14.4+ instead of manually creating the file with template, file, or cookbook_file resources
1608
+ StyleGuide: '#chefmodernizecrondfileortemplate'
1609
+ Enabled: true
1610
+ VersionAdded: '6.13.0'
1611
+ Exclude:
1612
+ - '**/metadata.rb'
1613
+ - '**/Berksfile'
1614
+ - '**/attributes/*.rb'
1615
+
1616
+ ChefModernize/ActionMethodInResource:
1617
+ Description: Use the custom resource language's `action :my_action` blocks instead of creating actions with methods.
1618
+ StyleGuide: '#chefmodernizeactionmethodinresource'
1619
+ Enabled: true
1620
+ VersionAdded: '6.13.0'
1621
+ Include:
1622
+ - '**/resources/*.rb'
1623
+ - '**/providers/*.rb'
1624
+ - '**/libraries/*.rb'
1625
+
1536
1626
  ###############################
1537
1627
  # ChefRedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
1538
1628
  ###############################
@@ -1727,6 +1817,34 @@ ChefRedundantCode/UseCreateIfMissing:
1727
1817
  - '**/attributes/*.rb'
1728
1818
  - '**/Berksfile'
1729
1819
 
1820
+ ChefRedundantCode/OhaiAttributeToString:
1821
+ Description: Many Ohai node attributes are already strings and don't need to be cast to strings again
1822
+ StyleGuide: '#chefredundantcodeohaiattributetostring'
1823
+ Enabled: true
1824
+ VersionAdded: '6.10.0'
1825
+ Exclude:
1826
+ - '**/metadata.rb'
1827
+ - '**/Berksfile'
1828
+
1829
+ ChefRedundantCode/MultiplePlatformChecks:
1830
+ Description: You can pass multiple values to the platform? and platform_family? helpers instead of calling the helpers multiple times.
1831
+ StyleGuide: '#chefredundantcodemultipleplatformchecks'
1832
+ Enabled: true
1833
+ VersionAdded: '6.10.0'
1834
+ Exclude:
1835
+ - '**/metadata.rb'
1836
+ - '**/Berksfile'
1837
+
1838
+ ChefRedundantCode/DoubleCompileTime:
1839
+ Description: If a resource includes the `compile_time` property there's no need to also use `.run_action(:some_action)` on the resource block
1840
+ StyleGuide: '#chefredundantcodedoublecompiletime'
1841
+ Enabled: true
1842
+ VersionAdded: '6.13.0'
1843
+ Exclude:
1844
+ - '**/metadata.rb'
1845
+ - '**/attributes/*.rb'
1846
+ - '**/Berksfile'
1847
+
1730
1848
  ###############################
1731
1849
  # ChefEffortless: Migrating to new patterns
1732
1850
  ###############################
@@ -1752,7 +1870,7 @@ ChefEffortless/CookbookUsesDatabags:
1752
1870
  - '**/metadata.rb'
1753
1871
  - '**/Berksfile'
1754
1872
 
1755
- ChefEffortless/CookbookUsesEnvironmments:
1873
+ ChefEffortless/CookbookUsesEnvironments:
1756
1874
  Description: Cookbook uses environments, which cannot be used in the Effortless Infra pattern
1757
1875
  StyleGuide: '#chefeffortlesscookbookusesenvironments'
1758
1876
  Enabled: false
@@ -223,6 +223,8 @@ Lint/DisjunctiveAssignmentInConstructor:
223
223
  Enabled: false
224
224
  Lint/DuplicateCaseCondition:
225
225
  Enabled: false
226
+ Lint/DuplicateElsifCondition:
227
+ Enabled: false
226
228
  Lint/DuplicateHashKey:
227
229
  Enabled: false
228
230
  Lint/DuplicateMethods:
@@ -421,10 +423,14 @@ Naming/VariableNumber:
421
423
  Enabled: false
422
424
  Style/AccessModifierDeclarations:
423
425
  Enabled: false
426
+ Style/AccessorGrouping:
427
+ Enabled: false
424
428
  Style/Alias:
425
429
  Enabled: false
426
430
  Style/AndOr:
427
431
  Enabled: false
432
+ Style/ArrayCoercion:
433
+ Enabled: false
428
434
  Style/ArrayJoin:
429
435
  Enabled: false
430
436
  Style/AsciiComments:
@@ -437,12 +443,16 @@ Style/BarePercentLiterals:
437
443
  Enabled: false
438
444
  Style/BeginBlock:
439
445
  Enabled: false
446
+ Style/BisectedAttrAccessor:
447
+ Enabled: false
440
448
  Style/BlockComments:
441
449
  Enabled: false
442
450
  Style/BlockDelimiters:
443
451
  Enabled: false
444
452
  Style/CaseEquality:
445
453
  Enabled: false
454
+ Style/CaseLikeIf:
455
+ Enabled: false
446
456
  Style/CharacterLiteral:
447
457
  Enabled: false
448
458
  Style/ClassAndModuleChildren:
@@ -529,8 +539,12 @@ Style/GlobalVars:
529
539
  Enabled: false
530
540
  Style/GuardClause:
531
541
  Enabled: false
542
+ Style/HashAsLastArrayItem:
543
+ Enabled: false
532
544
  Style/HashEachMethods:
533
545
  Enabled: false
546
+ Style/HashLikeCase:
547
+ Enabled: false
534
548
  Style/HashSyntax:
535
549
  Enabled: false
536
550
  Style/HashTransformKeys:
@@ -567,8 +581,12 @@ Style/MethodCallWithoutArgsParentheses:
567
581
  Enabled: false
568
582
  Style/MethodCallWithArgsParentheses:
569
583
  Enabled: false
584
+ Style/RedundantAssignment:
585
+ Enabled: false
570
586
  Style/RedundantFetchBlock:
571
587
  Enabled: false
588
+ Style/RedundantFileExtensionInRequire:
589
+ Enabled: false
572
590
  Style/MethodCalledOnDoEndBlock:
573
591
  Enabled: false
574
592
  Style/MethodDefParentheses:
@@ -180,6 +180,9 @@ Bundler/OrderedGems:
180
180
  VersionAdded: '0.46'
181
181
  VersionChanged: '0.47'
182
182
  TreatCommentsAsGroupSeparators: true
183
+ # By default, "-" and "_" are ignored for order purposes.
184
+ # This can be overridden by setting this parameter to true.
185
+ ConsiderPunctuation: false
183
186
  Include:
184
187
  - '**/*.gemfile'
185
188
  - '**/Gemfile'
@@ -200,6 +203,9 @@ Gemspec/OrderedDependencies:
200
203
  Enabled: true
201
204
  VersionAdded: '0.51'
202
205
  TreatCommentsAsGroupSeparators: true
206
+ # By default, "-" and "_" are ignored for order purposes.
207
+ # This can be overridden by setting this parameter to true.
208
+ ConsiderPunctuation: false
203
209
  Include:
204
210
  - '**/*.gemspec'
205
211
 
@@ -1391,12 +1397,18 @@ Lint/DisjunctiveAssignmentInConstructor:
1391
1397
  Enabled: true
1392
1398
  Safe: false
1393
1399
  VersionAdded: '0.62'
1400
+ VersionChanged: '0.88'
1394
1401
 
1395
1402
  Lint/DuplicateCaseCondition:
1396
1403
  Description: 'Do not repeat values in case conditionals.'
1397
1404
  Enabled: true
1398
1405
  VersionAdded: '0.45'
1399
1406
 
1407
+ Lint/DuplicateElsifCondition:
1408
+ Description: 'Do not repeat conditions used in if `elsif`.'
1409
+ Enabled: 'pending'
1410
+ VersionAdded: '0.88'
1411
+
1400
1412
  Lint/DuplicateHashKey:
1401
1413
  Description: 'Check for duplicate keys in hash literals.'
1402
1414
  Enabled: true
@@ -1508,7 +1520,9 @@ Lint/InheritException:
1508
1520
  Lint/InterpolationCheck:
1509
1521
  Description: 'Raise warning for interpolation in single q strs.'
1510
1522
  Enabled: true
1523
+ SafeAutoCorrect: false
1511
1524
  VersionAdded: '0.50'
1525
+ VersionChanged: '0.87'
1512
1526
 
1513
1527
  Lint/LiteralAsCondition:
1514
1528
  Description: 'Checks of literals used in conditions.'
@@ -1736,6 +1750,7 @@ Lint/SafeNavigationWithEmpty:
1736
1750
  Description: 'Avoid `foo&.empty?` in conditionals.'
1737
1751
  Enabled: true
1738
1752
  VersionAdded: '0.62'
1753
+ VersionChanged: '0.87'
1739
1754
 
1740
1755
  Lint/ScriptPermission:
1741
1756
  Description: 'Grant script file execute permission.'
@@ -1902,9 +1917,10 @@ Metrics/BlockLength:
1902
1917
  Description: 'Avoid long blocks with many lines.'
1903
1918
  Enabled: true
1904
1919
  VersionAdded: '0.44'
1905
- VersionChanged: '0.66'
1920
+ VersionChanged: '0.87'
1906
1921
  CountComments: false # count full line comments?
1907
1922
  Max: 25
1923
+ CountAsOne: []
1908
1924
  ExcludedMethods:
1909
1925
  # By default, exclude the `#refine` method, as it tends to have larger
1910
1926
  # associated blocks.
@@ -1925,8 +1941,10 @@ Metrics/ClassLength:
1925
1941
  Description: 'Avoid classes longer than 100 lines of code.'
1926
1942
  Enabled: true
1927
1943
  VersionAdded: '0.25'
1944
+ VersionChanged: '0.87'
1928
1945
  CountComments: false # count full line comments?
1929
1946
  Max: 100
1947
+ CountAsOne: []
1930
1948
 
1931
1949
  # Avoid complex methods.
1932
1950
  Metrics/CyclomaticComplexity:
@@ -1944,17 +1962,20 @@ Metrics/MethodLength:
1944
1962
  StyleGuide: '#short-methods'
1945
1963
  Enabled: true
1946
1964
  VersionAdded: '0.25'
1947
- VersionChanged: '0.59.2'
1965
+ VersionChanged: '0.87'
1948
1966
  CountComments: false # count full line comments?
1949
1967
  Max: 10
1968
+ CountAsOne: []
1950
1969
  ExcludedMethods: []
1951
1970
 
1952
1971
  Metrics/ModuleLength:
1953
1972
  Description: 'Avoid modules longer than 100 lines of code.'
1954
1973
  Enabled: true
1955
1974
  VersionAdded: '0.31'
1975
+ VersionChanged: '0.87'
1956
1976
  CountComments: false # count full line comments?
1957
1977
  Max: 100
1978
+ CountAsOne: []
1958
1979
 
1959
1980
  Metrics/ParameterLists:
1960
1981
  Description: 'Avoid parameter lists longer than three or four parameters.'
@@ -1992,10 +2013,12 @@ Naming/AccessorMethodName:
1992
2013
  VersionAdded: '0.50'
1993
2014
 
1994
2015
  Naming/AsciiIdentifiers:
1995
- Description: 'Use only ascii symbols in identifiers.'
2016
+ Description: 'Use only ascii symbols in identifiers and constants.'
1996
2017
  StyleGuide: '#english-identifiers'
1997
2018
  Enabled: true
1998
2019
  VersionAdded: '0.50'
2020
+ VersionChanged: '0.87'
2021
+ AsciiConstants: true
1999
2022
 
2000
2023
  Naming/BinaryOperatorParameterName:
2001
2024
  Description: 'When defining binary operators, name the argument other.'
@@ -2162,17 +2185,18 @@ Naming/MethodParameterName:
2162
2185
  AllowNamesEndingInNumbers: true
2163
2186
  # Allowed names that will not register an offense
2164
2187
  AllowedNames:
2165
- - io
2166
- - id
2167
- - to
2188
+ - at
2168
2189
  - by
2169
- - 'on'
2190
+ - db
2191
+ - id
2170
2192
  - in
2171
- - at
2193
+ - io
2172
2194
  - ip
2173
- - db
2195
+ - of
2196
+ - 'on'
2174
2197
  - os
2175
2198
  - pp
2199
+ - to
2176
2200
  # Forbidden names that will register an offense
2177
2201
  ForbiddenNames: []
2178
2202
 
@@ -2288,6 +2312,17 @@ Style/AccessModifierDeclarations:
2288
2312
  - group
2289
2313
  AllowModifiersOnSymbols: true
2290
2314
 
2315
+ Style/AccessorGrouping:
2316
+ Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
2317
+ Enabled: 'pending'
2318
+ VersionAdded: '0.87'
2319
+ EnforcedStyle: grouped
2320
+ SupportedStyles:
2321
+ # separated: each accessor goes in a separate statement.
2322
+ # grouped: accessors are grouped into a single statement.
2323
+ - separated
2324
+ - grouped
2325
+
2291
2326
  Style/Alias:
2292
2327
  Description: 'Use alias instead of alias_method.'
2293
2328
  StyleGuide: '#alias-method-lexically'
@@ -2312,6 +2347,14 @@ Style/AndOr:
2312
2347
  - always
2313
2348
  - conditionals
2314
2349
 
2350
+ Style/ArrayCoercion:
2351
+ Description: >-
2352
+ Use Array() instead of explicit Array check or [*var], when dealing
2353
+ with a variable you want to treat as an Array, but you're not certain it's an array.
2354
+ StyleGuide: '#array-coercion'
2355
+ Enabled: 'pending'
2356
+ VersionAdded: '0.88'
2357
+
2315
2358
  Style/ArrayJoin:
2316
2359
  Description: 'Use Array#join instead of Array#*.'
2317
2360
  StyleGuide: '#array-join'
@@ -2355,6 +2398,13 @@ Style/BeginBlock:
2355
2398
  Enabled: true
2356
2399
  VersionAdded: '0.9'
2357
2400
 
2401
+ Style/BisectedAttrAccessor:
2402
+ Description: >-
2403
+ Checks for places where `attr_reader` and `attr_writer`
2404
+ for the same method can be combined into single `attr_accessor`.
2405
+ Enabled: 'pending'
2406
+ VersionAdded: '0.87'
2407
+
2358
2408
  Style/BlockComments:
2359
2409
  Description: 'Do not use block comments.'
2360
2410
  StyleGuide: '#no-block-comments'
@@ -2487,6 +2537,12 @@ Style/CaseEquality:
2487
2537
  # String === "string"
2488
2538
  AllowOnConstant: false
2489
2539
 
2540
+ Style/CaseLikeIf:
2541
+ Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2542
+ StyleGuide: '#case-vs-if-else'
2543
+ Enabled: 'pending'
2544
+ VersionAdded: '0.88'
2545
+
2490
2546
  Style/CharacterLiteral:
2491
2547
  Description: 'Checks for uses of character literals.'
2492
2548
  StyleGuide: '#no-character-literals'
@@ -2729,6 +2785,7 @@ Style/DoubleNegation:
2729
2785
  VersionAdded: '0.19'
2730
2786
  VersionChanged: '0.84'
2731
2787
  EnforcedStyle: allowed_in_returns
2788
+ SafeAutoCorrect: false
2732
2789
  SupportedStyles:
2733
2790
  - allowed_in_returns
2734
2791
  - forbidden
@@ -2925,6 +2982,18 @@ Style/GuardClause:
2925
2982
  # needs to have to trigger this cop
2926
2983
  MinBodyLength: 1
2927
2984
 
2985
+ Style/HashAsLastArrayItem:
2986
+ Description: >-
2987
+ Checks for presence or absence of braces around hash literal as a last
2988
+ array item depending on configuration.
2989
+ StyleGuide: '#hash-literal-as-last-array-item'
2990
+ Enabled: 'pending'
2991
+ VersionAdded: '0.88'
2992
+ EnforcedStyle: braces
2993
+ SupportedStyles:
2994
+ - braces
2995
+ - no_braces
2996
+
2928
2997
  Style/HashEachMethods:
2929
2998
  Description: 'Use Hash#each_key and Hash#each_value.'
2930
2999
  StyleGuide: '#hash-each'
@@ -2932,6 +3001,16 @@ Style/HashEachMethods:
2932
3001
  VersionAdded: '0.80'
2933
3002
  Safe: false
2934
3003
 
3004
+ Style/HashLikeCase:
3005
+ Description: >-
3006
+ Checks for places where `case-when` represents a simple 1:1
3007
+ mapping and can be replaced with a hash lookup.
3008
+ Enabled: 'pending'
3009
+ VersionAdded: '0.88'
3010
+ # `MinBranchesCount` defines the number of branches `case` needs to have
3011
+ # to trigger this cop
3012
+ MinBranchesCount: 3
3013
+
2935
3014
  Style/HashSyntax:
2936
3015
  Description: >-
2937
3016
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -2995,6 +3074,7 @@ Style/IfUnlessModifierOfIfUnless:
2995
3074
  Avoid modifier if/unless usage on conditionals.
2996
3075
  Enabled: true
2997
3076
  VersionAdded: '0.39'
3077
+ VersionChanged: '0.87'
2998
3078
 
2999
3079
  Style/IfWithSemicolon:
3000
3080
  Description: 'Do not use if x; .... Use the ternary operator instead.'
@@ -3581,6 +3661,11 @@ Style/RandomWithOffset:
3581
3661
  Enabled: true
3582
3662
  VersionAdded: '0.52'
3583
3663
 
3664
+ Style/RedundantAssignment:
3665
+ Description: 'Checks for redundant assignment before returning.'
3666
+ Enabled: 'pending'
3667
+ VersionAdded: '0.87'
3668
+
3584
3669
  Style/RedundantBegin:
3585
3670
  Description: "Don't use begin blocks when they are not needed."
3586
3671
  StyleGuide: '#begin-implicit'
@@ -3623,6 +3708,14 @@ Style/RedundantFetchBlock:
3623
3708
  SafeForConstants: false
3624
3709
  VersionAdded: '0.86'
3625
3710
 
3711
+ Style/RedundantFileExtensionInRequire:
3712
+ Description: >-
3713
+ Checks for the presence of superfluous `.rb` extension in
3714
+ the filename provided to `require` and `require_relative`.
3715
+ StyleGuide: '#no-explicit-rb-to-require'
3716
+ Enabled: 'pending'
3717
+ VersionAdded: '0.88'
3718
+
3626
3719
  Style/RedundantFreeze:
3627
3720
  Description: "Checks usages of Object#freeze on immutable objects."
3628
3721
  Enabled: true
@@ -3924,7 +4017,7 @@ Style/SymbolLiteral:
3924
4017
  Style/SymbolProc:
3925
4018
  Description: 'Use symbols as procs instead of blocks when possible.'
3926
4019
  Enabled: true
3927
- SafeAutoCorrect: false
4020
+ Safe: false
3928
4021
  VersionAdded: '0.26'
3929
4022
  VersionChanged: '0.64'
3930
4023
  # A list of method names to be ignored by the check.