cookstyle 6.11.4 → 6.15.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -0
- data/bin/cookstyle +1 -0
- data/bin/cookstyle-profile +31 -0
- data/config/cookstyle.yml +146 -38
- data/config/disable_all.yml +40 -4
- data/config/upstream.yml +153 -22
- data/cookstyle.gemspec +2 -0
- data/lib/cookstyle.rb +8 -7
- data/lib/cookstyle/version.rb +3 -2
- data/lib/rubocop/chef.rb +1 -0
- data/lib/rubocop/chef/autocorrect_helpers.rb +1 -0
- data/lib/rubocop/chef/cookbook_helpers.rb +1 -0
- data/lib/rubocop/chef/platform_helpers.rb +1 -0
- data/lib/rubocop/cop/chef/correctness/block_guard_clause_string_only.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/cb_depends_on_self.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/chef_application_fatal.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/conditional_ruby_shellout.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/dnf_package_allow_downgrades.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/incorrect_library_injection.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/invalid_default_action.rb +48 -0
- data/lib/rubocop/cop/chef/correctness/invalid_notification_timing.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/invalid_platform_family_helper.rb +28 -4
- data/lib/rubocop/cop/chef/correctness/invalid_platform_family_values_in_case.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/invalid_platform_helper.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/invalid_platform_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/invalid_platform_values_in_case.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/invalid_value_for_platform_family_helper.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/invalid_value_for_platform_helper.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/invalid_version_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/lazy_eval_node_attribute_defaults.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/macos_userdefaults_invalid_type.rb +68 -0
- data/lib/rubocop/cop/chef/correctness/malformed_value_for_platform.rb +1 -0
- data/lib/rubocop/cop/chef/correctness/metadata_missing_name.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/node_normal.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/node_normal_unless.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/node_save.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/notifies_action_not_symbol.rb +6 -5
- data/lib/rubocop/cop/chef/correctness/openssl_password_helpers.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/powershell_delete_file.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/resource_sets_internal_properties.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/resource_sets_name_property.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/resource_with_none_action.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/scoped_file_exist.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/service_resource.rb +2 -1
- data/lib/rubocop/cop/chef/correctness/supports_must_be_float.rb +52 -0
- data/lib/rubocop/cop/chef/correctness/tmp_path.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/ use_automatic_resource_name.rb +52 -0
- data/lib/rubocop/cop/chef/deprecation/chef_handler_recipe.rb +55 -0
- data/lib/rubocop/cop/chef/deprecation/chef_handler_supports.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/chef_rest.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/chef_rewind.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/chef_windows_platform_helper.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/chefdk_generators.rb +60 -0
- data/lib/rubocop/cop/chef/deprecation/cheffile.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/chefspec_legacy_runner.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/chocolatey_package_uninstall_action.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/depends_compat_resource.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/depends_partial_search.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/depends_poise.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_chefspec_platform.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_mixins.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_platform_methods.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_shellout_methods.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_windows_version_check.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_properties.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/easy_install.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/eol_audit_mode.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/epic_fail.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/erl_call.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/hwrp_without_provides.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/inherits_compat_resource.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/launchd_deprecated_hash_property.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/legacy_notify_syntax.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/legacy_yum_cookbook_recipes.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/locale_lc_all_property.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/log_resource_notifications.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/macos_userdefaults_global_property.rb +61 -0
- data/lib/rubocop/cop/chef/deprecation/name_property_and_default.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/node_deep_fetch.rb +8 -21
- data/lib/rubocop/cop/chef/deprecation/node_methods_not_attributes.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/node_set.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/node_set_unless.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/node_set_without_level.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/partial_search_class_usage.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/partial_search_helper_usage.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/poise_archive.rb +6 -3
- data/lib/rubocop/cop/chef/deprecation/powershell_cookbook_helpers.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/require_recipe.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/resource_overrides_provides_method.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/resource_uses_dsl_name_method.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/resource_uses_only_resource_name.rb +5 -4
- data/lib/rubocop/cop/chef/deprecation/resource_uses_provider_base_method.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/resource_uses_updated_method.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/ruby_27_keyword_argument_warnings.rb +3 -2
- data/lib/rubocop/cop/chef/deprecation/ruby_block_create_action.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/run_command_helper.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/search_uses_positional_parameters.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/use_inline_resources.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/user_supports_property.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/verify_property_file_expansion.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/windows_feature_servermanagercmd.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/windows_task_change_action.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/windows_version_helpers.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/xml_ruby_recipe.rb +2 -1
- data/lib/rubocop/cop/chef/deprecation/yum_dnf_compat_recipe.rb +2 -1
- data/lib/rubocop/cop/chef/effortless/berksfile.rb +2 -1
- data/lib/rubocop/cop/chef/effortless/data_bags.rb +2 -1
- data/lib/rubocop/cop/chef/effortless/node_environment.rb +3 -2
- data/lib/rubocop/cop/chef/effortless/node_policygroup.rb +2 -1
- data/lib/rubocop/cop/chef/effortless/node_roles.rb +5 -4
- data/lib/rubocop/cop/chef/effortless/search_for_environments_or_roles.rb +2 -1
- data/lib/rubocop/cop/chef/effortless/search_used.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/action_method_in_resource.rb +57 -0
- data/lib/rubocop/cop/chef/modernize/allowed_actions_initializer.rb +4 -3
- data/lib/rubocop/cop/chef/modernize/apt_default_recipe.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/berksfile_source.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/build_essential.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/chef_14_resources.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/chef_gem_nokogiri.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/compile_time_resources.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/conditional_using_test.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb +88 -0
- data/lib/rubocop/cop/chef/modernize/cron_manage_resource.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/databag_helpers.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/default_action_initializer.rb +5 -4
- data/lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/definitions.rb +3 -2
- data/lib/rubocop/cop/chef/modernize/depends_zypper_cookbook.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/dsl_include_in_resource.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/empty_resource_initialize.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/execute_apt_update.rb +3 -2
- data/lib/rubocop/cop/chef/modernize/execute_sc_exe.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/execute_sleep.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/execute_sysctl.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/execute_tzutil.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/foodcritic_comments.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/if_provides_default_action.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/includes_mixin_shellout.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/libarchive_file.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/macos_user_defaults.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/minitest_handler_usage.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/node_init_package.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/node_roles_include.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/ohai_default_recipe.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/openssl_rsa_key_resource.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/openssl_x509_resource.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/osx_config_profile_resource.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/powershell_expand_archive.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/powershell_guard_interpreter.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/powershell_install_package.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/powershell_install_windowsfeature.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/property_with_name_attribute.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/provides_initializer.rb +5 -4
- data/lib/rubocop/cop/chef/modernize/resource_name_initializer.rb +4 -3
- data/lib/rubocop/cop/chef/modernize/resource_set_or_return.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/resource_with_attributes.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/respond_to_compile_time.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/respond_to_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/respond_to_provides.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/respond_to_resource_name.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/sc_windows_resource.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/seven_zip_archive.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/shell_out_helper.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/shellouts_to_chocolatey.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/simplify_apt_ppa_setup.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/systctl_param_resource.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/unnecessary_mixlib_shellout_require.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/use_multipackage_installs.rb +4 -3
- data/lib/rubocop/cop/chef/modernize/use_require_relative.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/whyrun_supported_true.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/windows_default_recipe.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/windows_registry_uac.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/windows_zipfile.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/zipfile_resource.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/zypper_repo.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/apt_repository_distribution_default.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/apt_repository_notifies_apt_update.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/attribute_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/conflicts_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/custom_resource_with_allowed_actions.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/double_compile_time.rb +65 -0
- data/lib/rubocop/cop/chef/redundant/grouping_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/long_description_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/multiple_platform_checks.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/name_property_and_required.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/ohai_attribute_to_string.rb +5 -4
- data/lib/rubocop/cop/chef/redundant/property_splat_regex.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/property_with_default_and_required.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/provides_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/recipe_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/replaces_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/resource_with_nothing_action.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/sensitive_property_in_resource.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/string_property_with_nil_default.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/suggests_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/unnecessary_desired_state.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/unnecessary_name_property.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/use_create_if_missing.rb +2 -1
- data/lib/rubocop/cop/chef/sharing/default_maintainer_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/sharing/empty_metadata_field.rb +2 -1
- data/lib/rubocop/cop/chef/sharing/include_property_descriptions.rb +3 -2
- data/lib/rubocop/cop/chef/sharing/include_resource_descriptions.rb +3 -2
- data/lib/rubocop/cop/chef/sharing/include_resource_examples.rb +3 -2
- data/lib/rubocop/cop/chef/sharing/insecure_cookbook_url.rb +2 -1
- data/lib/rubocop/cop/chef/sharing/invalid_license_string.rb +2 -1
- data/lib/rubocop/cop/chef/style/attribute_keys.rb +2 -1
- data/lib/rubocop/cop/chef/style/chef_whaaat.rb +2 -1
- data/lib/rubocop/cop/chef/style/comment_sentence_spacing.rb +2 -1
- data/lib/rubocop/cop/chef/style/comments_copyright_format.rb +2 -1
- data/lib/rubocop/cop/chef/style/comments_default_copyright.rb +2 -1
- data/lib/rubocop/cop/chef/style/comments_format.rb +2 -1
- data/lib/rubocop/cop/chef/style/file_mode.rb +39 -19
- data/lib/rubocop/cop/chef/style/immediate_notification_timing.rb +2 -1
- data/lib/rubocop/cop/chef/style/include_recipe_with_parentheses.rb +2 -1
- data/lib/rubocop/cop/chef/style/negating_only_if.rb +2 -1
- data/lib/rubocop/cop/chef/style/overly_complex_supports_depends_metadata.rb +2 -1
- data/lib/rubocop/cop/chef/style/simplify_platform_major_version_check.rb +2 -1
- data/lib/rubocop/cop/chef/style/true_false_resource_properties.rb +2 -1
- data/lib/rubocop/cop/chef/style/unnecessary_os_check.rb +3 -3
- data/lib/rubocop/cop/chef/style/unnecessary_platform_case_statement.rb +3 -2
- data/lib/rubocop/cop/chef/style/use_platform_helpers.rb +3 -3
- data/lib/rubocop/monkey_patches/{cop.rb → base.rb} +2 -1
- data/lib/rubocop/monkey_patches/comment_config.rb +1 -0
- data/lib/rubocop/monkey_patches/registry_cop.rb +1 -0
- metadata +17 -6
data/config/upstream.yml
CHANGED
@@ -210,9 +210,10 @@ Gemspec/OrderedDependencies:
|
|
210
210
|
- '**/*.gemspec'
|
211
211
|
|
212
212
|
Gemspec/RequiredRubyVersion:
|
213
|
-
Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml
|
213
|
+
Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
|
214
214
|
Enabled: true
|
215
215
|
VersionAdded: '0.52'
|
216
|
+
VersionChanged: '0.89'
|
216
217
|
Include:
|
217
218
|
- '**/*.gemspec'
|
218
219
|
|
@@ -1234,7 +1235,7 @@ Layout/SpaceInsideBlockBraces:
|
|
1234
1235
|
|
1235
1236
|
Layout/SpaceInsideHashLiteralBraces:
|
1236
1237
|
Description: "Use spaces inside hash literal braces - or don't."
|
1237
|
-
StyleGuide: '#spaces-
|
1238
|
+
StyleGuide: '#spaces-braces'
|
1238
1239
|
Enabled: true
|
1239
1240
|
VersionAdded: '0.49'
|
1240
1241
|
EnforcedStyle: space
|
@@ -1355,6 +1356,12 @@ Lint/BigDecimalNew:
|
|
1355
1356
|
Enabled: true
|
1356
1357
|
VersionAdded: '0.53'
|
1357
1358
|
|
1359
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
1360
|
+
Description: 'This cop checks for places where binary operator has identical operands.'
|
1361
|
+
Enabled: pending
|
1362
|
+
Safe: false
|
1363
|
+
VersionAdded: '0.89'
|
1364
|
+
|
1358
1365
|
Lint/BooleanSymbol:
|
1359
1366
|
Description: 'Check for `:true` and `:false` symbols.'
|
1360
1367
|
Enabled: true
|
@@ -1397,12 +1404,18 @@ Lint/DisjunctiveAssignmentInConstructor:
|
|
1397
1404
|
Enabled: true
|
1398
1405
|
Safe: false
|
1399
1406
|
VersionAdded: '0.62'
|
1407
|
+
VersionChanged: '0.88'
|
1400
1408
|
|
1401
1409
|
Lint/DuplicateCaseCondition:
|
1402
1410
|
Description: 'Do not repeat values in case conditionals.'
|
1403
1411
|
Enabled: true
|
1404
1412
|
VersionAdded: '0.45'
|
1405
1413
|
|
1414
|
+
Lint/DuplicateElsifCondition:
|
1415
|
+
Description: 'Do not repeat conditions used in if `elsif`.'
|
1416
|
+
Enabled: 'pending'
|
1417
|
+
VersionAdded: '0.88'
|
1418
|
+
|
1406
1419
|
Lint/DuplicateHashKey:
|
1407
1420
|
Description: 'Check for duplicate keys in hash literals.'
|
1408
1421
|
Enabled: true
|
@@ -1414,6 +1427,11 @@ Lint/DuplicateMethods:
|
|
1414
1427
|
Enabled: true
|
1415
1428
|
VersionAdded: '0.29'
|
1416
1429
|
|
1430
|
+
Lint/DuplicateRescueException:
|
1431
|
+
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
1432
|
+
Enabled: pending
|
1433
|
+
VersionAdded: '0.89'
|
1434
|
+
|
1417
1435
|
Lint/EachWithObjectArgument:
|
1418
1436
|
Description: 'Check for immutable argument given to each_with_object.'
|
1419
1437
|
Enabled: true
|
@@ -1424,6 +1442,12 @@ Lint/ElseLayout:
|
|
1424
1442
|
Enabled: true
|
1425
1443
|
VersionAdded: '0.17'
|
1426
1444
|
|
1445
|
+
Lint/EmptyConditionalBody:
|
1446
|
+
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1447
|
+
Enabled: 'pending'
|
1448
|
+
AllowComments: true
|
1449
|
+
VersionAdded: '0.89'
|
1450
|
+
|
1427
1451
|
Lint/EmptyEnsure:
|
1428
1452
|
Description: 'Checks for empty ensure block.'
|
1429
1453
|
Enabled: true
|
@@ -1467,6 +1491,12 @@ Lint/FlipFlop:
|
|
1467
1491
|
Enabled: true
|
1468
1492
|
VersionAdded: '0.16'
|
1469
1493
|
|
1494
|
+
Lint/FloatComparison:
|
1495
|
+
Description: 'Checks for the presence of precise comparison of floating point numbers.'
|
1496
|
+
StyleGuide: '#float-comparison'
|
1497
|
+
Enabled: pending
|
1498
|
+
VersionAdded: '0.89'
|
1499
|
+
|
1470
1500
|
Lint/FloatOutOfRange:
|
1471
1501
|
Description: >-
|
1472
1502
|
Catches floating-point literals too large or small for Ruby to
|
@@ -1514,7 +1544,7 @@ Lint/InheritException:
|
|
1514
1544
|
Lint/InterpolationCheck:
|
1515
1545
|
Description: 'Raise warning for interpolation in single q strs.'
|
1516
1546
|
Enabled: true
|
1517
|
-
|
1547
|
+
Safe: false
|
1518
1548
|
VersionAdded: '0.50'
|
1519
1549
|
VersionChanged: '0.87'
|
1520
1550
|
|
@@ -1536,6 +1566,7 @@ Lint/Loop:
|
|
1536
1566
|
StyleGuide: '#loop-with-break'
|
1537
1567
|
Enabled: true
|
1538
1568
|
VersionAdded: '0.9'
|
1569
|
+
VersionChanged: '0.89'
|
1539
1570
|
|
1540
1571
|
Lint/MissingCopEnableDirective:
|
1541
1572
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
@@ -1550,6 +1581,13 @@ Lint/MissingCopEnableDirective:
|
|
1550
1581
|
# .inf for any size
|
1551
1582
|
MaximumRangeSize: .inf
|
1552
1583
|
|
1584
|
+
Lint/MissingSuper:
|
1585
|
+
Description: >-
|
1586
|
+
This cop checks for the presence of constructors and lifecycle callbacks
|
1587
|
+
without calls to `super`'.
|
1588
|
+
Enabled: pending
|
1589
|
+
VersionAdded: '0.89'
|
1590
|
+
|
1553
1591
|
Lint/MixedRegexpCaptureTypes:
|
1554
1592
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1555
1593
|
Enabled: pending
|
@@ -1602,6 +1640,12 @@ Lint/OrderedMagicComments:
|
|
1602
1640
|
Enabled: true
|
1603
1641
|
VersionAdded: '0.53'
|
1604
1642
|
|
1643
|
+
Lint/OutOfRangeRegexpRef:
|
1644
|
+
Description: 'Checks for out of range reference for Regexp because it always returns nil.'
|
1645
|
+
Enabled: pending
|
1646
|
+
Safe: false
|
1647
|
+
VersionAdded: '0.89'
|
1648
|
+
|
1605
1649
|
Lint/ParenthesesAsGroupedExpression:
|
1606
1650
|
Description: >-
|
1607
1651
|
Checks for method calls with a space before the opening
|
@@ -1752,6 +1796,11 @@ Lint/ScriptPermission:
|
|
1752
1796
|
VersionAdded: '0.49'
|
1753
1797
|
VersionChanged: '0.50'
|
1754
1798
|
|
1799
|
+
Lint/SelfAssignment:
|
1800
|
+
Description: 'Checks for self-assignments.'
|
1801
|
+
Enabled: pending
|
1802
|
+
VersionAdded: '0.89'
|
1803
|
+
|
1755
1804
|
Lint/SendWithMixinArgument:
|
1756
1805
|
Description: 'Checks for `send` method when using mixin.'
|
1757
1806
|
Enabled: true
|
@@ -1802,6 +1851,11 @@ Lint/ToJSON:
|
|
1802
1851
|
Enabled: true
|
1803
1852
|
VersionAdded: '0.66'
|
1804
1853
|
|
1854
|
+
Lint/TopLevelReturnWithArgument:
|
1855
|
+
Description: 'This cop detects top level return statements with argument.'
|
1856
|
+
Enabled: 'pending'
|
1857
|
+
VersionAdded: '0.89'
|
1858
|
+
|
1805
1859
|
Lint/UnderscorePrefixedVariableName:
|
1806
1860
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
1807
1861
|
Enabled: true
|
@@ -1818,6 +1872,11 @@ Lint/UnreachableCode:
|
|
1818
1872
|
Enabled: true
|
1819
1873
|
VersionAdded: '0.9'
|
1820
1874
|
|
1875
|
+
Lint/UnreachableLoop:
|
1876
|
+
Description: 'This cop checks for loops that will have at most one iteration.'
|
1877
|
+
Enabled: pending
|
1878
|
+
VersionAdded: '0.89'
|
1879
|
+
|
1821
1880
|
Lint/UnusedBlockArgument:
|
1822
1881
|
Description: 'Checks for unused block arguments.'
|
1823
1882
|
StyleGuide: '#underscore-unused-vars'
|
@@ -1867,11 +1926,6 @@ Lint/UselessAssignment:
|
|
1867
1926
|
Enabled: true
|
1868
1927
|
VersionAdded: '0.11'
|
1869
1928
|
|
1870
|
-
Lint/UselessComparison:
|
1871
|
-
Description: 'Checks for comparison of something with itself.'
|
1872
|
-
Enabled: true
|
1873
|
-
VersionAdded: '0.11'
|
1874
|
-
|
1875
1929
|
Lint/UselessElseWithoutRescue:
|
1876
1930
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
1877
1931
|
Enabled: true
|
@@ -1905,7 +1959,7 @@ Metrics/AbcSize:
|
|
1905
1959
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1906
1960
|
# a Float.
|
1907
1961
|
IgnoredMethods: []
|
1908
|
-
Max:
|
1962
|
+
Max: 17
|
1909
1963
|
|
1910
1964
|
Metrics/BlockLength:
|
1911
1965
|
Description: 'Avoid long blocks with many lines.'
|
@@ -1987,7 +2041,7 @@ Metrics/PerceivedComplexity:
|
|
1987
2041
|
VersionAdded: '0.25'
|
1988
2042
|
VersionChanged: '0.81'
|
1989
2043
|
IgnoredMethods: []
|
1990
|
-
Max:
|
2044
|
+
Max: 8
|
1991
2045
|
|
1992
2046
|
################## Migration #############################
|
1993
2047
|
|
@@ -2179,17 +2233,18 @@ Naming/MethodParameterName:
|
|
2179
2233
|
AllowNamesEndingInNumbers: true
|
2180
2234
|
# Allowed names that will not register an offense
|
2181
2235
|
AllowedNames:
|
2182
|
-
-
|
2183
|
-
- id
|
2184
|
-
- to
|
2236
|
+
- at
|
2185
2237
|
- by
|
2186
|
-
-
|
2238
|
+
- db
|
2239
|
+
- id
|
2187
2240
|
- in
|
2188
|
-
-
|
2241
|
+
- io
|
2189
2242
|
- ip
|
2190
|
-
-
|
2243
|
+
- of
|
2244
|
+
- 'on'
|
2191
2245
|
- os
|
2192
2246
|
- pp
|
2247
|
+
- to
|
2193
2248
|
# Forbidden names that will register an offense
|
2194
2249
|
ForbiddenNames: []
|
2195
2250
|
|
@@ -2340,6 +2395,15 @@ Style/AndOr:
|
|
2340
2395
|
- always
|
2341
2396
|
- conditionals
|
2342
2397
|
|
2398
|
+
Style/ArrayCoercion:
|
2399
|
+
Description: >-
|
2400
|
+
Use Array() instead of explicit Array check or [*var], when dealing
|
2401
|
+
with a variable you want to treat as an Array, but you're not certain it's an array.
|
2402
|
+
StyleGuide: '#array-coercion'
|
2403
|
+
Safe: false
|
2404
|
+
Enabled: 'pending'
|
2405
|
+
VersionAdded: '0.88'
|
2406
|
+
|
2343
2407
|
Style/ArrayJoin:
|
2344
2408
|
Description: 'Use Array#join instead of Array#*.'
|
2345
2409
|
StyleGuide: '#array-join'
|
@@ -2512,6 +2576,7 @@ Style/CaseEquality:
|
|
2512
2576
|
StyleGuide: '#no-case-equality'
|
2513
2577
|
Enabled: true
|
2514
2578
|
VersionAdded: '0.9'
|
2579
|
+
VersionChanged: '0.89'
|
2515
2580
|
# If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
|
2516
2581
|
# the case equality operator is a constant.
|
2517
2582
|
#
|
@@ -2522,6 +2587,12 @@ Style/CaseEquality:
|
|
2522
2587
|
# String === "string"
|
2523
2588
|
AllowOnConstant: false
|
2524
2589
|
|
2590
|
+
Style/CaseLikeIf:
|
2591
|
+
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2592
|
+
StyleGuide: '#case-vs-if-else'
|
2593
|
+
Enabled: 'pending'
|
2594
|
+
VersionAdded: '0.88'
|
2595
|
+
|
2525
2596
|
Style/CharacterLiteral:
|
2526
2597
|
Description: 'Checks for uses of character literals.'
|
2527
2598
|
StyleGuide: '#no-character-literals'
|
@@ -2859,6 +2930,16 @@ Style/ExpandPathArguments:
|
|
2859
2930
|
Enabled: true
|
2860
2931
|
VersionAdded: '0.53'
|
2861
2932
|
|
2933
|
+
Style/ExplicitBlockArgument:
|
2934
|
+
Description: >-
|
2935
|
+
Consider using explicit block argument to avoid writing block literal
|
2936
|
+
that just passes its arguments to another block.
|
2937
|
+
StyleGuide: '#block-argument'
|
2938
|
+
Enabled: pending
|
2939
|
+
# May change the yielding arity.
|
2940
|
+
Safe: false
|
2941
|
+
VersionAdded: '0.89'
|
2942
|
+
|
2862
2943
|
Style/ExponentialNotation:
|
2863
2944
|
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
2864
2945
|
StyleGuide: '#exponential-notation'
|
@@ -2942,6 +3023,12 @@ Style/FrozenStringLiteralComment:
|
|
2942
3023
|
- never
|
2943
3024
|
Safe: false
|
2944
3025
|
|
3026
|
+
Style/GlobalStdStream:
|
3027
|
+
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
3028
|
+
StyleGuide: '#global-stdout'
|
3029
|
+
Enabled: pending
|
3030
|
+
VersionAdded: '0.89'
|
3031
|
+
|
2945
3032
|
Style/GlobalVars:
|
2946
3033
|
Description: 'Do not introduce global variables.'
|
2947
3034
|
StyleGuide: '#instance-vars'
|
@@ -2961,6 +3048,18 @@ Style/GuardClause:
|
|
2961
3048
|
# needs to have to trigger this cop
|
2962
3049
|
MinBodyLength: 1
|
2963
3050
|
|
3051
|
+
Style/HashAsLastArrayItem:
|
3052
|
+
Description: >-
|
3053
|
+
Checks for presence or absence of braces around hash literal as a last
|
3054
|
+
array item depending on configuration.
|
3055
|
+
StyleGuide: '#hash-literal-as-last-array-item'
|
3056
|
+
Enabled: 'pending'
|
3057
|
+
VersionAdded: '0.88'
|
3058
|
+
EnforcedStyle: braces
|
3059
|
+
SupportedStyles:
|
3060
|
+
- braces
|
3061
|
+
- no_braces
|
3062
|
+
|
2964
3063
|
Style/HashEachMethods:
|
2965
3064
|
Description: 'Use Hash#each_key and Hash#each_value.'
|
2966
3065
|
StyleGuide: '#hash-each'
|
@@ -2968,6 +3067,16 @@ Style/HashEachMethods:
|
|
2968
3067
|
VersionAdded: '0.80'
|
2969
3068
|
Safe: false
|
2970
3069
|
|
3070
|
+
Style/HashLikeCase:
|
3071
|
+
Description: >-
|
3072
|
+
Checks for places where `case-when` represents a simple 1:1
|
3073
|
+
mapping and can be replaced with a hash lookup.
|
3074
|
+
Enabled: 'pending'
|
3075
|
+
VersionAdded: '0.88'
|
3076
|
+
# `MinBranchesCount` defines the number of branches `case` needs to have
|
3077
|
+
# to trigger this cop
|
3078
|
+
MinBranchesCount: 3
|
3079
|
+
|
2971
3080
|
Style/HashSyntax:
|
2972
3081
|
Description: >-
|
2973
3082
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -3175,12 +3284,6 @@ Style/MethodDefParentheses:
|
|
3175
3284
|
- require_no_parentheses
|
3176
3285
|
- require_no_parentheses_except_multiline
|
3177
3286
|
|
3178
|
-
Style/MethodMissingSuper:
|
3179
|
-
Description: Checks for `method_missing` to call `super`.
|
3180
|
-
StyleGuide: '#no-method-missing'
|
3181
|
-
Enabled: true
|
3182
|
-
VersionAdded: '0.56'
|
3183
|
-
|
3184
3287
|
Style/MinMax:
|
3185
3288
|
Description: >-
|
3186
3289
|
Use `Enumerable#minmax` instead of `Enumerable#min`
|
@@ -3522,6 +3625,13 @@ Style/OptionalArguments:
|
|
3522
3625
|
VersionAdded: '0.33'
|
3523
3626
|
VersionChanged: '0.83'
|
3524
3627
|
|
3628
|
+
Style/OptionalBooleanParameter:
|
3629
|
+
Description: 'Use keyword arguments when defining method with boolean argument.'
|
3630
|
+
StyleGuide: '#boolean-keyword-arguments'
|
3631
|
+
Enabled: pending
|
3632
|
+
Safe: false
|
3633
|
+
VersionAdded: '0.89'
|
3634
|
+
|
3525
3635
|
Style/OrAssignment:
|
3526
3636
|
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
3527
3637
|
StyleGuide: '#double-pipe-for-uninit'
|
@@ -3665,6 +3775,14 @@ Style/RedundantFetchBlock:
|
|
3665
3775
|
SafeForConstants: false
|
3666
3776
|
VersionAdded: '0.86'
|
3667
3777
|
|
3778
|
+
Style/RedundantFileExtensionInRequire:
|
3779
|
+
Description: >-
|
3780
|
+
Checks for the presence of superfluous `.rb` extension in
|
3781
|
+
the filename provided to `require` and `require_relative`.
|
3782
|
+
StyleGuide: '#no-explicit-rb-to-require'
|
3783
|
+
Enabled: 'pending'
|
3784
|
+
VersionAdded: '0.88'
|
3785
|
+
|
3668
3786
|
Style/RedundantFreeze:
|
3669
3787
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3670
3788
|
Enabled: true
|
@@ -3832,6 +3950,12 @@ Style/SignalException:
|
|
3832
3950
|
- only_fail
|
3833
3951
|
- semantic
|
3834
3952
|
|
3953
|
+
Style/SingleArgumentDig:
|
3954
|
+
Description: 'Avoid using single argument dig method.'
|
3955
|
+
Enabled: pending
|
3956
|
+
VersionAdded: '0.89'
|
3957
|
+
Safe: false
|
3958
|
+
|
3835
3959
|
Style/SingleLineBlockParams:
|
3836
3960
|
Description: 'Enforces the names of some block params.'
|
3837
3961
|
Enabled: false
|
@@ -3887,6 +4011,13 @@ Style/StderrPuts:
|
|
3887
4011
|
Enabled: true
|
3888
4012
|
VersionAdded: '0.51'
|
3889
4013
|
|
4014
|
+
Style/StringConcatenation:
|
4015
|
+
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4016
|
+
StyleGuide: '#string-interpolation'
|
4017
|
+
Enabled: pending
|
4018
|
+
Safe: false
|
4019
|
+
VersionAdded: '0.89'
|
4020
|
+
|
3890
4021
|
Style/StringHashKeys:
|
3891
4022
|
Description: 'Prefer symbols instead of strings as hash keys.'
|
3892
4023
|
StyleGuide: '#symbols-as-keys'
|
data/cookstyle.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'cookstyle/version'
|
@@ -10,6 +11,7 @@ Gem::Specification.new do |spec|
|
|
10
11
|
spec.email = ['thom@chef.io', 'tsmith@chef.io']
|
11
12
|
spec.summary = 'Cookstyle is a code linting tool that helps you to write better Chef Infra cookbooks by detecting and automatically correcting style, syntax, and logic mistakes in your code.'
|
12
13
|
spec.license = 'Apache-2.0'
|
14
|
+
spec.homepage = 'https://docs.chef.io/workstation/cookstyle/'
|
13
15
|
spec.required_ruby_version = '>= 2.4'
|
14
16
|
|
15
17
|
# the gemspec and Gemfile are necessary for appbundling of the gem
|
data/lib/cookstyle.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require_relative 'cookstyle/version'
|
2
3
|
|
3
|
-
require 'pathname'
|
4
|
-
require 'yaml'
|
4
|
+
require 'pathname' unless defined?(Pathname)
|
5
|
+
require 'yaml' unless defined?(YAML)
|
5
6
|
|
6
7
|
# ensure the desired target version of RuboCop is gem activated
|
7
8
|
gem 'rubocop', "= #{Cookstyle::RUBOCOP_VERSION}"
|
8
9
|
require 'rubocop'
|
9
|
-
|
10
|
+
require_relative 'rubocop/monkey_patches/comment_config.rb'
|
10
11
|
|
11
12
|
# monkey patches needed for the TargetChefVersion config option
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
require_relative 'rubocop/monkey_patches/config.rb'
|
14
|
+
require_relative 'rubocop/monkey_patches/base.rb'
|
15
|
+
require_relative 'rubocop/monkey_patches/team.rb'
|
16
|
+
require_relative 'rubocop/monkey_patches/registry_cop.rb'
|
16
17
|
|
17
18
|
module RuboCop
|
18
19
|
class ConfigLoader
|
data/lib/cookstyle/version.rb
CHANGED
data/lib/rubocop/chef.rb
CHANGED