cookstyle 6.15.3 → 6.16.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/config/cookstyle.yml +9 -8
  4. data/config/disable_all.yml +20 -0
  5. data/config/upstream.yml +79 -11
  6. data/lib/cookstyle.rb +2 -2
  7. data/lib/cookstyle/version.rb +2 -2
  8. data/lib/rubocop/cop/chef/correctness/block_guard_clause_string_only.rb +7 -9
  9. data/lib/rubocop/cop/chef/correctness/chef_application_fatal.rb +5 -9
  10. data/lib/rubocop/cop/chef/correctness/conditional_ruby_shellout.rb +5 -9
  11. data/lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb +5 -8
  12. data/lib/rubocop/cop/chef/correctness/incorrect_library_injection.rb +11 -9
  13. data/lib/rubocop/cop/chef/correctness/invalid_default_action.rb +3 -2
  14. data/lib/rubocop/cop/chef/correctness/invalid_notification_timing.rb +3 -2
  15. data/lib/rubocop/cop/chef/correctness/invalid_platform_family_helper.rb +16 -21
  16. data/lib/rubocop/cop/chef/correctness/invalid_platform_family_values_in_case.rb +15 -23
  17. data/lib/rubocop/cop/chef/correctness/invalid_platform_helper.rb +3 -2
  18. data/lib/rubocop/cop/chef/correctness/invalid_platform_metadata.rb +13 -14
  19. data/lib/rubocop/cop/chef/correctness/invalid_platform_values_in_case.rb +13 -22
  20. data/lib/rubocop/cop/chef/correctness/invalid_value_for_platform_family_helper.rb +5 -3
  21. data/lib/rubocop/cop/chef/correctness/invalid_value_for_platform_helper.rb +5 -3
  22. data/lib/rubocop/cop/chef/correctness/invalid_version_metadata.rb +3 -4
  23. data/lib/rubocop/cop/chef/correctness/lazy_eval_node_attribute_defaults.rb +5 -8
  24. data/lib/rubocop/cop/chef/correctness/macos_userdefaults_invalid_type.rb +2 -3
  25. data/lib/rubocop/cop/chef/correctness/malformed_value_for_platform.rb +6 -7
  26. data/lib/rubocop/cop/chef/correctness/metadata_missing_name.rb +5 -12
  27. data/lib/rubocop/cop/chef/correctness/node_normal.rb +2 -2
  28. data/lib/rubocop/cop/chef/correctness/node_normal_unless.rb +2 -2
  29. data/lib/rubocop/cop/chef/correctness/node_save.rb +2 -2
  30. data/lib/rubocop/cop/chef/correctness/notifies_action_not_symbol.rb +7 -7
  31. data/lib/rubocop/cop/chef/correctness/openssl_password_helpers.rb +2 -2
  32. data/lib/rubocop/cop/chef/correctness/powershell_delete_file.rb +4 -4
  33. data/lib/rubocop/cop/chef/correctness/resource_sets_internal_properties.rb +2 -2
  34. data/lib/rubocop/cop/chef/correctness/resource_sets_name_property.rb +2 -2
  35. data/lib/rubocop/cop/chef/correctness/resource_with_none_action.rb +6 -2
  36. data/lib/rubocop/cop/chef/correctness/scoped_file_exist.rb +6 -8
  37. data/lib/rubocop/cop/chef/correctness/service_resource.rb +3 -2
  38. data/lib/rubocop/cop/chef/correctness/supports_must_be_float.rb +1 -0
  39. data/lib/rubocop/cop/chef/correctness/tmp_path.rb +4 -4
  40. data/lib/rubocop/cop/chef/deprecation/ use_automatic_resource_name.rb +1 -2
  41. data/lib/rubocop/cop/chef/{correctness → deprecation}/cb_depends_on_self.rb +7 -11
  42. data/lib/rubocop/cop/chef/deprecation/chef_handler_recipe.rb +6 -8
  43. data/lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb +7 -10
  44. data/lib/rubocop/cop/chef/deprecation/chef_rest.rb +4 -3
  45. data/lib/rubocop/cop/chef/deprecation/chef_rewind.rb +16 -28
  46. data/lib/rubocop/cop/chef/deprecation/chef_windows_platform_helper.rb +5 -8
  47. data/lib/rubocop/cop/chef/deprecation/chefdk_generators.rb +3 -6
  48. data/lib/rubocop/cop/chef/deprecation/cheffile.rb +3 -5
  49. data/lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb +5 -8
  50. data/lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb +5 -8
  51. data/lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb +6 -8
  52. data/lib/rubocop/cop/chef/deprecation/depends_compat_resource.rb +6 -8
  53. data/lib/rubocop/cop/chef/deprecation/depends_partial_search.rb +3 -2
  54. data/lib/rubocop/cop/chef/deprecation/depends_poise.rb +3 -2
  55. data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +11 -14
  56. data/lib/rubocop/cop/chef/deprecation/deprecated_mixins.rb +12 -10
  57. data/lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb +2 -2
  58. data/lib/rubocop/cop/chef/deprecation/deprecated_shellout_methods.rb +11 -12
  59. data/lib/rubocop/cop/chef/deprecation/deprecated_windows_version_check.rb +3 -2
  60. data/lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_properties.rb +8 -8
  61. data/lib/rubocop/cop/chef/deprecation/easy_install.rb +3 -2
  62. data/lib/rubocop/cop/chef/deprecation/eol_audit_mode.rb +3 -2
  63. data/lib/rubocop/cop/chef/deprecation/epic_fail.rb +5 -6
  64. data/lib/rubocop/cop/chef/deprecation/erl_call.rb +3 -2
  65. data/lib/rubocop/cop/chef/deprecation/hwrp_without_provides.rb +11 -12
  66. data/lib/rubocop/cop/chef/deprecation/inherits_compat_resource.rb +6 -8
  67. data/lib/rubocop/cop/chef/deprecation/launchd_deprecated_hash_property.rb +6 -9
  68. data/lib/rubocop/cop/chef/deprecation/legacy_notify_syntax.rb +6 -9
  69. data/lib/rubocop/cop/chef/deprecation/legacy_yum_cookbook_recipes.rb +3 -2
  70. data/lib/rubocop/cop/chef/deprecation/locale_lc_all_property.rb +2 -2
  71. data/lib/rubocop/cop/chef/deprecation/name_property_and_default.rb +5 -9
  72. data/lib/rubocop/cop/chef/deprecation/node_methods_not_attributes.rb +6 -8
  73. data/lib/rubocop/cop/chef/deprecation/node_set.rb +6 -8
  74. data/lib/rubocop/cop/chef/deprecation/node_set_unless.rb +6 -8
  75. data/lib/rubocop/cop/chef/deprecation/node_set_without_level.rb +6 -4
  76. data/lib/rubocop/cop/chef/deprecation/partial_search_class_usage.rb +2 -2
  77. data/lib/rubocop/cop/chef/deprecation/partial_search_helper_usage.rb +3 -2
  78. data/lib/rubocop/cop/chef/deprecation/poise_archive.rb +4 -3
  79. data/lib/rubocop/cop/chef/deprecation/powershell_cookbook_helpers.rb +5 -9
  80. data/lib/rubocop/cop/chef/deprecation/require_recipe.rb +8 -7
  81. data/lib/rubocop/cop/chef/deprecation/resource_overrides_provides_method.rb +4 -4
  82. data/lib/rubocop/cop/chef/deprecation/resource_uses_dsl_name_method.rb +3 -2
  83. data/lib/rubocop/cop/chef/deprecation/resource_uses_only_resource_name.rb +6 -9
  84. data/lib/rubocop/cop/chef/deprecation/resource_uses_provider_base_method.rb +3 -2
  85. data/lib/rubocop/cop/chef/deprecation/resource_uses_updated_method.rb +2 -2
  86. data/lib/rubocop/cop/chef/deprecation/ruby_27_keyword_argument_warnings.rb +7 -10
  87. data/lib/rubocop/cop/chef/deprecation/ruby_block_create_action.rb +6 -8
  88. data/lib/rubocop/cop/chef/deprecation/run_command_helper.rb +5 -4
  89. data/lib/rubocop/cop/chef/deprecation/search_uses_positional_parameters.rb +7 -8
  90. data/lib/rubocop/cop/chef/deprecation/use_inline_resources.rb +10 -13
  91. data/lib/rubocop/cop/chef/deprecation/user_supports_property.rb +11 -14
  92. data/lib/rubocop/cop/chef/deprecation/verify_property_file_expansion.rb +6 -8
  93. data/lib/rubocop/cop/chef/deprecation/windows_feature_servermanagercmd.rb +2 -2
  94. data/lib/rubocop/cop/chef/deprecation/windows_task_change_action.rb +11 -16
  95. data/lib/rubocop/cop/chef/deprecation/windows_version_helpers.rb +4 -9
  96. data/lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb +7 -8
  97. data/lib/rubocop/cop/chef/deprecation/yum_dnf_compat_recipe.rb +6 -8
  98. data/lib/rubocop/cop/chef/effortless/berksfile.rb +3 -5
  99. data/lib/rubocop/cop/chef/effortless/data_bags.rb +3 -2
  100. data/lib/rubocop/cop/chef/effortless/node_environment.rb +6 -3
  101. data/lib/rubocop/cop/chef/effortless/node_policygroup.rb +6 -3
  102. data/lib/rubocop/cop/chef/effortless/node_roles.rb +6 -3
  103. data/lib/rubocop/cop/chef/effortless/search_for_environments_or_roles.rb +4 -3
  104. data/lib/rubocop/cop/chef/effortless/search_used.rb +3 -2
  105. data/lib/rubocop/cop/chef/modernize/allowed_actions_initializer.rb +16 -16
  106. data/lib/rubocop/cop/chef/modernize/apt_default_recipe.rb +3 -2
  107. data/lib/rubocop/cop/chef/modernize/berksfile_source.rb +10 -9
  108. data/lib/rubocop/cop/chef/modernize/build_essential.rb +7 -8
  109. data/lib/rubocop/cop/chef/modernize/chef_14_resources.rb +6 -8
  110. data/lib/rubocop/cop/chef/modernize/chef_gem_nokogiri.rb +12 -10
  111. data/lib/rubocop/cop/chef/modernize/compile_time_resources.rb +2 -2
  112. data/lib/rubocop/cop/chef/modernize/conditional_using_test.rb +6 -8
  113. data/lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb +2 -2
  114. data/lib/rubocop/cop/chef/modernize/cron_manage_resource.rb +4 -6
  115. data/lib/rubocop/cop/chef/modernize/databag_helpers.rb +7 -8
  116. data/lib/rubocop/cop/chef/modernize/default_action_initializer.rb +11 -13
  117. data/lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb +5 -8
  118. data/lib/rubocop/cop/chef/modernize/definitions.rb +2 -2
  119. data/lib/rubocop/cop/chef/modernize/depends_zypper_cookbook.rb +6 -8
  120. data/lib/rubocop/cop/chef/modernize/dsl_include_in_resource.rb +6 -8
  121. data/lib/rubocop/cop/chef/modernize/empty_resource_initialize.rb +5 -8
  122. data/lib/rubocop/cop/chef/modernize/execute_apt_update.rb +7 -4
  123. data/lib/rubocop/cop/chef/modernize/execute_sc_exe.rb +7 -9
  124. data/lib/rubocop/cop/chef/modernize/execute_sleep.rb +7 -11
  125. data/lib/rubocop/cop/chef/modernize/execute_sysctl.rb +6 -9
  126. data/lib/rubocop/cop/chef/modernize/execute_tzutil.rb +8 -4
  127. data/lib/rubocop/cop/chef/modernize/foodcritic_comments.rb +7 -12
  128. data/lib/rubocop/cop/chef/modernize/if_provides_default_action.rb +4 -6
  129. data/lib/rubocop/cop/chef/modernize/includes_mixin_shellout.rb +6 -8
  130. data/lib/rubocop/cop/chef/modernize/libarchive_file.rb +13 -9
  131. data/lib/rubocop/cop/chef/modernize/macos_user_defaults.rb +4 -6
  132. data/lib/rubocop/cop/chef/modernize/minitest_handler_usage.rb +6 -8
  133. data/lib/rubocop/cop/chef/modernize/node_roles_include.rb +5 -9
  134. data/lib/rubocop/cop/chef/modernize/ohai_default_recipe.rb +3 -2
  135. data/lib/rubocop/cop/chef/modernize/openssl_rsa_key_resource.rb +4 -6
  136. data/lib/rubocop/cop/chef/modernize/openssl_x509_resource.rb +4 -6
  137. data/lib/rubocop/cop/chef/modernize/osx_config_profile_resource.rb +5 -6
  138. data/lib/rubocop/cop/chef/modernize/powershell_expand_archive.rb +3 -4
  139. data/lib/rubocop/cop/chef/modernize/powershell_guard_interpreter.rb +5 -9
  140. data/lib/rubocop/cop/chef/modernize/powershell_install_package.rb +3 -4
  141. data/lib/rubocop/cop/chef/modernize/powershell_install_windowsfeature.rb +3 -4
  142. data/lib/rubocop/cop/chef/modernize/property_with_name_attribute.rb +6 -9
  143. data/lib/rubocop/cop/chef/modernize/provides_initializer.rb +13 -15
  144. data/lib/rubocop/cop/chef/modernize/resource_name_initializer.rb +10 -14
  145. data/lib/rubocop/cop/chef/modernize/resource_set_or_return.rb +3 -4
  146. data/lib/rubocop/cop/chef/modernize/resource_with_attributes.rb +8 -8
  147. data/lib/rubocop/cop/chef/modernize/respond_to_compile_time.rb +4 -9
  148. data/lib/rubocop/cop/chef/modernize/respond_to_metadata.rb +20 -16
  149. data/lib/rubocop/cop/chef/modernize/respond_to_provides.rb +6 -8
  150. data/lib/rubocop/cop/chef/modernize/respond_to_resource_name.rb +6 -8
  151. data/lib/rubocop/cop/chef/modernize/sc_windows_resource.rb +2 -1
  152. data/lib/rubocop/cop/chef/modernize/seven_zip_archive.rb +3 -2
  153. data/lib/rubocop/cop/chef/modernize/shell_out_helper.rb +3 -8
  154. data/lib/rubocop/cop/chef/modernize/shellouts_to_chocolatey.rb +5 -7
  155. data/lib/rubocop/cop/chef/modernize/simplify_apt_ppa_setup.rb +6 -10
  156. data/lib/rubocop/cop/chef/modernize/{systctl_param_resource.rb → sysctl_param_resource.rb} +4 -6
  157. data/lib/rubocop/cop/chef/modernize/unnecessary_mixlib_shellout_require.rb +6 -8
  158. data/lib/rubocop/cop/chef/modernize/use_multipackage_installs.rb +11 -10
  159. data/lib/rubocop/cop/chef/modernize/use_require_relative.rb +7 -9
  160. data/lib/rubocop/cop/chef/modernize/whyrun_supported_true.rb +5 -8
  161. data/lib/rubocop/cop/chef/modernize/windows_default_recipe.rb +6 -8
  162. data/lib/rubocop/cop/chef/modernize/windows_registry_uac.rb +6 -7
  163. data/lib/rubocop/cop/chef/modernize/windows_zipfile.rb +3 -2
  164. data/lib/rubocop/cop/chef/modernize/zipfile_resource.rb +4 -3
  165. data/lib/rubocop/cop/chef/modernize/zypper_repo.rb +4 -6
  166. data/lib/rubocop/cop/chef/redundant/apt_repository_distribution_default.rb +5 -8
  167. data/lib/rubocop/cop/chef/redundant/apt_repository_notifies_apt_update.rb +6 -8
  168. data/lib/rubocop/cop/chef/redundant/attribute_metadata.rb +4 -6
  169. data/lib/rubocop/cop/chef/redundant/conflicts_metadata.rb +4 -6
  170. data/lib/rubocop/cop/chef/redundant/custom_resource_with_allowed_actions.rb +8 -13
  171. data/lib/rubocop/cop/chef/redundant/grouping_metadata.rb +4 -6
  172. data/lib/rubocop/cop/chef/redundant/long_description_metadata.rb +4 -6
  173. data/lib/rubocop/cop/chef/redundant/multiple_platform_checks.rb +7 -9
  174. data/lib/rubocop/cop/chef/redundant/name_property_and_required.rb +2 -2
  175. data/lib/rubocop/cop/chef/redundant/ohai_attribute_to_string.rb +4 -8
  176. data/lib/rubocop/cop/chef/redundant/property_splat_regex.rb +8 -9
  177. data/lib/rubocop/cop/chef/redundant/property_with_default_and_required.rb +5 -9
  178. data/lib/rubocop/cop/chef/redundant/provides_metadata.rb +4 -6
  179. data/lib/rubocop/cop/chef/redundant/recipe_metadata.rb +4 -6
  180. data/lib/rubocop/cop/chef/redundant/replaces_metadata.rb +4 -6
  181. data/lib/rubocop/cop/chef/redundant/resource_with_nothing_action.rb +5 -8
  182. data/lib/rubocop/cop/chef/redundant/sensitive_property_in_resource.rb +6 -7
  183. data/lib/rubocop/cop/chef/redundant/string_property_with_nil_default.rb +7 -9
  184. data/lib/rubocop/cop/chef/redundant/suggests_metadata.rb +4 -6
  185. data/lib/rubocop/cop/chef/redundant/unnecessary_desired_state.rb +1 -0
  186. data/lib/rubocop/cop/chef/redundant/unnecessary_name_property.rb +10 -9
  187. data/lib/rubocop/cop/chef/redundant/use_create_if_missing.rb +7 -9
  188. data/lib/rubocop/cop/chef/sharing/default_maintainer_metadata.rb +3 -2
  189. data/lib/rubocop/cop/chef/sharing/empty_metadata_field.rb +4 -3
  190. data/lib/rubocop/cop/chef/sharing/include_property_descriptions.rb +4 -3
  191. data/lib/rubocop/cop/chef/sharing/include_resource_descriptions.rb +5 -5
  192. data/lib/rubocop/cop/chef/sharing/include_resource_examples.rb +4 -4
  193. data/lib/rubocop/cop/chef/sharing/insecure_cookbook_url.rb +7 -8
  194. data/lib/rubocop/cop/chef/sharing/invalid_license_string.rb +8 -12
  195. data/lib/rubocop/cop/chef/style/chef_whaaat.rb +3 -4
  196. data/lib/rubocop/cop/chef/style/comment_sentence_spacing.rb +5 -7
  197. data/lib/rubocop/cop/chef/style/comments_copyright_format.rb +5 -9
  198. data/lib/rubocop/cop/chef/style/comments_default_copyright.rb +5 -7
  199. data/lib/rubocop/cop/chef/style/comments_format.rb +13 -16
  200. data/lib/rubocop/cop/chef/style/file_mode.rb +1 -0
  201. data/lib/rubocop/cop/chef/style/immediate_notification_timing.rb +7 -8
  202. data/lib/rubocop/cop/chef/style/include_recipe_with_parentheses.rb +1 -0
  203. data/lib/rubocop/cop/chef/style/negating_only_if.rb +5 -9
  204. data/lib/rubocop/cop/chef/style/overly_complex_supports_depends_metadata.rb +5 -9
  205. data/lib/rubocop/cop/chef/style/simplify_platform_major_version_check.rb +6 -8
  206. data/lib/rubocop/cop/chef/style/true_false_resource_properties.rb +6 -9
  207. data/lib/rubocop/cop/chef/style/unnecessary_os_check.rb +17 -28
  208. data/lib/rubocop/cop/chef/style/unnecessary_platform_case_statement.rb +5 -9
  209. data/lib/rubocop/cop/chef/style/use_platform_helpers.rb +11 -19
  210. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52ca43d4f012f7af91001dfbe12b7a535c5dff63d951f99f8abe105dc59ac133
