cookstyle 6.8.0 → 6.13.3
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 +123 -2
- data/config/disable_all.yml +22 -0
- data/config/upstream.yml +132 -11
- data/cookstyle.gemspec +1 -0
- data/lib/cookstyle.rb +2 -0
- 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 +12 -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 +2 -1
- 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 +3 -2
- data/lib/rubocop/cop/chef/correctness/lazy_eval_node_attribute_defaults.rb +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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/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 +2 -1
- 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 +2 -1
- 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 +2 -1
- data/lib/rubocop/cop/chef/effortless/node_policygroup.rb +2 -1
- data/lib/rubocop/cop/chef/effortless/node_roles.rb +2 -1
- 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 +2 -1
- 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 +57 -0
- 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 +2 -1
- data/lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb +2 -1
- data/lib/rubocop/cop/chef/modernize/definitions.rb +2 -1
- 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 +18 -9
- 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 +2 -1
- data/lib/rubocop/cop/chef/modernize/resource_name_initializer.rb +2 -1
- 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 +2 -1
- 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 +61 -0
- data/lib/rubocop/cop/chef/redundant/name_property_and_required.rb +2 -1
- data/lib/rubocop/cop/chef/redundant/ohai_attribute_to_string.rb +69 -0
- 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 +2 -1
- data/lib/rubocop/cop/chef/sharing/include_resource_descriptions.rb +2 -1
- data/lib/rubocop/cop/chef/sharing/include_resource_examples.rb +60 -0
- data/lib/rubocop/cop/chef/sharing/insecure_cookbook_url.rb +2 -1
- data/lib/rubocop/cop/chef/sharing/invalid_license_string.rb +3 -2
- 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 +2 -1
- data/lib/rubocop/cop/chef/style/immediate_notification_timing.rb +2 -1
- data/lib/rubocop/cop/chef/style/include_recipe_with_parentheses.rb +58 -0
- 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 +2 -1
- data/lib/rubocop/cop/chef/style/use_platform_helpers.rb +3 -3
- data/lib/rubocop/monkey_patches/comment_config.rb +1 -0
- data/lib/rubocop/monkey_patches/cop.rb +1 -0
- data/lib/rubocop/monkey_patches/registry_cop.rb +15 -0
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddf96e2cc00a4c499396b6cb2b54297e64d0605edd2dba615fb28ecd0bcb91a9
|
4
|
+
data.tar.gz: 2ec5752d4202b2b7567f808346672b4a80c59967a8ebeed20fe354f0911236bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f5e75f32ca428f5b4395a3f42a50a37675e21dc79e89d4b7b1d731328c28e2cd1dfd116667c0c8c9b0887bfd1ca647901ecd6895c56e82bac5f4e9939c84e54
|
7
|
+
data.tar.gz: 6aa192abcf88b35034474eac2ebcfecd8c154e2f28e08f0995a53bb4e998e8a4af7f1e246a1f7fced0979bbd2bddd1bdd96bbde6c046fdc92299cede2b012742
|
data/Gemfile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
source 'https://rubygems.org'
|
2
3
|
|
3
4
|
# Specify your gem's dependencies in cookstyle.gemspec
|
@@ -15,6 +16,11 @@ group :docs do
|
|
15
16
|
gem 'yard'
|
16
17
|
end
|
17
18
|
|
19
|
+
group :profiling do
|
20
|
+
gem 'stackprof'
|
21
|
+
gem 'memory_profiler'
|
22
|
+
end
|
23
|
+
|
18
24
|
group :development do
|
19
25
|
gem 'adamantium'
|
20
26
|
gem 'anima'
|
data/bin/cookstyle
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
if ARGV.include?('-h') || ARGV.include?('--help')
|
5
|
+
puts 'Usage: same as main `cookstyle` command but gathers profiling info'
|
6
|
+
puts 'Additional option: `--memory` to print memory usage'
|
7
|
+
exit(0)
|
8
|
+
end
|
9
|
+
with_mem = ARGV.delete('--memory')
|
10
|
+
|
11
|
+
require 'stackprof'
|
12
|
+
if with_mem
|
13
|
+
require 'memory_profiler'
|
14
|
+
MemoryProfiler.start
|
15
|
+
end
|
16
|
+
StackProf.start
|
17
|
+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
18
|
+
begin
|
19
|
+
load "#{__dir__}/cookstyle"
|
20
|
+
ensure
|
21
|
+
delta = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
|
22
|
+
puts "Finished in #{delta.round(1)} seconds"
|
23
|
+
StackProf.stop
|
24
|
+
if with_mem
|
25
|
+
puts 'Building memory report...'
|
26
|
+
report = MemoryProfiler.stop
|
27
|
+
end
|
28
|
+
Dir.mkdir('tmp') unless File.exist?('tmp')
|
29
|
+
StackProf.results('tmp/stackprof.dump')
|
30
|
+
report&.pretty_print(scale_bytes: true)
|
31
|
+
end
|
data/config/cookstyle.yml
CHANGED
@@ -161,6 +161,16 @@ ChefStyle/NegatingOnlyIf:
|
|
161
161
|
- '**/metadata.rb'
|
162
162
|
- '**/Berksfile'
|
163
163
|
|
164
|
+
ChefStyle/IncludeRecipeWithParentheses:
|
165
|
+
Description: There is no need to wrap the recipe in parentheses when using the include_recipe helper
|
166
|
+
StyleGuide: '#includerecipewithparentheses'
|
167
|
+
VersionAdded: '6.11.0'
|
168
|
+
Enabled: true
|
169
|
+
Exclude:
|
170
|
+
- '**/attributes/*.rb'
|
171
|
+
- '**/metadata.rb'
|
172
|
+
- '**/Berksfile'
|
173
|
+
|
164
174
|
###############################
|
165
175
|
# ChefCorrectness: Avoiding potential problems
|
166
176
|
###############################
|
@@ -300,8 +310,9 @@ ChefCorrectness/IncorrectLibraryInjection:
|
|
300
310
|
StyleGuide: '#chefcorrectnessincorrectlibraryinjection'
|
301
311
|
Enabled: true
|
302
312
|
VersionAdded: '5.10.0'
|
303
|
-
|
304
|
-
- '**/
|
313
|
+
Exclude:
|
314
|
+
- '**/metadata.rb'
|
315
|
+
- '**/Berksfile'
|
305
316
|
|
306
317
|
ChefCorrectness/InvalidPlatformHelper:
|
307
318
|
Description: Pass valid platforms to the platform? helper.
|
@@ -443,6 +454,23 @@ ChefCorrectness/InvalidPlatformInCase:
|
|
443
454
|
- '**/metadata.rb'
|
444
455
|
- '**/Berksfile'
|
445
456
|
|
457
|
+
ChefCorrectness/InvalidDefaultAction:
|
458
|
+
Description: Default actions in resources should be a symbol or an array of symbols.
|
459
|
+
StyleGuide: '#chefcorrectnessinvaliddefaultaction'
|
460
|
+
Enabled: true
|
461
|
+
VersionAdded: '6.13.0'
|
462
|
+
Include:
|
463
|
+
- '**/libraries/*.rb'
|
464
|
+
- '**/resources/*.rb'
|
465
|
+
|
466
|
+
ChefCorrectness/SupportsMustBeFloat:
|
467
|
+
Description: Versions used in metadata.rb supports calls should be floats not integers.
|
468
|
+
StyleGuide: '#chefcorrectnesssupportsmustbefloat'
|
469
|
+
Enabled: true
|
470
|
+
VersionAdded: '6.13.0'
|
471
|
+
Include:
|
472
|
+
- '**/metadata.rb'
|
473
|
+
|
446
474
|
###############################
|
447
475
|
# ChefSharing: Issues that prevent sharing code with other teams or with the Chef community in general
|
448
476
|
###############################
|
@@ -503,6 +531,14 @@ ChefSharing/IncludeResourceDescriptions:
|
|
503
531
|
Include:
|
504
532
|
- '**/resources/*.rb'
|
505
533
|
|
534
|
+
ChefSharing/IncludeResourceExamples:
|
535
|
+
Description: Resources should include examples field to allow automated documention. Requires Chef Infra Client 13.9 or later.
|
536
|
+
StyleGuide: '#chefsharingincluderesourceexamples'
|
537
|
+
Enabled: false
|
538
|
+
VersionAdded: '6.10.0'
|
539
|
+
Include:
|
540
|
+
- '**/resources/*.rb'
|
541
|
+
|
506
542
|
###############################
|
507
543
|
# ChefDeprecations: Resolving Deprecations that block upgrading Chef Infra Client
|
508
544
|
###############################
|
@@ -1001,6 +1037,33 @@ ChefDeprecations/ResourceUsesOnlyResourceName:
|
|
1001
1037
|
- '**/libraries/*.rb'
|
1002
1038
|
- '**/resources/*.rb'
|
1003
1039
|
|
1040
|
+
ChefDeprecations/ChefDKGenerators:
|
1041
|
+
Description: Chef Workstation 0.8 and later renamed the ChefDK module used when writing custom cookbook generators from ChefDK to ChefCLI. For compatibility with the latest Chef Workstation releases you'll need to reference the new class names.
|
1042
|
+
StyleGuide: '#chefdkgenerators'
|
1043
|
+
Enabled: true
|
1044
|
+
VersionAdded: '6.12.0'
|
1045
|
+
Exclude:
|
1046
|
+
- '**/metadata.rb'
|
1047
|
+
- '**/Berksfile'
|
1048
|
+
|
1049
|
+
ChefDeprecations/ChefHandlerRecipe:
|
1050
|
+
Description: There is no need to include the empty and deprecated chef_handler::default recipe in order to use the chef_handler resource.
|
1051
|
+
StyleGuide: '#chefhandlerrecipe'
|
1052
|
+
Enabled: true
|
1053
|
+
VersionAdded: '6.12.0'
|
1054
|
+
Exclude:
|
1055
|
+
- '**/metadata.rb'
|
1056
|
+
- '**/Berksfile'
|
1057
|
+
|
1058
|
+
ChefDeprecations/UseAutomaticResourceName:
|
1059
|
+
Description: The use_automatic_resource_name method was removed in Chef Infra Client 16. The resource name/provides should be set explicitly instead.
|
1060
|
+
StyleGuide: '#useautomaticresourcename'
|
1061
|
+
Enabled: true
|
1062
|
+
VersionAdded: '6.12.0'
|
1063
|
+
Include:
|
1064
|
+
- '**/libraries/*.rb'
|
1065
|
+
- '**/resources/*.rb'
|
1066
|
+
|
1004
1067
|
###############################
|
1005
1068
|
# ChefModernize: Cleaning up legacy code and using new built-in resources
|
1006
1069
|
###############################
|
@@ -1533,6 +1596,36 @@ ChefModernize/ShellOutHelper:
|
|
1533
1596
|
- '**/Berksfile'
|
1534
1597
|
- '**/libraries/*.rb'
|
1535
1598
|
|
1599
|
+
ChefModernize/ConditionalUsingTest:
|
1600
|
+
Description: Use ::File.exist?('/foo/bar') instead of the slower 'test -f /foo/bar' which requires shelling out.
|
1601
|
+
StyleGuide: '#chefmodernizeconditionalusingtest'
|
1602
|
+
Enabled: true
|
1603
|
+
VersionAdded: '6.11.0'
|
1604
|
+
Exclude:
|
1605
|
+
- '**/metadata.rb'
|
1606
|
+
- '**/Berksfile'
|
1607
|
+
- '**/attributes/*.rb'
|
1608
|
+
|
1609
|
+
ChefModernize/CronDFileOrTemplate:
|
1610
|
+
Description: Use the cron_d resource that ships with Chef Infra Client 14.4+ instead of manually creating the file with template, file, or cookbook_file resources
|
1611
|
+
StyleGuide: '#chefmodernizecrondfileortemplate'
|
1612
|
+
Enabled: true
|
1613
|
+
VersionAdded: '6.13.0'
|
1614
|
+
Exclude:
|
1615
|
+
- '**/metadata.rb'
|
1616
|
+
- '**/Berksfile'
|
1617
|
+
- '**/attributes/*.rb'
|
1618
|
+
|
1619
|
+
ChefModernize/ActionMethodInResource:
|
1620
|
+
Description: Use the custom resource language's `action :my_action` blocks instead of creating actions with methods.
|
1621
|
+
StyleGuide: '#chefmodernizeactionmethodinresource'
|
1622
|
+
Enabled: true
|
1623
|
+
VersionAdded: '6.13.0'
|
1624
|
+
Include:
|
1625
|
+
- '**/resources/*.rb'
|
1626
|
+
- '**/providers/*.rb'
|
1627
|
+
- '**/libraries/*.rb'
|
1628
|
+
|
1536
1629
|
###############################
|
1537
1630
|
# ChefRedundantCode: Cleanup unnecessary code in your cookbooks regardless of Chef Infra Client release
|
1538
1631
|
###############################
|
@@ -1727,6 +1820,34 @@ ChefRedundantCode/UseCreateIfMissing:
|
|
1727
1820
|
- '**/attributes/*.rb'
|
1728
1821
|
- '**/Berksfile'
|
1729
1822
|
|
1823
|
+
ChefRedundantCode/OhaiAttributeToString:
|
1824
|
+
Description: Many Ohai node attributes are already strings and don't need to be cast to strings again
|
1825
|
+
StyleGuide: '#chefredundantcodeohaiattributetostring'
|
1826
|
+
Enabled: true
|
1827
|
+
VersionAdded: '6.10.0'
|
1828
|
+
Exclude:
|
1829
|
+
- '**/metadata.rb'
|
1830
|
+
- '**/Berksfile'
|
1831
|
+
|
1832
|
+
ChefRedundantCode/MultiplePlatformChecks:
|
1833
|
+
Description: You can pass multiple values to the platform? and platform_family? helpers instead of calling the helpers multiple times.
|
1834
|
+
StyleGuide: '#chefredundantcodemultipleplatformchecks'
|
1835
|
+
Enabled: true
|
1836
|
+
VersionAdded: '6.10.0'
|
1837
|
+
Exclude:
|
1838
|
+
- '**/metadata.rb'
|
1839
|
+
- '**/Berksfile'
|
1840
|
+
|
1841
|
+
ChefRedundantCode/DoubleCompileTime:
|
1842
|
+
Description: If a resource includes the `compile_time` property there's no need to also use `.run_action(:some_action)` on the resource block
|
1843
|
+
StyleGuide: '#chefredundantcodedoublecompiletime'
|
1844
|
+
Enabled: true
|
1845
|
+
VersionAdded: '6.13.0'
|
1846
|
+
Exclude:
|
1847
|
+
- '**/metadata.rb'
|
1848
|
+
- '**/attributes/*.rb'
|
1849
|
+
- '**/Berksfile'
|
1850
|
+
|
1730
1851
|
###############################
|
1731
1852
|
# ChefEffortless: Migrating to new patterns
|
1732
1853
|
###############################
|
data/config/disable_all.yml
CHANGED
@@ -211,6 +211,8 @@ Lint/BooleanSymbol:
|
|
211
211
|
Enabled: false
|
212
212
|
Lint/CircularArgumentReference:
|
213
213
|
Enabled: false
|
214
|
+
Lint/ConstantResolution:
|
215
|
+
Enabled: false
|
214
216
|
Lint/Debugger:
|
215
217
|
Enabled: false
|
216
218
|
Lint/DeprecatedClassMethods:
|
@@ -221,6 +223,8 @@ Lint/DisjunctiveAssignmentInConstructor:
|
|
221
223
|
Enabled: false
|
222
224
|
Lint/DuplicateCaseCondition:
|
223
225
|
Enabled: false
|
226
|
+
Lint/DuplicateElsifCondition:
|
227
|
+
Enabled: false
|
224
228
|
Lint/DuplicateHashKey:
|
225
229
|
Enabled: false
|
226
230
|
Lint/DuplicateMethods:
|
@@ -419,10 +423,14 @@ Naming/VariableNumber:
|
|
419
423
|
Enabled: false
|
420
424
|
Style/AccessModifierDeclarations:
|
421
425
|
Enabled: false
|
426
|
+
Style/AccessorGrouping:
|
427
|
+
Enabled: false
|
422
428
|
Style/Alias:
|
423
429
|
Enabled: false
|
424
430
|
Style/AndOr:
|
425
431
|
Enabled: false
|
432
|
+
Style/ArrayCoercion:
|
433
|
+
Enabled: false
|
426
434
|
Style/ArrayJoin:
|
427
435
|
Enabled: false
|
428
436
|
Style/AsciiComments:
|
@@ -435,12 +443,16 @@ Style/BarePercentLiterals:
|
|
435
443
|
Enabled: false
|
436
444
|
Style/BeginBlock:
|
437
445
|
Enabled: false
|
446
|
+
Style/BisectedAttrAccessor:
|
447
|
+
Enabled: false
|
438
448
|
Style/BlockComments:
|
439
449
|
Enabled: false
|
440
450
|
Style/BlockDelimiters:
|
441
451
|
Enabled: false
|
442
452
|
Style/CaseEquality:
|
443
453
|
Enabled: false
|
454
|
+
Style/CaseLikeIf:
|
455
|
+
Enabled: false
|
444
456
|
Style/CharacterLiteral:
|
445
457
|
Enabled: false
|
446
458
|
Style/ClassAndModuleChildren:
|
@@ -527,8 +539,12 @@ Style/GlobalVars:
|
|
527
539
|
Enabled: false
|
528
540
|
Style/GuardClause:
|
529
541
|
Enabled: false
|
542
|
+
Style/HashAsLastArrayItem:
|
543
|
+
Enabled: false
|
530
544
|
Style/HashEachMethods:
|
531
545
|
Enabled: false
|
546
|
+
Style/HashLikeCase:
|
547
|
+
Enabled: false
|
532
548
|
Style/HashSyntax:
|
533
549
|
Enabled: false
|
534
550
|
Style/HashTransformKeys:
|
@@ -565,6 +581,12 @@ Style/MethodCallWithoutArgsParentheses:
|
|
565
581
|
Enabled: false
|
566
582
|
Style/MethodCallWithArgsParentheses:
|
567
583
|
Enabled: false
|
584
|
+
Style/RedundantAssignment:
|
585
|
+
Enabled: false
|
586
|
+
Style/RedundantFetchBlock:
|
587
|
+
Enabled: false
|
588
|
+
Style/RedundantFileExtensionInRequire:
|
589
|
+
Enabled: false
|
568
590
|
Style/MethodCalledOnDoEndBlock:
|
569
591
|
Enabled: false
|
570
592
|
Style/MethodDefParentheses:
|
data/config/upstream.yml
CHANGED
@@ -180,6 +180,9 @@ Bundler/OrderedGems:
|
|
180
180
|
VersionAdded: '0.46'
|
181
181
|
VersionChanged: '0.47'
|
182
182
|
TreatCommentsAsGroupSeparators: true
|
183
|
+
# By default, "-" and "_" are ignored for order purposes.
|
184
|
+
# This can be overridden by setting this parameter to true.
|
185
|
+
ConsiderPunctuation: false
|
183
186
|
Include:
|
184
187
|
- '**/*.gemfile'
|
185
188
|
- '**/Gemfile'
|
@@ -200,6 +203,9 @@ Gemspec/OrderedDependencies:
|
|
200
203
|
Enabled: true
|
201
204
|
VersionAdded: '0.51'
|
202
205
|
TreatCommentsAsGroupSeparators: true
|
206
|
+
# By default, "-" and "_" are ignored for order purposes.
|
207
|
+
# This can be overridden by setting this parameter to true.
|
208
|
+
ConsiderPunctuation: false
|
203
209
|
Include:
|
204
210
|
- '**/*.gemspec'
|
205
211
|
|
@@ -1361,6 +1367,15 @@ Lint/CircularArgumentReference:
|
|
1361
1367
|
Enabled: true
|
1362
1368
|
VersionAdded: '0.33'
|
1363
1369
|
|
1370
|
+
Lint/ConstantResolution:
|
1371
|
+
Description: 'Check that constants are fully qualified with `::`.'
|
1372
|
+
Enabled: false
|
1373
|
+
VersionAdded: '0.86'
|
1374
|
+
# Restrict this cop to only looking at certain names
|
1375
|
+
Only: []
|
1376
|
+
# Restrict this cop from only looking at certain names
|
1377
|
+
Ignore: []
|
1378
|
+
|
1364
1379
|
Lint/Debugger:
|
1365
1380
|
Description: 'Check for debugger calls.'
|
1366
1381
|
Enabled: true
|
@@ -1382,12 +1397,18 @@ Lint/DisjunctiveAssignmentInConstructor:
|
|
1382
1397
|
Enabled: true
|
1383
1398
|
Safe: false
|
1384
1399
|
VersionAdded: '0.62'
|
1400
|
+
VersionChanged: '0.88'
|
1385
1401
|
|
1386
1402
|
Lint/DuplicateCaseCondition:
|
1387
1403
|
Description: 'Do not repeat values in case conditionals.'
|
1388
1404
|
Enabled: true
|
1389
1405
|
VersionAdded: '0.45'
|
1390
1406
|
|
1407
|
+
Lint/DuplicateElsifCondition:
|
1408
|
+
Description: 'Do not repeat conditions used in if `elsif`.'
|
1409
|
+
Enabled: 'pending'
|
1410
|
+
VersionAdded: '0.88'
|
1411
|
+
|
1391
1412
|
Lint/DuplicateHashKey:
|
1392
1413
|
Description: 'Check for duplicate keys in hash literals.'
|
1393
1414
|
Enabled: true
|
@@ -1499,7 +1520,9 @@ Lint/InheritException:
|
|
1499
1520
|
Lint/InterpolationCheck:
|
1500
1521
|
Description: 'Raise warning for interpolation in single q strs.'
|
1501
1522
|
Enabled: true
|
1523
|
+
SafeAutoCorrect: false
|
1502
1524
|
VersionAdded: '0.50'
|
1525
|
+
VersionChanged: '0.87'
|
1503
1526
|
|
1504
1527
|
Lint/LiteralAsCondition:
|
1505
1528
|
Description: 'Checks of literals used in conditions.'
|
@@ -1611,7 +1634,9 @@ Lint/RaiseException:
|
|
1611
1634
|
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
|
1612
1635
|
StyleGuide: '#raise-exception'
|
1613
1636
|
Enabled: pending
|
1637
|
+
Safe: false
|
1614
1638
|
VersionAdded: '0.81'
|
1639
|
+
VersionChanged: '0.86'
|
1615
1640
|
AllowedImplicitNamespaces:
|
1616
1641
|
- 'Gem'
|
1617
1642
|
|
@@ -1668,6 +1693,7 @@ Lint/RegexpAsCondition:
|
|
1668
1693
|
The regexp literal matches `$_` implicitly.
|
1669
1694
|
Enabled: true
|
1670
1695
|
VersionAdded: '0.51'
|
1696
|
+
VersionChanged: '0.86'
|
1671
1697
|
|
1672
1698
|
Lint/RequireParentheses:
|
1673
1699
|
Description: >-
|
@@ -1724,6 +1750,7 @@ Lint/SafeNavigationWithEmpty:
|
|
1724
1750
|
Description: 'Avoid `foo&.empty?` in conditionals.'
|
1725
1751
|
Enabled: true
|
1726
1752
|
VersionAdded: '0.62'
|
1753
|
+
VersionChanged: '0.87'
|
1727
1754
|
|
1728
1755
|
Lint/ScriptPermission:
|
1729
1756
|
Description: 'Grant script file execute permission.'
|
@@ -1890,9 +1917,10 @@ Metrics/BlockLength:
|
|
1890
1917
|
Description: 'Avoid long blocks with many lines.'
|
1891
1918
|
Enabled: true
|
1892
1919
|
VersionAdded: '0.44'
|
1893
|
-
VersionChanged: '0.
|
1920
|
+
VersionChanged: '0.87'
|
1894
1921
|
CountComments: false # count full line comments?
|
1895
1922
|
Max: 25
|
1923
|
+
CountAsOne: []
|
1896
1924
|
ExcludedMethods:
|
1897
1925
|
# By default, exclude the `#refine` method, as it tends to have larger
|
1898
1926
|
# associated blocks.
|
@@ -1913,8 +1941,10 @@ Metrics/ClassLength:
|
|
1913
1941
|
Description: 'Avoid classes longer than 100 lines of code.'
|
1914
1942
|
Enabled: true
|
1915
1943
|
VersionAdded: '0.25'
|
1944
|
+
VersionChanged: '0.87'
|
1916
1945
|
CountComments: false # count full line comments?
|
1917
1946
|
Max: 100
|
1947
|
+
CountAsOne: []
|
1918
1948
|
|
1919
1949
|
# Avoid complex methods.
|
1920
1950
|
Metrics/CyclomaticComplexity:
|
@@ -1925,24 +1955,27 @@ Metrics/CyclomaticComplexity:
|
|
1925
1955
|
VersionAdded: '0.25'
|
1926
1956
|
VersionChanged: '0.81'
|
1927
1957
|
IgnoredMethods: []
|
1928
|
-
Max:
|
1958
|
+
Max: 7
|
1929
1959
|
|
1930
1960
|
Metrics/MethodLength:
|
1931
1961
|
Description: 'Avoid methods longer than 10 lines of code.'
|
1932
1962
|
StyleGuide: '#short-methods'
|
1933
1963
|
Enabled: true
|
1934
1964
|
VersionAdded: '0.25'
|
1935
|
-
VersionChanged: '0.
|
1965
|
+
VersionChanged: '0.87'
|
1936
1966
|
CountComments: false # count full line comments?
|
1937
1967
|
Max: 10
|
1968
|
+
CountAsOne: []
|
1938
1969
|
ExcludedMethods: []
|
1939
1970
|
|
1940
1971
|
Metrics/ModuleLength:
|
1941
1972
|
Description: 'Avoid modules longer than 100 lines of code.'
|
1942
1973
|
Enabled: true
|
1943
1974
|
VersionAdded: '0.31'
|
1975
|
+
VersionChanged: '0.87'
|
1944
1976
|
CountComments: false # count full line comments?
|
1945
1977
|
Max: 100
|
1978
|
+
CountAsOne: []
|
1946
1979
|
|
1947
1980
|
Metrics/ParameterLists:
|
1948
1981
|
Description: 'Avoid parameter lists longer than three or four parameters.'
|
@@ -1980,10 +2013,12 @@ Naming/AccessorMethodName:
|
|
1980
2013
|
VersionAdded: '0.50'
|
1981
2014
|
|
1982
2015
|
Naming/AsciiIdentifiers:
|
1983
|
-
Description: 'Use only ascii symbols in identifiers.'
|
2016
|
+
Description: 'Use only ascii symbols in identifiers and constants.'
|
1984
2017
|
StyleGuide: '#english-identifiers'
|
1985
2018
|
Enabled: true
|
1986
2019
|
VersionAdded: '0.50'
|
2020
|
+
VersionChanged: '0.87'
|
2021
|
+
AsciiConstants: true
|
1987
2022
|
|
1988
2023
|
Naming/BinaryOperatorParameterName:
|
1989
2024
|
Description: 'When defining binary operators, name the argument other.'
|
@@ -2150,17 +2185,18 @@ Naming/MethodParameterName:
|
|
2150
2185
|
AllowNamesEndingInNumbers: true
|
2151
2186
|
# Allowed names that will not register an offense
|
2152
2187
|
AllowedNames:
|
2153
|
-
-
|
2154
|
-
- id
|
2155
|
-
- to
|
2188
|
+
- at
|
2156
2189
|
- by
|
2157
|
-
-
|
2190
|
+
- db
|
2191
|
+
- id
|
2158
2192
|
- in
|
2159
|
-
-
|
2193
|
+
- io
|
2160
2194
|
- ip
|
2161
|
-
-
|
2195
|
+
- of
|
2196
|
+
- 'on'
|
2162
2197
|
- os
|
2163
2198
|
- pp
|
2199
|
+
- to
|
2164
2200
|
# Forbidden names that will register an offense
|
2165
2201
|
ForbiddenNames: []
|
2166
2202
|
|
@@ -2276,6 +2312,17 @@ Style/AccessModifierDeclarations:
|
|
2276
2312
|
- group
|
2277
2313
|
AllowModifiersOnSymbols: true
|
2278
2314
|
|
2315
|
+
Style/AccessorGrouping:
|
2316
|
+
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
2317
|
+
Enabled: 'pending'
|
2318
|
+
VersionAdded: '0.87'
|
2319
|
+
EnforcedStyle: grouped
|
2320
|
+
SupportedStyles:
|
2321
|
+
# separated: each accessor goes in a separate statement.
|
2322
|
+
# grouped: accessors are grouped into a single statement.
|
2323
|
+
- separated
|
2324
|
+
- grouped
|
2325
|
+
|
2279
2326
|
Style/Alias:
|
2280
2327
|
Description: 'Use alias instead of alias_method.'
|
2281
2328
|
StyleGuide: '#alias-method-lexically'
|
@@ -2300,6 +2347,14 @@ Style/AndOr:
|
|
2300
2347
|
- always
|
2301
2348
|
- conditionals
|
2302
2349
|
|
2350
|
+
Style/ArrayCoercion:
|
2351
|
+
Description: >-
|
2352
|
+
Use Array() instead of explicit Array check or [*var], when dealing
|
2353
|
+
with a variable you want to treat as an Array, but you're not certain it's an array.
|
2354
|
+
StyleGuide: '#array-coercion'
|
2355
|
+
Enabled: 'pending'
|
2356
|
+
VersionAdded: '0.88'
|
2357
|
+
|
2303
2358
|
Style/ArrayJoin:
|
2304
2359
|
Description: 'Use Array#join instead of Array#*.'
|
2305
2360
|
StyleGuide: '#array-join'
|
@@ -2343,6 +2398,13 @@ Style/BeginBlock:
|
|
2343
2398
|
Enabled: true
|
2344
2399
|
VersionAdded: '0.9'
|
2345
2400
|
|
2401
|
+
Style/BisectedAttrAccessor:
|
2402
|
+
Description: >-
|
2403
|
+
Checks for places where `attr_reader` and `attr_writer`
|
2404
|
+
for the same method can be combined into single `attr_accessor`.
|
2405
|
+
Enabled: 'pending'
|
2406
|
+
VersionAdded: '0.87'
|
2407
|
+
|
2346
2408
|
Style/BlockComments:
|
2347
2409
|
Description: 'Do not use block comments.'
|
2348
2410
|
StyleGuide: '#no-block-comments'
|
@@ -2475,6 +2537,12 @@ Style/CaseEquality:
|
|
2475
2537
|
# String === "string"
|
2476
2538
|
AllowOnConstant: false
|
2477
2539
|
|
2540
|
+
Style/CaseLikeIf:
|
2541
|
+
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2542
|
+
StyleGuide: '#case-vs-if-else'
|
2543
|
+
Enabled: 'pending'
|
2544
|
+
VersionAdded: '0.88'
|
2545
|
+
|
2478
2546
|
Style/CharacterLiteral:
|
2479
2547
|
Description: 'Checks for uses of character literals.'
|
2480
2548
|
StyleGuide: '#no-character-literals'
|
@@ -2717,6 +2785,7 @@ Style/DoubleNegation:
|
|
2717
2785
|
VersionAdded: '0.19'
|
2718
2786
|
VersionChanged: '0.84'
|
2719
2787
|
EnforcedStyle: allowed_in_returns
|
2788
|
+
SafeAutoCorrect: false
|
2720
2789
|
SupportedStyles:
|
2721
2790
|
- allowed_in_returns
|
2722
2791
|
- forbidden
|
@@ -2913,6 +2982,18 @@ Style/GuardClause:
|
|
2913
2982
|
# needs to have to trigger this cop
|
2914
2983
|
MinBodyLength: 1
|
2915
2984
|
|
2985
|
+
Style/HashAsLastArrayItem:
|
2986
|
+
Description: >-
|
2987
|
+
Checks for presence or absence of braces around hash literal as a last
|
2988
|
+
array item depending on configuration.
|
2989
|
+
StyleGuide: '#hash-literal-as-last-array-item'
|
2990
|
+
Enabled: 'pending'
|
2991
|
+
VersionAdded: '0.88'
|
2992
|
+
EnforcedStyle: braces
|
2993
|
+
SupportedStyles:
|
2994
|
+
- braces
|
2995
|
+
- no_braces
|
2996
|
+
|
2916
2997
|
Style/HashEachMethods:
|
2917
2998
|
Description: 'Use Hash#each_key and Hash#each_value.'
|
2918
2999
|
StyleGuide: '#hash-each'
|
@@ -2920,6 +3001,16 @@ Style/HashEachMethods:
|
|
2920
3001
|
VersionAdded: '0.80'
|
2921
3002
|
Safe: false
|
2922
3003
|
|
3004
|
+
Style/HashLikeCase:
|
3005
|
+
Description: >-
|
3006
|
+
Checks for places where `case-when` represents a simple 1:1
|
3007
|
+
mapping and can be replaced with a hash lookup.
|
3008
|
+
Enabled: 'pending'
|
3009
|
+
VersionAdded: '0.88'
|
3010
|
+
# `MinBranchesCount` defines the number of branches `case` needs to have
|
3011
|
+
# to trigger this cop
|
3012
|
+
MinBranchesCount: 3
|
3013
|
+
|
2923
3014
|
Style/HashSyntax:
|
2924
3015
|
Description: >-
|
2925
3016
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -2983,6 +3074,7 @@ Style/IfUnlessModifierOfIfUnless:
|
|
2983
3074
|
Avoid modifier if/unless usage on conditionals.
|
2984
3075
|
Enabled: true
|
2985
3076
|
VersionAdded: '0.39'
|
3077
|
+
VersionChanged: '0.87'
|
2986
3078
|
|
2987
3079
|
Style/IfWithSemicolon:
|
2988
3080
|
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
@@ -3239,6 +3331,7 @@ Style/MultilineTernaryOperator:
|
|
3239
3331
|
StyleGuide: '#no-multiline-ternary'
|
3240
3332
|
Enabled: true
|
3241
3333
|
VersionAdded: '0.9'
|
3334
|
+
VersionChanged: '0.86'
|
3242
3335
|
|
3243
3336
|
Style/MultilineWhenThen:
|
3244
3337
|
Description: 'Do not use then for multi-line when statement.'
|
@@ -3343,6 +3436,7 @@ Style/NestedTernaryOperator:
|
|
3343
3436
|
StyleGuide: '#no-nested-ternary'
|
3344
3437
|
Enabled: true
|
3345
3438
|
VersionAdded: '0.9'
|
3439
|
+
VersionChanged: '0.86'
|
3346
3440
|
|
3347
3441
|
Style/Next:
|
3348
3442
|
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
@@ -3567,6 +3661,11 @@ Style/RandomWithOffset:
|
|
3567
3661
|
Enabled: true
|
3568
3662
|
VersionAdded: '0.52'
|
3569
3663
|
|
3664
|
+
Style/RedundantAssignment:
|
3665
|
+
Description: 'Checks for redundant assignment before returning.'
|
3666
|
+
Enabled: 'pending'
|
3667
|
+
VersionAdded: '0.87'
|
3668
|
+
|
3570
3669
|
Style/RedundantBegin:
|
3571
3670
|
Description: "Don't use begin blocks when they are not needed."
|
3572
3671
|
StyleGuide: '#begin-implicit'
|
@@ -3596,6 +3695,27 @@ Style/RedundantException:
|
|
3596
3695
|
VersionAdded: '0.14'
|
3597
3696
|
VersionChanged: '0.29'
|
3598
3697
|
|
3698
|
+
Style/RedundantFetchBlock:
|
3699
|
+
Description: >-
|
3700
|
+
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
3701
|
+
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
3702
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
3703
|
+
Enabled: 'pending'
|
3704
|
+
Safe: false
|
3705
|
+
# If enabled, this cop will autocorrect usages of
|
3706
|
+
# `fetch` being called with block returning a constant.
|
3707
|
+
# This can be dangerous since constants will not be defined at that moment.
|
3708
|
+
SafeForConstants: false
|
3709
|
+
VersionAdded: '0.86'
|
3710
|
+
|
3711
|
+
Style/RedundantFileExtensionInRequire:
|
3712
|
+
Description: >-
|
3713
|
+
Checks for the presence of superfluous `.rb` extension in
|
3714
|
+
the filename provided to `require` and `require_relative`.
|
3715
|
+
StyleGuide: '#no-explicit-rb-to-require'
|
3716
|
+
Enabled: 'pending'
|
3717
|
+
VersionAdded: '0.88'
|
3718
|
+
|
3599
3719
|
Style/RedundantFreeze:
|
3600
3720
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3601
3721
|
Enabled: true
|
@@ -3875,6 +3995,7 @@ Style/StructInheritance:
|
|
3875
3995
|
StyleGuide: '#no-extend-struct-new'
|
3876
3996
|
Enabled: true
|
3877
3997
|
VersionAdded: '0.29'
|
3998
|
+
VersionChanged: '0.86'
|
3878
3999
|
|
3879
4000
|
Style/SymbolArray:
|
3880
4001
|
Description: 'Use %i or %I for arrays of symbols.'
|
@@ -3896,7 +4017,7 @@ Style/SymbolLiteral:
|
|
3896
4017
|
Style/SymbolProc:
|
3897
4018
|
Description: 'Use symbols as procs instead of blocks when possible.'
|
3898
4019
|
Enabled: true
|
3899
|
-
|
4020
|
+
Safe: false
|
3900
4021
|
VersionAdded: '0.26'
|
3901
4022
|
VersionChanged: '0.64'
|
3902
4023
|
# A list of method names to be ignored by the check.
|