cookstyle 6.10.2 → 6.15.3

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 +168 -39
  6. data/config/disable_all.yml +46 -4
  7. data/config/upstream.yml +198 -25
  8. data/cookstyle.gemspec +2 -0
  9. data/lib/cookstyle.rb +6 -5
  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 +6 -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 +5 -4
  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 +2 -1
  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 +5 -4
  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 +3 -2
  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 +1 -0
  227. metadata +19 -6
@@ -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,13 +203,17 @@ 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
 
206
212
  Gemspec/RequiredRubyVersion:
207
- Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
213
+ Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
208
214
  Enabled: true
209
215
  VersionAdded: '0.52'
216
+ VersionChanged: '0.89'
210
217
  Include:
211
218
  - '**/*.gemspec'
212
219
 
@@ -1228,7 +1235,7 @@ Layout/SpaceInsideBlockBraces:
1228
1235
 
1229
1236
  Layout/SpaceInsideHashLiteralBraces:
1230
1237
  Description: "Use spaces inside hash literal braces - or don't."
1231
- StyleGuide: '#spaces-operators'
1238
+ StyleGuide: '#spaces-braces'
1232
1239
  Enabled: true
1233
1240
  VersionAdded: '0.49'
1234
1241
  EnforcedStyle: space
@@ -1349,6 +1356,12 @@ Lint/BigDecimalNew:
1349
1356
  Enabled: true
1350
1357
  VersionAdded: '0.53'
1351
1358
 
1359
+ Lint/BinaryOperatorWithIdenticalOperands:
1360
+ Description: 'This cop checks for places where binary operator has identical operands.'
1361
+ Enabled: pending
1362
+ Safe: false
1363
+ VersionAdded: '0.89'
1364
+
1352
1365
  Lint/BooleanSymbol:
1353
1366
  Description: 'Check for `:true` and `:false` symbols.'
1354
1367
  Enabled: true
@@ -1391,12 +1404,18 @@ Lint/DisjunctiveAssignmentInConstructor:
1391
1404
  Enabled: true
1392
1405
  Safe: false
1393
1406
  VersionAdded: '0.62'
1407
+ VersionChanged: '0.88'
1394
1408
 
1395
1409
  Lint/DuplicateCaseCondition:
1396
1410
  Description: 'Do not repeat values in case conditionals.'
1397
1411
  Enabled: true
1398
1412
  VersionAdded: '0.45'
1399
1413
 
1414
+ Lint/DuplicateElsifCondition:
1415
+ Description: 'Do not repeat conditions used in if `elsif`.'
1416
+ Enabled: 'pending'
1417
+ VersionAdded: '0.88'
1418
+
1400
1419
  Lint/DuplicateHashKey:
1401
1420
  Description: 'Check for duplicate keys in hash literals.'
1402
1421
  Enabled: true
@@ -1408,6 +1427,11 @@ Lint/DuplicateMethods:
1408
1427
  Enabled: true
1409
1428
  VersionAdded: '0.29'
1410
1429
 
1430
+ Lint/DuplicateRescueException:
1431
+ Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
1432
+ Enabled: pending
1433
+ VersionAdded: '0.89'
1434
+
1411
1435
  Lint/EachWithObjectArgument:
1412
1436
  Description: 'Check for immutable argument given to each_with_object.'
1413
1437
  Enabled: true
@@ -1418,6 +1442,12 @@ Lint/ElseLayout:
1418
1442
  Enabled: true
1419
1443
  VersionAdded: '0.17'
1420
1444
 
1445
+ Lint/EmptyConditionalBody:
1446
+ Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1447
+ Enabled: 'pending'
1448
+ AllowComments: true
1449
+ VersionAdded: '0.89'
1450
+
1421
1451
  Lint/EmptyEnsure:
1422
1452
  Description: 'Checks for empty ensure block.'
1423
1453
  Enabled: true
@@ -1461,6 +1491,12 @@ Lint/FlipFlop:
1461
1491
  Enabled: true
1462
1492
  VersionAdded: '0.16'
1463
1493
 
