cookstyle 6.11.4 → 6.15.5

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 -38
  6. data/config/disable_all.yml +40 -4
  7. data/config/upstream.yml +153 -22
  8. data/cookstyle.gemspec +2 -0
  9. data/lib/cookstyle.rb +8 -7
  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 +2 -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 +2 -1
  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 +2 -1
  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 +2 -1
  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 +17 -6
@@ -210,9 +210,10 @@ Gemspec/OrderedDependencies:
210
210
  - '**/*.gemspec'
211
211
 
212
212
  Gemspec/RequiredRubyVersion:
213
- 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.'
214
214
  Enabled: true
215
215
  VersionAdded: '0.52'
216
+ VersionChanged: '0.89'
216
217
  Include:
217
218
  - '**/*.gemspec'
218
219
 
@@ -1234,7 +1235,7 @@ Layout/SpaceInsideBlockBraces:
1234
1235
 
1235
1236
  Layout/SpaceInsideHashLiteralBraces:
1236
1237
  Description: "Use spaces inside hash literal braces - or don't."
1237
- StyleGuide: '#spaces-operators'
1238
+ StyleGuide: '#spaces-braces'
1238
1239
  Enabled: true
1239
1240
  VersionAdded: '0.49'
1240
1241
  EnforcedStyle: space
@@ -1355,6 +1356,12 @@ Lint/BigDecimalNew:
1355
1356
  Enabled: true
1356
1357
  VersionAdded: '0.53'
1357
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
+
1358
1365
  Lint/BooleanSymbol:
1359
1366
  Description: 'Check for `:true` and `:false` symbols.'
1360
1367
  Enabled: true
@@ -1397,12 +1404,18 @@ Lint/DisjunctiveAssignmentInConstructor:
1397
1404
  Enabled: true
1398
1405
  Safe: false
1399
1406
  VersionAdded: '0.62'
1407
+ VersionChanged: '0.88'
1400
1408
 
1401
1409
  Lint/DuplicateCaseCondition:
1402
1410
  Description: 'Do not repeat values in case conditionals.'
1403
1411
  Enabled: true
1404
1412
  VersionAdded: '0.45'
1405
1413
 
1414
+ Lint/DuplicateElsifCondition:
1415
+ Description: 'Do not repeat conditions used in if `elsif`.'
1416
+ Enabled: 'pending'
1417
+ VersionAdded: '0.88'
1418
+
1406
1419
  Lint/DuplicateHashKey:
1407
1420
  Description: 'Check for duplicate keys in hash literals.'
1408
1421
  Enabled: true
@@ -1414,6 +1427,11 @@ Lint/DuplicateMethods:
1414
1427
  Enabled: true
1415
1428
  VersionAdded: '0.29'
1416
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
+
1417
1435
  Lint/EachWithObjectArgument:
1418
1436
  Description: 'Check for immutable argument given to each_with_object.'
1419
1437
  Enabled: true
@@ -1424,6 +1442,12 @@ Lint/ElseLayout:
1424
1442
  Enabled: true
1425
1443
  VersionAdded: '0.17'
1426
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
+
1427
1451
  Lint/EmptyEnsure:
1428
1452
  Description: 'Checks for empty ensure block.'
1429
1453
  Enabled: true
@@ -1467,6 +1491,12 @@ Lint/FlipFlop:
1467
1491
  Enabled: true
1468
1492
  VersionAdded: '0.16'
1469
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
+
1470
1500
  Lint/FloatOutOfRange:
1471
1501
  Description: >-
1472
1502
  Catches floating-point literals too large or small for Ruby to
@@ -1514,7 +1544,7 @@ Lint/InheritException:
1514
1544
  Lint/InterpolationCheck:
1515
1545
  Description: 'Raise warning for interpolation in single q strs.'
1516
1546
  Enabled: true
1517
- SafeAutoCorrect: false
1547
+ Safe: false
1518
1548
  VersionAdded: '0.50'
1519
1549
  VersionChanged: '0.87'
