cookstyle 6.15.9 → 6.16.4

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