cookstyle 6.15.5 → 6.16.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/config/cookstyle.yml +13 -8
- data/config/disable_all.yml +20 -0
- data/config/upstream.yml +79 -12
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/block_guard_clause_string_only.rb +7 -9
- data/lib/rubocop/cop/chef/correctness/chef_application_fatal.rb +5 -9
- data/lib/rubocop/cop/chef/correctness/conditional_ruby_shellout.rb +5 -9
- data/lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb +5 -8
- data/lib/rubocop/cop/chef/correctness/incorrect_library_injection.rb +11 -9
- data/lib/rubocop/cop/chef/correctness/invalid_default_action.rb +3 -2
- data/lib/rubocop/cop/chef/correctness/invalid_notification_timing.rb +3 -2
- data/lib/rubocop/cop/chef/correctness/invalid_platform_family_helper.rb +16 -21
- data/lib/rubocop/cop/chef/correctness/invalid_platform_family_values_in_case.rb +15 -23
- data/lib/rubocop/cop/chef/correctness/invalid_platform_helper.rb +3 -2
- data/lib/rubocop/cop/chef/correctness/invalid_platform_metadata.rb +13 -14
- data/lib/rubocop/cop/chef/correctness/invalid_platform_values_in_case.rb +13 -22
- data/lib/rubocop/cop/chef/correctness/invalid_value_for_platform_family_helper.rb +5 -3
- data/lib/rubocop/cop/chef/correctness/invalid_value_for_platform_helper.rb +5 -3
- data/lib/rubocop/cop/chef/correctness/invalid_version_metadata.rb +3 -4
- data/lib/rubocop/cop/chef/correctness/lazy_eval_node_attribute_defaults.rb +5 -8
- data/lib/rubocop/cop/chef/correctness/macos_userdefaults_invalid_type.rb +2 -3
- data/lib/rubocop/cop/chef/correctness/malformed_value_for_platform.rb +6 -7
- data/lib/rubocop/cop/chef/correctness/metadata_missing_name.rb +5 -12
- data/lib/rubocop/cop/chef/correctness/node_normal.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/node_normal_unless.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/node_save.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/notifies_action_not_symbol.rb +7 -7
- data/lib/rubocop/cop/chef/correctness/openssl_password_helpers.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/powershell_delete_file.rb +4 -4
- data/lib/rubocop/cop/chef/correctness/resource_sets_internal_properties.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/resource_sets_name_property.rb +2 -2
- data/lib/rubocop/cop/chef/correctness/resource_with_none_action.rb +6 -2
- data/lib/rubocop/cop/chef/correctness/scoped_file_exist.rb +6 -8
- data/lib/rubocop/cop/chef/correctness/service_resource.rb +3 -2
- data/lib/rubocop/cop/chef/correctness/supports_must_be_float.rb +1 -0
- data/lib/rubocop/cop/chef/correctness/tmp_path.rb +4 -4
- data/lib/rubocop/cop/chef/deprecation/ use_automatic_resource_name.rb +1 -2
- data/lib/rubocop/cop/chef/{correctness → deprecation}/cb_depends_on_self.rb +7 -11
- data/lib/rubocop/cop/chef/deprecation/chef_handler_recipe.rb +6 -8
- data/lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb +7 -10
- data/lib/rubocop/cop/chef/deprecation/chef_rest.rb +4 -3
- data/lib/rubocop/cop/chef/deprecation/chef_rewind.rb +16 -28
- data/lib/rubocop/cop/chef/deprecation/chef_windows_platform_helper.rb +5 -8
- data/lib/rubocop/cop/chef/deprecation/chefdk_generators.rb +3 -6
- data/lib/rubocop/cop/chef/deprecation/cheffile.rb +3 -5
- data/lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb +5 -8
- data/lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb +5 -8
- data/lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb +6 -8
- data/lib/rubocop/cop/chef/deprecation/depends_compat_resource.rb +6 -8
- data/lib/rubocop/cop/chef/deprecation/depends_partial_search.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/depends_poise.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +11 -14
- data/lib/rubocop/cop/chef/deprecation/deprecated_mixins.rb +12 -10
- data/lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/deprecated_shellout_methods.rb +11 -12
- data/lib/rubocop/cop/chef/deprecation/deprecated_windows_version_check.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_properties.rb +8 -8
- data/lib/rubocop/cop/chef/deprecation/easy_install.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/eol_audit_mode.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/epic_fail.rb +5 -6
- data/lib/rubocop/cop/chef/deprecation/erl_call.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/hwrp_without_provides.rb +11 -12
- data/lib/rubocop/cop/chef/deprecation/inherits_compat_resource.rb +6 -8
- data/lib/rubocop/cop/chef/deprecation/launchd_deprecated_hash_property.rb +6 -9
- data/lib/rubocop/cop/chef/deprecation/legacy_notify_syntax.rb +6 -9
- data/lib/rubocop/cop/chef/deprecation/legacy_yum_cookbook_recipes.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/locale_lc_all_property.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/name_property_and_default.rb +5 -9
- data/lib/rubocop/cop/chef/deprecation/node_methods_not_attributes.rb +6 -8
- data/lib/rubocop/cop/chef/deprecation/node_set.rb +6 -8
- data/lib/rubocop/cop/chef/deprecation/node_set_unless.rb +6 -8
- data/lib/rubocop/cop/chef/deprecation/node_set_without_level.rb +6 -4
- data/lib/rubocop/cop/chef/deprecation/partial_search_class_usage.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/partial_search_helper_usage.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/poise_archive.rb +4 -3
- data/lib/rubocop/cop/chef/deprecation/powershell_cookbook_helpers.rb +5 -9
- data/lib/rubocop/cop/chef/deprecation/require_recipe.rb +8 -7
- data/lib/rubocop/cop/chef/deprecation/resource_overrides_provides_method.rb +4 -4
- data/lib/rubocop/cop/chef/deprecation/resource_uses_dsl_name_method.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/resource_uses_only_resource_name.rb +6 -9
- data/lib/rubocop/cop/chef/deprecation/resource_uses_provider_base_method.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/resource_uses_updated_method.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/ruby_27_keyword_argument_warnings.rb +7 -10
- data/lib/rubocop/cop/chef/deprecation/ruby_block_create_action.rb +6 -8
- data/lib/rubocop/cop/chef/deprecation/run_command_helper.rb +5 -4
- data/lib/rubocop/cop/chef/deprecation/search_uses_positional_parameters.rb +7 -8
- data/lib/rubocop/cop/chef/deprecation/use_inline_resources.rb +10 -13
- data/lib/rubocop/cop/chef/deprecation/user_supports_property.rb +11 -14
- data/lib/rubocop/cop/chef/deprecation/verify_property_file_expansion.rb +6 -8
- data/lib/rubocop/cop/chef/deprecation/windows_feature_servermanagercmd.rb +2 -2
- data/lib/rubocop/cop/chef/deprecation/windows_task_change_action.rb +11 -16
- data/lib/rubocop/cop/chef/deprecation/windows_version_helpers.rb +4 -9
- data/lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb +7 -8
- data/lib/rubocop/cop/chef/deprecation/yum_dnf_compat_recipe.rb +6 -8
- data/lib/rubocop/cop/chef/effortless/berksfile.rb +3 -5
- data/lib/rubocop/cop/chef/effortless/data_bags.rb +3 -2
- data/lib/rubocop/cop/chef/effortless/node_environment.rb +6 -3
- data/lib/rubocop/cop/chef/effortless/node_policygroup.rb +6 -3
- data/lib/rubocop/cop/chef/effortless/node_roles.rb +6 -3
- data/lib/rubocop/cop/chef/effortless/search_for_environments_or_roles.rb +4 -3
- data/lib/rubocop/cop/chef/effortless/search_used.rb +3 -2
- data/lib/rubocop/cop/chef/modernize/allowed_actions_initializer.rb +16 -16
- data/lib/rubocop/cop/chef/modernize/apt_default_recipe.rb +3 -2
- data/lib/rubocop/cop/chef/modernize/berksfile_source.rb +10 -9
- data/lib/rubocop/cop/chef/modernize/build_essential.rb +7 -8
- data/lib/rubocop/cop/chef/modernize/chef_14_resources.rb +6 -8
- data/lib/rubocop/cop/chef/modernize/chef_gem_nokogiri.rb +12 -10
- data/lib/rubocop/cop/chef/modernize/compile_time_resources.rb +2 -2
- data/lib/rubocop/cop/chef/modernize/conditional_using_test.rb +6 -8
- data/lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb +2 -2
- data/lib/rubocop/cop/chef/modernize/cron_manage_resource.rb +4 -6
- data/lib/rubocop/cop/chef/modernize/databag_helpers.rb +7 -8
- data/lib/rubocop/cop/chef/modernize/default_action_initializer.rb +11 -13
- data/lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb +5 -8
- data/lib/rubocop/cop/chef/modernize/definitions.rb +2 -2
- data/lib/rubocop/cop/chef/modernize/depends_zypper_cookbook.rb +6 -8
- data/lib/rubocop/cop/chef/modernize/dsl_include_in_resource.rb +6 -8
- data/lib/rubocop/cop/chef/modernize/empty_resource_initialize.rb +5 -8
- data/lib/rubocop/cop/chef/modernize/execute_apt_update.rb +7 -4
- data/lib/rubocop/cop/chef/modernize/execute_sc_exe.rb +7 -9
- data/lib/rubocop/cop/chef/modernize/execute_sleep.rb +7 -11
- data/lib/rubocop/cop/chef/modernize/execute_sysctl.rb +6 -9
- data/lib/rubocop/cop/chef/modernize/execute_tzutil.rb +8 -4
- data/lib/rubocop/cop/chef/modernize/foodcritic_comments.rb +7 -12
- data/lib/rubocop/cop/chef/modernize/if_provides_default_action.rb +4 -6
- data/lib/rubocop/cop/chef/modernize/includes_mixin_shellout.rb +6 -8
- data/lib/rubocop/cop/chef/modernize/libarchive_file.rb +13 -9
- data/lib/rubocop/cop/chef/modernize/macos_user_defaults.rb +4 -6
- data/lib/rubocop/cop/chef/modernize/minitest_handler_usage.rb +6 -8
- data/lib/rubocop/cop/chef/modernize/node_roles_include.rb +5 -9
- data/lib/rubocop/cop/chef/modernize/ohai_default_recipe.rb +3 -2
- data/lib/rubocop/cop/chef/modernize/openssl_rsa_key_resource.rb +4 -6
- data/lib/rubocop/cop/chef/modernize/openssl_x509_resource.rb +4 -6
- data/lib/rubocop/cop/chef/modernize/osx_config_profile_resource.rb +5 -6
- data/lib/rubocop/cop/chef/modernize/powershell_expand_archive.rb +3 -4
- data/lib/rubocop/cop/chef/modernize/powershell_guard_interpreter.rb +5 -9
- data/lib/rubocop/cop/chef/modernize/powershell_install_package.rb +3 -4
- data/lib/rubocop/cop/chef/modernize/powershell_install_windowsfeature.rb +3 -4
- data/lib/rubocop/cop/chef/modernize/property_with_name_attribute.rb +6 -9
- data/lib/rubocop/cop/chef/modernize/provides_initializer.rb +13 -15
- data/lib/rubocop/cop/chef/modernize/resource_name_initializer.rb +10 -14
- data/lib/rubocop/cop/chef/modernize/resource_set_or_return.rb +3 -4
- data/lib/rubocop/cop/chef/modernize/resource_with_attributes.rb +8 -8
- data/lib/rubocop/cop/chef/modernize/respond_to_compile_time.rb +4 -9
- data/lib/rubocop/cop/chef/modernize/respond_to_metadata.rb +20 -16
- data/lib/rubocop/cop/chef/modernize/respond_to_provides.rb +6 -8
- data/lib/rubocop/cop/chef/modernize/respond_to_resource_name.rb +6 -8
- data/lib/rubocop/cop/chef/modernize/sc_windows_resource.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/seven_zip_archive.rb +3 -2
- data/lib/rubocop/cop/chef/modernize/shell_out_helper.rb +3 -8
- data/lib/rubocop/cop/chef/modernize/shellouts_to_chocolatey.rb +5 -7
- data/lib/rubocop/cop/chef/modernize/simplify_apt_ppa_setup.rb +6 -10
- data/lib/rubocop/cop/chef/modernize/{systctl_param_resource.rb → sysctl_param_resource.rb} +4 -6
- data/lib/rubocop/cop/chef/modernize/unnecessary_mixlib_shellout_require.rb +6 -8
- data/lib/rubocop/cop/chef/modernize/use_multipackage_installs.rb +11 -10
- data/lib/rubocop/cop/chef/modernize/use_require_relative.rb +7 -9
- data/lib/rubocop/cop/chef/modernize/whyrun_supported_true.rb +5 -8
- data/lib/rubocop/cop/chef/modernize/windows_default_recipe.rb +6 -8
- data/lib/rubocop/cop/chef/modernize/windows_registry_uac.rb +6 -7
- data/lib/rubocop/cop/chef/modernize/windows_zipfile.rb +3 -2
- data/lib/rubocop/cop/chef/modernize/zipfile_resource.rb +4 -3
- data/lib/rubocop/cop/chef/modernize/zypper_repo.rb +4 -6
- data/lib/rubocop/cop/chef/redundant/apt_repository_distribution_default.rb +5 -8
- data/lib/rubocop/cop/chef/redundant/apt_repository_notifies_apt_update.rb +6 -8
- data/lib/rubocop/cop/chef/redundant/attribute_metadata.rb +4 -6
- data/lib/rubocop/cop/chef/redundant/conflicts_metadata.rb +4 -6
- data/lib/rubocop/cop/chef/redundant/custom_resource_with_allowed_actions.rb +8 -13
- data/lib/rubocop/cop/chef/redundant/grouping_metadata.rb +4 -6
- data/lib/rubocop/cop/chef/redundant/long_description_metadata.rb +4 -6
- data/lib/rubocop/cop/chef/redundant/multiple_platform_checks.rb +7 -9
- data/lib/rubocop/cop/chef/redundant/name_property_and_required.rb +2 -2
- data/lib/rubocop/cop/chef/redundant/ohai_attribute_to_string.rb +4 -8
- data/lib/rubocop/cop/chef/redundant/property_splat_regex.rb +8 -9
- data/lib/rubocop/cop/chef/redundant/property_with_default_and_required.rb +5 -9
- data/lib/rubocop/cop/chef/redundant/provides_metadata.rb +4 -6
- data/lib/rubocop/cop/chef/redundant/recipe_metadata.rb +4 -6
- data/lib/rubocop/cop/chef/redundant/replaces_metadata.rb +4 -6
- data/lib/rubocop/cop/chef/redundant/resource_with_nothing_action.rb +5 -8
- data/lib/rubocop/cop/chef/redundant/sensitive_property_in_resource.rb +6 -7
- data/lib/rubocop/cop/chef/redundant/string_property_with_nil_default.rb +7 -9
- data/lib/rubocop/cop/chef/redundant/suggests_metadata.rb +4 -6
- data/lib/rubocop/cop/chef/redundant/unnecessary_desired_state.rb +1 -0
- data/lib/rubocop/cop/chef/redundant/unnecessary_name_property.rb +10 -9
- data/lib/rubocop/cop/chef/redundant/use_create_if_missing.rb +7 -9
- data/lib/rubocop/cop/chef/sharing/default_maintainer_metadata.rb +3 -2
- data/lib/rubocop/cop/chef/sharing/empty_metadata_field.rb +3 -2
- data/lib/rubocop/cop/chef/sharing/include_property_descriptions.rb +4 -3
- data/lib/rubocop/cop/chef/sharing/include_resource_descriptions.rb +5 -5
- data/lib/rubocop/cop/chef/sharing/include_resource_examples.rb +4 -4
- data/lib/rubocop/cop/chef/sharing/insecure_cookbook_url.rb +7 -8
- data/lib/rubocop/cop/chef/sharing/invalid_license_string.rb +8 -12
- data/lib/rubocop/cop/chef/style/chef_whaaat.rb +3 -4
- data/lib/rubocop/cop/chef/style/comment_sentence_spacing.rb +5 -7
- data/lib/rubocop/cop/chef/style/comments_copyright_format.rb +5 -9
- data/lib/rubocop/cop/chef/style/comments_default_copyright.rb +5 -7
- data/lib/rubocop/cop/chef/style/comments_format.rb +13 -16
- data/lib/rubocop/cop/chef/style/file_mode.rb +1 -0
- data/lib/rubocop/cop/chef/style/immediate_notification_timing.rb +7 -8
- data/lib/rubocop/cop/chef/style/include_recipe_with_parentheses.rb +1 -0
- data/lib/rubocop/cop/chef/style/negating_only_if.rb +5 -9
- data/lib/rubocop/cop/chef/style/overly_complex_supports_depends_metadata.rb +5 -9
- data/lib/rubocop/cop/chef/style/simplify_platform_major_version_check.rb +6 -8
- data/lib/rubocop/cop/chef/style/true_false_resource_properties.rb +6 -9
- data/lib/rubocop/cop/chef/style/unnecessary_os_check.rb +17 -28
- data/lib/rubocop/cop/chef/style/unnecessary_platform_case_statement.rb +5 -9
- data/lib/rubocop/cop/chef/style/use_platform_helpers.rb +11 -19
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e15b2148d2b58205dc5b6653e3824b59dda2a927c1e0753f42d522105682021
|
4
|
+
data.tar.gz: e2c9f7bb6727c8f97b7de581e29b4f18db002b17f10732e115652e728f844ded
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d1c969323e34fc6c58c987a9b339c625f2cfeb7b6ceeea83e7e7a0b5292dfe8d54e1f05dca2773ec582aaa6ad5b12914715d77b140906f14b8911406396d5e
|
7
|
+
data.tar.gz: e343548e500f20767be5ce478d47969677e31d9ebd1f8661cab493e9777eadd0e8ed09921a22690ef61a5ade718b8ae954bc1fa3464c01abbcd12cd6843e1273
|
data/Gemfile
CHANGED
data/config/cookstyle.yml
CHANGED
@@ -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
|
###############################
|
@@ -2611,4 +2612,8 @@ Style/BisectedAttrAccessor:
|
|
2611
2612
|
|
2612
2613
|
# avoid assignments that aren't needed
|
2613
2614
|
Style/RedundantAssignment:
|
2615
|
+
Enabled: true
|
2616
|
+
|
2617
|
+
# alert on invalid ruby
|
2618
|
+
Lint/Syntax:
|
2614
2619
|
Enabled: true
|
data/config/disable_all.yml
CHANGED
@@ -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:
|
data/config/upstream.yml
CHANGED
@@ -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
|
@@ -1845,7 +1861,6 @@ Lint/Syntax:
|
|
1845
1861
|
Enabled: true
|
1846
1862
|
VersionAdded: '0.9'
|
1847
1863
|
|
1848
|
-
|
1849
1864
|
Lint/ToJSON:
|
1850
1865
|
Description: 'Ensure #to_json includes an optional argument.'
|
1851
1866
|
Enabled: true
|
@@ -1856,6 +1871,11 @@ Lint/TopLevelReturnWithArgument:
|
|
1856
1871
|
Enabled: 'pending'
|
1857
1872
|
VersionAdded: '0.89'
|
1858
1873
|
|
1874
|
+
Lint/TrailingCommaInAttributeDeclaration:
|
1875
|
+
Description: 'This cop checks for trailing commas in attribute declarations.'
|
1876
|
+
Enabled: pending
|
1877
|
+
VersionAdded: '0.90'
|
1878
|
+
|
1859
1879
|
Lint/UnderscorePrefixedVariableName:
|
1860
1880
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
1861
1881
|
Enabled: true
|
@@ -1931,6 +1951,13 @@ Lint/UselessElseWithoutRescue:
|
|
1931
1951
|
Enabled: true
|
1932
1952
|
VersionAdded: '0.17'
|
1933
1953
|
|
1954
|
+
Lint/UselessMethodDefinition:
|
1955
|
+
Description: 'Checks for useless method definitions.'
|
1956
|
+
Enabled: pending
|
1957
|
+
VersionAdded: '0.90'
|
1958
|
+
Safe: false
|
1959
|
+
AllowComments: true
|
1960
|
+
|
1934
1961
|
Lint/UselessSetterCall:
|
1935
1962
|
Description: 'Checks for useless setter call to a local variable.'
|
1936
1963
|
Enabled: true
|
@@ -2591,6 +2618,7 @@ Style/CaseLikeIf:
|
|
2591
2618
|
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2592
2619
|
StyleGuide: '#case-vs-if-else'
|
2593
2620
|
Enabled: 'pending'
|
2621
|
+
Safe: false
|
2594
2622
|
VersionAdded: '0.88'
|
2595
2623
|
|
2596
2624
|
Style/CharacterLiteral:
|
@@ -2608,7 +2636,6 @@ Style/ClassAndModuleChildren:
|
|
2608
2636
|
# have the knowledge to perform either operation safely and thus requires
|
2609
2637
|
# manual oversight.
|
2610
2638
|
SafeAutoCorrect: false
|
2611
|
-
AutoCorrect: false
|
2612
2639
|
Enabled: true
|
2613
2640
|
VersionAdded: '0.19'
|
2614
2641
|
#
|
@@ -2647,6 +2674,16 @@ Style/ClassMethods:
|
|
2647
2674
|
VersionAdded: '0.9'
|
2648
2675
|
VersionChanged: '0.20'
|
2649
2676
|
|
2677
|
+
Style/ClassMethodsDefinitions:
|
2678
|
+
Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
|
2679
|
+
StyleGuide: '#def-self-class-methods'
|
2680
|
+
Enabled: false
|
2681
|
+
VersionAdded: '0.89'
|
2682
|
+
EnforcedStyle: def_self
|
2683
|
+
SupportedStyles:
|
2684
|
+
- def_self
|
2685
|
+
- self_class
|
2686
|
+
|
2650
2687
|
Style/ClassVars:
|
2651
2688
|
Description: 'Avoid the use of class variables.'
|
2652
2689
|
StyleGuide: '#no-class-vars'
|
@@ -2687,6 +2724,14 @@ Style/ColonMethodDefinition:
|
|
2687
2724
|
Enabled: true
|
2688
2725
|
VersionAdded: '0.52'
|
2689
2726
|
|
2727
|
+
Style/CombinableLoops:
|
2728
|
+
Description: >-
|
2729
|
+
Checks for places where multiple consecutive loops over the same data
|
2730
|
+
can be combined into a single loop.
|
2731
|
+
Enabled: pending
|
2732
|
+
Safe: false
|
2733
|
+
VersionAdded: '0.90'
|
2734
|
+
|
2690
2735
|
Style/CommandLiteral:
|
2691
2736
|
Description: 'Use `` or %x around command literals.'
|
2692
2737
|
StyleGuide: '#percent-x'
|
@@ -3021,7 +3066,7 @@ Style/FrozenStringLiteralComment:
|
|
3021
3066
|
# `never` will enforce that the frozen string literal comment does not
|
3022
3067
|
# exist in a file.
|
3023
3068
|
- never
|
3024
|
-
|
3069
|
+
SafeAutoCorrect: false
|
3025
3070
|
|
3026
3071
|
Style/GlobalStdStream:
|
3027
3072
|
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
@@ -3101,15 +3146,17 @@ Style/HashSyntax:
|
|
3101
3146
|
PreferHashRocketsForNonAlnumEndingSymbols: false
|
3102
3147
|
|
3103
3148
|
Style/HashTransformKeys:
|
3104
|
-
Description: 'Prefer `transform_keys` over `each_with_object`
|
3149
|
+
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
|
3105
3150
|
Enabled: 'pending'
|
3106
3151
|
VersionAdded: '0.80'
|
3152
|
+
VersionChanged: '0.90'
|
3107
3153
|
Safe: false
|
3108
3154
|
|
3109
3155
|
Style/HashTransformValues:
|
3110
|
-
Description: 'Prefer `transform_values` over `each_with_object`
|
3156
|
+
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
|
3111
3157
|
Enabled: 'pending'
|
3112
3158
|
VersionAdded: '0.80'
|
3159
|
+
VersionChanged: '0.90'
|
3113
3160
|
Safe: false
|
3114
3161
|
|
3115
3162
|
Style/IdenticalConditionalBranches:
|
@@ -3206,6 +3253,12 @@ Style/IpAddresses:
|
|
3206
3253
|
- "::"
|
3207
3254
|
# :: is a valid IPv6 address, but could potentially be legitimately in code
|
3208
3255
|
|
3256
|
+
Style/KeywordParametersOrder:
|
3257
|
+
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
3258
|
+
StyleGuide: '#keyword-parameters-order'
|
3259
|
+
Enabled: pending
|
3260
|
+
VersionAdded: '0.90'
|
3261
|
+
|
3209
3262
|
Style/Lambda:
|
3210
3263
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
3211
3264
|
StyleGuide: '#lambda-multi-line'
|
@@ -3579,7 +3632,6 @@ Style/NumericPredicate:
|
|
3579
3632
|
# object. Switching these methods has to be done with knowledge of the types
|
3580
3633
|
# of the variables which rubocop doesn't have.
|
3581
3634
|
SafeAutoCorrect: false
|
3582
|
-
AutoCorrect: false
|
3583
3635
|
Enabled: true
|
3584
3636
|
VersionAdded: '0.42'
|
3585
3637
|
VersionChanged: '0.59'
|
@@ -3595,12 +3647,13 @@ Style/NumericPredicate:
|
|
3595
3647
|
|
3596
3648
|
Style/OneLineConditional:
|
3597
3649
|
Description: >-
|
3598
|
-
Favor the ternary operator(?:) over
|
3599
|
-
if/then/else/end constructs.
|
3650
|
+
Favor the ternary operator (?:) or multi-line constructs over
|
3651
|
+
single-line if/then/else/end constructs.
|
3600
3652
|
StyleGuide: '#ternary-operator'
|
3601
3653
|
Enabled: true
|
3654
|
+
AlwaysCorrectToMultiline: false
|
3602
3655
|
VersionAdded: '0.9'
|
3603
|
-
VersionChanged: '0.
|
3656
|
+
VersionChanged: '0.90'
|
3604
3657
|
|
3605
3658
|
Style/OptionHash:
|
3606
3659
|
Description: "Don't use option hashes when you can use keyword arguments."
|
@@ -3831,6 +3884,12 @@ Style/RedundantSelf:
|
|
3831
3884
|
VersionAdded: '0.10'
|
3832
3885
|
VersionChanged: '0.13'
|
3833
3886
|
|
3887
|
+
Style/RedundantSelfAssignment:
|
3888
|
+
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
|
3889
|
+
Enabled: pending
|
3890
|
+
Safe: false
|
3891
|
+
VersionAdded: '0.90'
|
3892
|
+
|
3834
3893
|
Style/RedundantSort:
|
3835
3894
|
Description: >-
|
3836
3895
|
Use `min` instead of `sort.first`,
|
@@ -3983,6 +4042,14 @@ Style/SlicingWithRange:
|
|
3983
4042
|
VersionAdded: '0.83'
|
3984
4043
|
Safe: false
|
3985
4044
|
|
4045
|
+
Style/SoleNestedConditional:
|
4046
|
+
Description: >-
|
4047
|
+
Finds sole nested conditional nodes
|
4048
|
+
which can be merged into outer conditional node.
|
4049
|
+
Enabled: pending
|
4050
|
+
VersionAdded: '0.89'
|
4051
|
+
AllowModifier: false
|
4052
|
+
|
3986
4053
|
Style/SpecialGlobalVars:
|
3987
4054
|
Description: 'Avoid Perl-style global variables.'
|
3988
4055
|
StyleGuide: '#no-cryptic-perlisms'
|
data/lib/cookstyle/version.rb
CHANGED
@@ -37,7 +37,9 @@ module RuboCop
|
|
37
37
|
# only_if 'test -f /etc/foo'
|
38
38
|
# end
|
39
39
|
#
|
40
|
-
class BlockGuardWithOnlyString <
|
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,
|
50
|
-
|
51
|
-
|
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 <
|
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,
|
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 <
|
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,
|
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
|