1520
1550
 
@@ -1536,6 +1566,7 @@ Lint/Loop:
1536
1566
  StyleGuide: '#loop-with-break'
1537
1567
  Enabled: true
1538
1568
  VersionAdded: '0.9'
1569
+ VersionChanged: '0.89'
1539
1570
 
1540
1571
  Lint/MissingCopEnableDirective:
1541
1572
  Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
@@ -1550,6 +1581,13 @@ Lint/MissingCopEnableDirective:
1550
1581
  # .inf for any size
1551
1582
  MaximumRangeSize: .inf
1552
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
+
1553
1591
  Lint/MixedRegexpCaptureTypes:
1554
1592
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1555
1593
  Enabled: pending
@@ -1602,6 +1640,12 @@ Lint/OrderedMagicComments:
1602
1640
  Enabled: true
1603
1641
  VersionAdded: '0.53'
1604
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
+
1605
1649
  Lint/ParenthesesAsGroupedExpression:
1606
1650
  Description: >-
1607
1651
  Checks for method calls with a space before the opening
@@ -1752,6 +1796,11 @@ Lint/ScriptPermission:
1752
1796
  VersionAdded: '0.49'
1753
1797
  VersionChanged: '0.50'
1754
1798
 
1799
+ Lint/SelfAssignment:
1800
+ Description: 'Checks for self-assignments.'
1801
+ Enabled: pending
1802
+ VersionAdded: '0.89'
1803
+
1755
1804
  Lint/SendWithMixinArgument:
1756
1805
  Description: 'Checks for `send` method when using mixin.'
1757
1806
  Enabled: true
@@ -1802,6 +1851,11 @@ Lint/ToJSON:
1802
1851
  Enabled: true
1803
1852
  VersionAdded: '0.66'
1804
1853
 
1854
+ Lint/TopLevelReturnWithArgument:
1855
+ Description: 'This cop detects top level return statements with argument.'
1856
+ Enabled: 'pending'
1857
+ VersionAdded: '0.89'
1858
+
1805
1859
  Lint/UnderscorePrefixedVariableName:
1806
1860
  Description: 'Do not use prefix `_` for a variable that is used.'
1807
1861
  Enabled: true
@@ -1818,6 +1872,11 @@ Lint/UnreachableCode:
1818
1872
  Enabled: true
1819
1873
  VersionAdded: '0.9'
1820
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
+
1821
1880
  Lint/UnusedBlockArgument:
1822
1881
  Description: 'Checks for unused block arguments.'
1823
1882
  StyleGuide: '#underscore-unused-vars'
@@ -1867,11 +1926,6 @@ Lint/UselessAssignment:
1867
1926
  Enabled: true
1868
1927
  VersionAdded: '0.11'
1869
1928
 
1870
- Lint/UselessComparison:
1871
- Description: 'Checks for comparison of something with itself.'
1872
- Enabled: true
1873
- VersionAdded: '0.11'
1874
-
1875
1929
  Lint/UselessElseWithoutRescue:
1876
1930
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
1877
1931
  Enabled: true
@@ -1905,7 +1959,7 @@ Metrics/AbcSize:
1905
1959
  # The ABC size is a calculated magnitude, so this number can be an Integer or
1906
1960
  # a Float.
1907
1961
  IgnoredMethods: []
1908
- Max: 15
1962
+ Max: 17
1909
1963
 
1910
1964
  Metrics/BlockLength:
1911
1965
  Description: 'Avoid long blocks with many lines.'
@@ -1987,7 +2041,7 @@ Metrics/PerceivedComplexity:
1987
2041
  VersionAdded: '0.25'
1988
2042
  VersionChanged: '0.81'
1989
2043
  IgnoredMethods: []
1990
- Max: 7
2044
+ Max: 8
1991
2045
 
1992
2046
  ################## Migration #############################
1993
2047
 
@@ -2179,17 +2233,18 @@ Naming/MethodParameterName:
2179
2233
  AllowNamesEndingInNumbers: true