1494
+ Lint/FloatComparison:
1495
+ Description: 'Checks for the presence of precise comparison of floating point numbers.'
1496
+ StyleGuide: '#float-comparison'
1497
+ Enabled: pending
1498
+ VersionAdded: '0.89'
1499
+
1464
1500
  Lint/FloatOutOfRange:
1465
1501
  Description: >-
1466
1502
  Catches floating-point literals too large or small for Ruby to
@@ -1508,7 +1544,9 @@ Lint/InheritException:
1508
1544
  Lint/InterpolationCheck:
1509
1545
  Description: 'Raise warning for interpolation in single q strs.'
1510
1546
  Enabled: true
1547
+ Safe: false
1511
1548
  VersionAdded: '0.50'
1549
+ VersionChanged: '0.87'
1512
1550
 
1513
1551
  Lint/LiteralAsCondition:
1514
1552
  Description: 'Checks of literals used in conditions.'
@@ -1528,6 +1566,7 @@ Lint/Loop:
1528
1566
  StyleGuide: '#loop-with-break'
1529
1567
  Enabled: true
1530
1568
  VersionAdded: '0.9'
1569
+ VersionChanged: '0.89'
1531
1570
 
1532
1571
  Lint/MissingCopEnableDirective:
1533
1572
  Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
@@ -1542,6 +1581,13 @@ Lint/MissingCopEnableDirective:
1542
1581
  # .inf for any size
1543
1582
  MaximumRangeSize: .inf
1544
1583
 
1584
+ Lint/MissingSuper:
1585
+ Description: >-
1586
+ This cop checks for the presence of constructors and lifecycle callbacks
1587
+ without calls to `super`'.
1588
+ Enabled: pending
1589
+ VersionAdded: '0.89'
1590
+
1545
1591
  Lint/MixedRegexpCaptureTypes:
1546
1592
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1547
1593
  Enabled: pending
@@ -1594,6 +1640,12 @@ Lint/OrderedMagicComments:
1594
1640
  Enabled: true
1595
1641
  VersionAdded: '0.53'
1596
1642
 
1643
+ Lint/OutOfRangeRegexpRef:
1644
+ Description: 'Checks for out of range reference for Regexp because it always returns nil.'
1645
+ Enabled: pending
1646
+ Safe: false
1647
+ VersionAdded: '0.89'
1648
+
1597
1649
  Lint/ParenthesesAsGroupedExpression:
1598
1650
  Description: >-
1599
1651
  Checks for method calls with a space before the opening
@@ -1736,6 +1788,7 @@ Lint/SafeNavigationWithEmpty:
1736
1788
  Description: 'Avoid `foo&.empty?` in conditionals.'
1737
1789
  Enabled: true
1738
1790
  VersionAdded: '0.62'
1791
+ VersionChanged: '0.87'
1739
1792
 
1740
1793
  Lint/ScriptPermission:
1741
1794
  Description: 'Grant script file execute permission.'
@@ -1743,6 +1796,11 @@ Lint/ScriptPermission:
1743
1796
  VersionAdded: '0.49'
1744
1797
  VersionChanged: '0.50'
1745
1798
 
1799
+ Lint/SelfAssignment:
1800
+ Description: 'Checks for self-assignments.'
1801
+ Enabled: pending
1802
+ VersionAdded: '0.89'
1803
+
1746
1804
  Lint/SendWithMixinArgument:
1747
1805
  Description: 'Checks for `send` method when using mixin.'
1748
1806
  Enabled: true
@@ -1793,6 +1851,11 @@ Lint/ToJSON:
1793
1851
  Enabled: true
1794
1852
  VersionAdded: '0.66'
1795
1853
 
1854
+ Lint/TopLevelReturnWithArgument:
1855
+ Description: 'This cop detects top level return statements with argument.'
1856
+ Enabled: 'pending'
1857
+ VersionAdded: '0.89'
1858
+
1796
1859
  Lint/UnderscorePrefixedVariableName:
1797
1860
  Description: 'Do not use prefix `_` for a variable that is used.'
1798
1861
  Enabled: true