4
- data.tar.gz: 6f322d2a78fa09db1ba0ec4ff099e961e734432d0fdd8347407a055aaeb259b9
3
+ metadata.gz: a8e68daec28420e78dc490431b8d537e9f0ed6d1584169ac3a38ec5d5b299d74
4
+ data.tar.gz: 748af99f0eca7196d254d8f780185e7bca2dbe7e6be2fa7442b2974f083c2db3
5
5
  SHA512:
6
- metadata.gz: e5921965b88db1b2d2c28324483c974c521d46625b20af88ee9cd911d50e568dd4a9468f2eec448986e011088f3611216acaead53e16441dd932dbeeff339427
7
- data.tar.gz: 4273b98e64b42f0afc3c3a10e3f70a603553649607bf3956b90d5f1e4e0497cbb98a82d7ce94fbe2d1fa3f0913c7e7bae0ee02c5b7709418052f7a5d6dbaa9e5
6
+ metadata.gz: fa5506a626d47605585b6d1d94a2eb4c1e8d2f5cd34ee85823beb240f4b3983f249bfe9abbd692a7905ecb939eea59e5ebfed61410c6bb93c9416b1c2d9df6da
7
+ data.tar.gz: 2b49fd42843f06262d32690695f3e02ed86fe80d67fcc03f1c2abaf1fd8d3cba7751eabb9f1b35fd07efbd44f026f5ae1d18c5c00597b2516e59dcb6916920e3
data/Gemfile CHANGED
@@ -27,5 +27,4 @@ group :development do
27
27
  gem 'concord'
28
28
  gem 'rake'
29
29
  gem 'rspec', '>= 3.4'
30
- gem 'simplecov'
31
30
  end
@@ -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,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
  require_relative 'cookstyle/version'
3
3
 
4
- require 'pathname'
5
- require 'yaml'
4
+ require 'pathname' unless defined?(Pathname)
5
+ require 'yaml' unless defined?(YAML)
6
6
 
7
7
  # ensure the desired target version of RuboCop is gem activated
8
8
  gem 'rubocop', "= #{Cookstyle::RUBOCOP_VERSION}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Cookstyle
3
- VERSION = "6.15.3" # rubocop: disable Style/StringLiterals
4
- RUBOCOP_VERSION = '0.89.1'
3
+ VERSION = "6.16.9" # 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