2180
2234
  # Allowed names that will not register an offense
2181
2235
  AllowedNames:
2182
- - io
2183
- - id
2184
- - to
2236
+ - at
2185
2237
  - by
2186
- - 'on'
2238
+ - db
2239
+ - id
2187
2240
  - in
2188
- - at
2241
+ - io
2189
2242
  - ip
2190
- - db
2243
+ - of
2244
+ - 'on'
2191
2245
  - os
2192
2246
  - pp
2247
+ - to
2193
2248
  # Forbidden names that will register an offense
2194
2249
  ForbiddenNames: []
2195
2250
 
@@ -2340,6 +2395,15 @@ Style/AndOr:
2340
2395
  - always
2341
2396
  - conditionals
2342
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
+
2343
2407
  Style/ArrayJoin:
2344
2408
  Description: 'Use Array#join instead of Array#*.'
2345
2409
  StyleGuide: '#array-join'
@@ -2512,6 +2576,7 @@ Style/CaseEquality:
2512
2576
  StyleGuide: '#no-case-equality'
2513
2577
  Enabled: true
2514
2578
  VersionAdded: '0.9'
2579
+ VersionChanged: '0.89'
2515
2580
  # If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
2516
2581
  # the case equality operator is a constant.
2517
2582
  #
@@ -2522,6 +2587,12 @@ Style/CaseEquality:
2522
2587
  # String === "string"
2523
2588
  AllowOnConstant: false
2524
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
+
2525
2596
  Style/CharacterLiteral:
2526
2597
  Description: 'Checks for uses of character literals.'
2527
2598
  StyleGuide: '#no-character-literals'
@@ -2859,6 +2930,16 @@ Style/ExpandPathArguments:
2859
2930
  Enabled: true
2860
2931
  VersionAdded: '0.53'
2861
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
+
2862
2943
  Style/ExponentialNotation:
2863
2944
  Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
2864
2945
  StyleGuide: '#exponential-notation'
@@ -2942,6 +3023,12 @@ Style/FrozenStringLiteralComment:
2942
3023
  - never
2943
3024
  Safe: false
2944
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
+
2945
3032
  Style/GlobalVars:
2946
3033
  Description: 'Do not introduce global variables.'
2947
3034
  StyleGuide: '#instance-vars'
@@ -2961,6 +3048,18 @@ Style/GuardClause:
2961
3048
  # needs to have to trigger this cop
2962
3049
  MinBodyLength: 1
2963
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
+
2964
3063
  Style/HashEachMethods:
2965
3064
  Description: 'Use Hash#each_key and Hash#each_value.'
2966
3065
  StyleGuide: '#hash-each'
@@ -2968,6 +3067,16 @@ Style/HashEachMethods:
2968
3067
  VersionAdded: '0.80'
2969
3068
  Safe: false
2970
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
+
2971
3080
  Style/HashSyntax:
2972
3081
  Description: >-
2973
3082
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -3175,12 +3284,6 @@ Style/MethodDefParentheses:
3175
3284
  - require_no_parentheses
3176
3285
  - require_no_parentheses_except_multiline
3177
3286
 
3178
- Style/MethodMissingSuper:
3179
- Description: Checks for `method_missing` to call `super`.
3180
- StyleGuide: '#no-method-missing'
3181
- Enabled: true
3182
- VersionAdded: '0.56'
3183
-
3184
3287
  Style/MinMax:
3185
3288
  Description: >-
3186
3289
  Use `Enumerable#minmax` instead of `Enumerable#min`
@@ -3522,6 +3625,13 @@ Style/OptionalArguments:
3522
3625
  VersionAdded: '0.33'
3523
3626
  VersionChanged: '0.83'
3524
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
+
3525
3635
  Style/OrAssignment:
3526
3636
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
3527
3637
  StyleGuide: '#double-pipe-for-uninit'
@@ -3665,6 +3775,14 @@ Style/RedundantFetchBlock:
3665
3775
  SafeForConstants: false