@@ -1809,6 +1872,11 @@ Lint/UnreachableCode:
1809
1872
  Enabled: true
1810
1873
  VersionAdded: '0.9'
1811
1874
 
1875
+ Lint/UnreachableLoop:
1876
+ Description: 'This cop checks for loops that will have at most one iteration.'
1877
+ Enabled: pending
1878
+ VersionAdded: '0.89'
1879
+
1812
1880
  Lint/UnusedBlockArgument:
1813
1881
  Description: 'Checks for unused block arguments.'
1814
1882
  StyleGuide: '#underscore-unused-vars'
@@ -1858,11 +1926,6 @@ Lint/UselessAssignment:
1858
1926
  Enabled: true
1859
1927
  VersionAdded: '0.11'
1860
1928
 
1861
- Lint/UselessComparison:
1862
- Description: 'Checks for comparison of something with itself.'
1863
- Enabled: true
1864
- VersionAdded: '0.11'
1865
-
1866
1929
  Lint/UselessElseWithoutRescue:
1867
1930
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
1868
1931
  Enabled: true
@@ -1896,15 +1959,16 @@ Metrics/AbcSize:
1896
1959
  # The ABC size is a calculated magnitude, so this number can be an Integer or
1897
1960
  # a Float.
1898
1961
  IgnoredMethods: []
1899
- Max: 15
1962
+ Max: 17
1900
1963
 
1901
1964
  Metrics/BlockLength:
1902
1965
  Description: 'Avoid long blocks with many lines.'
1903
1966
  Enabled: true
1904
1967
  VersionAdded: '0.44'
1905
- VersionChanged: '0.66'
1968
+ VersionChanged: '0.87'
1906
1969
  CountComments: false # count full line comments?
1907
1970
  Max: 25
1971
+ CountAsOne: []
1908
1972
  ExcludedMethods:
1909
1973
  # By default, exclude the `#refine` method, as it tends to have larger
1910
1974
  # associated blocks.
@@ -1925,8 +1989,10 @@ Metrics/ClassLength:
1925
1989
  Description: 'Avoid classes longer than 100 lines of code.'
1926
1990
  Enabled: true
1927
1991
  VersionAdded: '0.25'
1992
+ VersionChanged: '0.87'
1928
1993
  CountComments: false # count full line comments?
1929
1994
  Max: 100
1995
+ CountAsOne: []
1930
1996
 
1931
1997
  # Avoid complex methods.
1932
1998
  Metrics/CyclomaticComplexity:
@@ -1944,17 +2010,20 @@ Metrics/MethodLength:
1944
2010
  StyleGuide: '#short-methods'
1945
2011
  Enabled: true
1946
2012
  VersionAdded: '0.25'
1947
- VersionChanged: '0.59.2'
2013
+ VersionChanged: '0.87'
1948
2014
  CountComments: false # count full line comments?
1949
2015
  Max: 10
2016
+ CountAsOne: []
1950
2017
  ExcludedMethods: []
1951
2018
 
1952
2019
  Metrics/ModuleLength:
1953
2020
  Description: 'Avoid modules longer than 100 lines of code.'
1954
2021
  Enabled: true
1955
2022
  VersionAdded: '0.31'
2023
+ VersionChanged: '0.87'
1956
2024
  CountComments: false # count full line comments?
1957
2025
  Max: 100
2026
+ CountAsOne: []
1958
2027
 
1959
2028
  Metrics/ParameterLists:
1960
2029
  Description: 'Avoid parameter lists longer than three or four parameters.'
@@ -1972,7 +2041,7 @@ Metrics/PerceivedComplexity:
1972
2041
  VersionAdded: '0.25'
1973
2042
  VersionChanged: '0.81'
1974
2043
  IgnoredMethods: []
1975
- Max: 7
2044
+ Max: 8
1976
2045
 
1977
2046
  ################## Migration #############################
1978
2047
 
@@ -1992,10 +2061,12 @@ Naming/AccessorMethodName:
1992
2061
  VersionAdded: '0.50'
1993
2062
 
1994
2063
  Naming/AsciiIdentifiers:
1995
- Description: 'Use only ascii symbols in identifiers.'
2064
+ Description: 'Use only ascii symbols in identifiers and constants.'
1996
2065
  StyleGuide: '#english-identifiers'
1997
2066
  Enabled: true
1998
2067
  VersionAdded: '0.50'
2068
+ VersionChanged: '0.87'
2069
+ AsciiConstants: true
1999
2070
 
2000
2071
  Naming/BinaryOperatorParameterName:
2001
2072
  Description: 'When defining binary operators, name the argument other.'
@@ -2162,17 +2233,18 @@ Naming/MethodParameterName:
2162
2233
  AllowNamesEndingInNumbers: true
2163
2234
  # Allowed names that will not register an offense
2164
2235
  AllowedNames:
2165
- - io
2166
- - id
2167
- - to
2236
+ - at
2168
2237
  - by
2169
- - 'on'
2238
+ - db
2239
+ - id
2170
2240
  - in
2171
- - at
2241
+ - io
2172
2242
  - ip
2173
- - db
2243
+ - of
2244
+ - 'on'
2174
2245
  - os
2175
2246
  - pp
2247
+ - to
2176
2248
  # Forbidden names that will register an offense
2177
2249
  ForbiddenNames: []
2178
2250
 
@@ -2288,6 +2360,17 @@ Style/AccessModifierDeclarations:
2288
2360
  - group
2289
2361
  AllowModifiersOnSymbols: true
2290
2362
 
2363
+ Style/AccessorGrouping:
2364
+ Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
2365
+ Enabled: 'pending'
2366
+ VersionAdded: '0.87'
2367
+ EnforcedStyle: grouped
2368
+ SupportedStyles:
2369
+ # separated: each accessor goes in a separate statement.
2370
+ # grouped: accessors are grouped into a single statement.
2371
+ - separated
2372
+ - grouped
2373
+
2291
2374
  Style/Alias:
2292
2375
  Description: 'Use alias instead of alias_method.'
2293
2376
  StyleGuide: '#alias-method-lexically'
@@ -2312,6 +2395,15 @@ Style/AndOr:
2312
2395
  - always
2313
2396
  - conditionals
2314
2397
 
2398
+ Style/ArrayCoercion:
2399
+ Description: >-
2400
+ Use Array() instead of explicit Array check or [*var], when dealing
2401
+ with a variable you want to treat as an Array, but you're not certain it's an array.
2402
+ StyleGuide: '#array-coercion'
2403
+ Safe: false
2404
+ Enabled: 'pending'
2405
+ VersionAdded: '0.88'
2406
+
2315
2407
  Style/ArrayJoin:
2316
2408
  Description: 'Use Array#join instead of Array#*.'
2317
2409
  StyleGuide: '#array-join'
@@ -2355,6 +2447,13 @@ Style/BeginBlock:
2355
2447
  Enabled: true
2356
2448
  VersionAdded: '0.9'
2357
2449
 
2450
+ Style/BisectedAttrAccessor:
2451
+ Description: >-
2452
+ Checks for places where `attr_reader` and `attr_writer`
2453
+ for the same method can be combined into single `attr_accessor`.
2454
+ Enabled: 'pending'
2455
+ VersionAdded: '0.87'
2456
+
2358
2457
  Style/BlockComments:
2359
2458
  Description: 'Do not use block comments.'
2360
2459
  StyleGuide: '#no-block-comments'
@@ -2477,6 +2576,7 @@ Style/CaseEquality:
2477
2576
  StyleGuide: '#no-case-equality'
2478
2577
  Enabled: true
2479
2578
  VersionAdded: '0.9'
2579
+ VersionChanged: '0.89'
2480
2580
  # If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
2481
2581
  # the case equality operator is a constant.
2482
2582
  #
@@ -2487,6 +2587,12 @@ Style/CaseEquality:
2487
2587
  # String === "string"
2488
2588
  AllowOnConstant: false
2489
2589
 