3666
3776
  VersionAdded: '0.86'
3667
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
+
3668
3786
  Style/RedundantFreeze:
3669
3787
  Description: "Checks usages of Object#freeze on immutable objects."
3670
3788
  Enabled: true
@@ -3832,6 +3950,12 @@ Style/SignalException:
3832
3950
  - only_fail
3833
3951
  - semantic
3834
3952
 
3953
+ Style/SingleArgumentDig:
3954
+ Description: 'Avoid using single argument dig method.'
3955
+ Enabled: pending
3956
+ VersionAdded: '0.89'
3957
+ Safe: false
3958
+
3835
3959
  Style/SingleLineBlockParams:
3836
3960
  Description: 'Enforces the names of some block params.'
3837
3961
  Enabled: false
@@ -3887,6 +4011,13 @@ Style/StderrPuts:
3887
4011
  Enabled: true
3888
4012
  VersionAdded: '0.51'
3889
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
+
3890
4021
  Style/StringHashKeys:
3891
4022
  Description: 'Prefer symbols instead of strings as hash keys.'
3892
4023
  StyleGuide: '#symbols-as-keys'
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'cookstyle/version'
@@ -10,6 +11,7 @@ Gem::Specification.new do |spec|
10
11
  spec.email = ['thom@chef.io', 'tsmith@chef.io']
11
12
  spec.summary = 'Cookstyle is a code linting tool that helps you to write better Chef Infra cookbooks by detecting and automatically correcting style, syntax, and logic mistakes in your code.'
12
13
  spec.license = 'Apache-2.0'
14
+ spec.homepage = 'https://docs.chef.io/workstation/cookstyle/'
13
15
  spec.required_ruby_version = '>= 2.4'
14
16
 
15
17
  # the gemspec and Gemfile are necessary for appbundling of the gem
@@ -1,18 +1,19 @@
1
+ # frozen_string_literal: true
1
2
  require_relative 'cookstyle/version'
2
3
 
3
- require 'pathname'
4
- require 'yaml'
4
+ require 'pathname' unless defined?(Pathname)
5
+ require 'yaml' unless defined?(YAML)
5
6
 
6
7
  # ensure the desired target version of RuboCop is gem activated
7
8
  gem 'rubocop', "= #{Cookstyle::RUBOCOP_VERSION}"
8
9
  require 'rubocop'
9
- require 'rubocop/monkey_patches/comment_config.rb'
10
+ require_relative 'rubocop/monkey_patches/comment_config.rb'
10
11
 
11
12
  # monkey patches needed for the TargetChefVersion config option
12
- require 'rubocop/monkey_patches/config.rb'
13
- require 'rubocop/monkey_patches/cop.rb'
14
- require 'rubocop/monkey_patches/team.rb'
15
- require 'rubocop/monkey_patches/registry_cop.rb'
13
+ require_relative 'rubocop/monkey_patches/config.rb'
14
+ require_relative 'rubocop/monkey_patches/base.rb'
15
+ require_relative 'rubocop/monkey_patches/team.rb'
16
+ require_relative 'rubocop/monkey_patches/registry_cop.rb'
16
17
 
17
18
  module RuboCop
18
19
  class ConfigLoader
@@ -1,4 +1,5 @@
1
+ # frozen_string_literal: true
1
2
  module Cookstyle
2
- VERSION = "6.11.4".freeze # rubocop: disable Style/StringLiterals
3
- RUBOCOP_VERSION = '0.87.1'.freeze
3
+ VERSION = "6.15.5" # rubocop: disable Style/StringLiterals
4
+ RUBOCOP_VERSION = '0.89.1'
4
5
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module RuboCop
2
3
  # RuboCop Chef project namespace
3
4
  module Chef
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Copyright:: Copyright 2020, Chef Software Inc.
3
4
  # Author:: Tim Smith (<tsmith@chef.io>)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Copyright:: Copyright 2019, Chef Software Inc.
3
4
  # Author:: Tim Smith (<tsmith@chef.io>)