2590
+ Style/CaseLikeIf:
2591
+ Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2592
+ StyleGuide: '#case-vs-if-else'
2593
+ Enabled: 'pending'
2594
+ VersionAdded: '0.88'
2595
+
2490
2596
  Style/CharacterLiteral:
2491
2597
  Description: 'Checks for uses of character literals.'
2492
2598
  StyleGuide: '#no-character-literals'
@@ -2729,6 +2835,7 @@ Style/DoubleNegation:
2729
2835
  VersionAdded: '0.19'
2730
2836
  VersionChanged: '0.84'
2731
2837
  EnforcedStyle: allowed_in_returns
2838
+ SafeAutoCorrect: false
2732
2839
  SupportedStyles:
2733
2840
  - allowed_in_returns
2734
2841
  - forbidden
@@ -2823,6 +2930,16 @@ Style/ExpandPathArguments:
2823
2930
  Enabled: true
2824
2931
  VersionAdded: '0.53'
2825
2932
 
2933
+ Style/ExplicitBlockArgument:
2934
+ Description: >-
2935
+ Consider using explicit block argument to avoid writing block literal
2936
+ that just passes its arguments to another block.
2937
+ StyleGuide: '#block-argument'
2938
+ Enabled: pending
2939
+ # May change the yielding arity.
2940
+ Safe: false
2941
+ VersionAdded: '0.89'
2942
+
2826
2943
  Style/ExponentialNotation:
2827
2944
  Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
2828
2945
  StyleGuide: '#exponential-notation'
@@ -2906,6 +3023,12 @@ Style/FrozenStringLiteralComment:
2906
3023
  - never
2907
3024
  Safe: false
2908
3025
 
3026
+ Style/GlobalStdStream:
3027
+ Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
3028
+ StyleGuide: '#global-stdout'
3029
+ Enabled: pending
3030
+ VersionAdded: '0.89'
3031
+
2909
3032
  Style/GlobalVars:
2910
3033
  Description: 'Do not introduce global variables.'
2911
3034
  StyleGuide: '#instance-vars'
@@ -2925,6 +3048,18 @@ Style/GuardClause:
2925
3048
  # needs to have to trigger this cop
2926
3049
  MinBodyLength: 1
2927
3050
 
3051
+ Style/HashAsLastArrayItem:
3052
+ Description: >-
3053
+ Checks for presence or absence of braces around hash literal as a last
3054
+ array item depending on configuration.
3055
+ StyleGuide: '#hash-literal-as-last-array-item'
3056
+ Enabled: 'pending'
3057
+ VersionAdded: '0.88'
3058
+ EnforcedStyle: braces
3059
+ SupportedStyles:
3060
+ - braces
3061
+ - no_braces
3062
+
2928
3063
  Style/HashEachMethods:
2929
3064
  Description: 'Use Hash#each_key and Hash#each_value.'
2930
3065
  StyleGuide: '#hash-each'
@@ -2932,6 +3067,16 @@ Style/HashEachMethods:
2932
3067
  VersionAdded: '0.80'
2933
3068
  Safe: false
2934
3069
 
3070
+ Style/HashLikeCase:
3071
+ Description: >-
3072
+ Checks for places where `case-when` represents a simple 1:1
3073
+ mapping and can be replaced with a hash lookup.
3074
+ Enabled: 'pending'
3075
+ VersionAdded: '0.88'
3076
+ # `MinBranchesCount` defines the number of branches `case` needs to have
3077
+ # to trigger this cop
3078
+ MinBranchesCount: 3
3079
+
2935
3080
  Style/HashSyntax:
2936
3081
  Description: >-
2937
3082
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -2995,6 +3140,7 @@ Style/IfUnlessModifierOfIfUnless:
2995
3140
  Avoid modifier if/unless usage on conditionals.
2996
3141
  Enabled: true
2997
3142
  VersionAdded: '0.39'
3143
+ VersionChanged: '0.87'
2998
3144
 
2999
3145
  Style/IfWithSemicolon:
3000
3146
  Description: 'Do not use if x; .... Use the ternary operator instead.'
@@ -3138,12 +3284,6 @@ Style/MethodDefParentheses:
3138
3284
  - require_no_parentheses
3139
3285
  - require_no_parentheses_except_multiline
3140
3286
 
3141
- Style/MethodMissingSuper:
3142
- Description: Checks for `method_missing` to call `super`.
3143
- StyleGuide: '#no-method-missing'
3144
- Enabled: true
3145
- VersionAdded: '0.56'
3146
-
3147
3287
  Style/MinMax:
3148
3288
  Description: >-
3149
3289
  Use `Enumerable#minmax` instead of `Enumerable#min`
@@ -3485,6 +3625,13 @@ Style/OptionalArguments:
3485
3625
  VersionAdded: '0.33'
3486
3626
  VersionChanged: '0.83'
3487
3627
 
3628
+ Style/OptionalBooleanParameter:
3629
+ Description: 'Use keyword arguments when defining method with boolean argument.'
3630
+ StyleGuide: '#boolean-keyword-arguments'
3631
+ Enabled: pending
3632
+ Safe: false
3633
+ VersionAdded: '0.89'
3634
+
3488
3635
  Style/OrAssignment:
3489
3636
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
3490
3637
  StyleGuide: '#double-pipe-for-uninit'
@@ -3581,6 +3728,11 @@ Style/RandomWithOffset:
3581
3728
  Enabled: true
3582
3729
  VersionAdded: '0.52'
3583
3730
 
3731
+ Style/RedundantAssignment:
3732
+ Description: 'Checks for redundant assignment before returning.'
3733
+ Enabled: 'pending'
3734
+ VersionAdded: '0.87'
3735
+
3584
3736
  Style/RedundantBegin:
3585
3737
  Description: "Don't use begin blocks when they are not needed."
3586
3738
  StyleGuide: '#begin-implicit'
@@ -3623,6 +3775,14 @@ Style/RedundantFetchBlock:
3623
3775
  SafeForConstants: false
3624
3776
  VersionAdded: '0.86'
3625
3777
 
3778
+ Style/RedundantFileExtensionInRequire:
3779
+ Description: >-
3780
+ Checks for the presence of superfluous `.rb` extension in
3781
+ the filename provided to `require` and `require_relative`.
3782
+ StyleGuide: '#no-explicit-rb-to-require'
3783
+ Enabled: 'pending'
3784
+ VersionAdded: '0.88'
3785
+
3626
3786
  Style/RedundantFreeze:
3627
3787
  Description: "Checks usages of Object#freeze on immutable objects."
3628
3788
  Enabled: true
@@ -3790,6 +3950,12 @@ Style/SignalException:
3790
3950
  - only_fail
3791
3951
  - semantic
3792
3952
 
3953
+ Style/SingleArgumentDig:
3954
+ Description: 'Avoid using single argument dig method.'
3955
+ Enabled: pending
3956
+ VersionAdded: '0.89'
3957
+ Safe: false
3958
+
3793
3959
  Style/SingleLineBlockParams:
3794
3960
  Description: 'Enforces the names of some block params.'
3795
3961
  Enabled: false
@@ -3845,6 +4011,13 @@ Style/StderrPuts:
3845
4011
  Enabled: true
3846
4012
  VersionAdded: '0.51'
3847
4013
 
4014
+ Style/StringConcatenation:
4015
+ Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
4016
+ StyleGuide: '#string-interpolation'
4017
+ Enabled: pending
4018
+ Safe: false
4019
+ VersionAdded: '0.89'
4020
+
3848
4021
  Style/StringHashKeys:
3849
4022
  Description: 'Prefer symbols instead of strings as hash keys.'
3850
4023
  StyleGuide: '#symbols-as-keys'
@@ -3924,7 +4097,7 @@ Style/SymbolLiteral:
3924
4097
  Style/SymbolProc:
3925
4098
  Description: 'Use symbols as procs instead of blocks when possible.'
3926
4099
  Enabled: true
3927
- SafeAutoCorrect: false
4100
+ Safe: false
3928
4101
  VersionAdded: '0.26'
3929
4102
  VersionChanged: '0.64'
3930
4103
  # A list of method names to be ignored by the check.