From a788a58c4476c3e22b3ebf8a7c408c9bd403d630 Mon Sep 17 00:00:00 2001 From: Siddharth Asthana Date: Wed, 3 Aug 2022 23:24:31 +0530 Subject: [PATCH 1/2] RuboCop: Enable previously disabled Style/HashEachMethods Changelog: other --- .rubocop_todo/style/hash_each_methods.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.rubocop_todo/style/hash_each_methods.yml b/.rubocop_todo/style/hash_each_methods.yml index 648b6fbbe08de9..cebfe5c0c7d634 100644 --- a/.rubocop_todo/style/hash_each_methods.yml +++ b/.rubocop_todo/style/hash_each_methods.yml @@ -1,9 +1,6 @@ --- # Cop supports --auto-correct. Style/HashEachMethods: - # Offense count: 95 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: - 'app/graphql/resolvers/concerns/caching_array_resolver.rb' - 'app/graphql/types/alert_management/severity_enum.rb' @@ -12,6 +9,7 @@ Style/HashEachMethods: - 'app/graphql/types/ci/job_artifact_file_type_enum.rb' - 'app/graphql/types/ci/pipeline_config_source_enum.rb' - 'app/graphql/types/ci/runner_access_level_enum.rb' + - 'app/graphql/types/ci/variable_type_enum.rb' - 'app/graphql/types/clusters/agent_token_status_enum.rb' - 'app/graphql/types/container_repository_status_enum.rb' - 'app/graphql/types/data_visualization_palette/color_enum.rb' @@ -34,6 +32,7 @@ Style/HashEachMethods: - 'config/initializers/8_gitaly.rb' - 'ee/app/graphql/types/compliance_management/merge_requests/compliance_violation_reason_enum.rb' - 'ee/app/graphql/types/compliance_management/merge_requests/compliance_violation_severity_enum.rb' + - 'ee/app/graphql/types/incident_management/issuable_resource_link_type_enum.rb' - 'ee/app/graphql/types/incident_management/oncall_rotation_length_unit_enum.rb' - 'ee/app/graphql/types/security_report_summary_type.rb' - 'ee/app/graphql/types/vulnerabilities_count_by_day_type.rb' @@ -69,7 +68,6 @@ Style/HashEachMethods: - 'spec/helpers/application_helper_spec.rb' - 'spec/lib/gitlab/ci/status/build/failed_spec.rb' - 'spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb' - - 'spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb' - 'spec/lib/gitlab/usage_data_spec.rb' - 'spec/models/ci/build_spec.rb' - 'spec/models/ci/job_artifact_spec.rb' @@ -77,6 +75,7 @@ Style/HashEachMethods: - 'spec/models/clusters/cluster_spec.rb' - 'spec/models/concerns/has_user_type_spec.rb' - 'spec/models/packages/package_spec.rb' + - 'spec/models/project_spec.rb' - 'spec/models/user_spec.rb' - 'spec/presenters/ci/pipeline_presenter_spec.rb' - 'spec/presenters/commit_status_presenter_spec.rb' -- GitLab From 4323a0c53d770b41c7a490f02b39b350a219b569 Mon Sep 17 00:00:00 2001 From: Peter Leitzen Date: Wed, 10 Aug 2022 11:15:48 +0200 Subject: [PATCH 2/2] Fix RuboCop Style/HashEachMethods offenses in HAML --- .../admin/application_settings/_repository_storage.html.haml | 2 +- app/views/admin/application_settings/_whats_new.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/application_settings/_repository_storage.html.haml b/app/views/admin/application_settings/_repository_storage.html.haml index 5dc2d322bb30c0..ff10e4a8f77ece 100644 --- a/app/views/admin/application_settings/_repository_storage.html.haml +++ b/app/views/admin/application_settings/_repository_storage.html.haml @@ -23,7 +23,7 @@ = link_to s_('Learn more.'), help_page_path('administration/repository_storage_paths.md'), target: '_blank', rel: 'noopener noreferrer' .form-check = f.fields_for :repository_storages_weighted, storage_weights do |storage_form| - - Gitlab.config.repositories.storages.keys.each do |storage| + - Gitlab.config.repositories.storages.each_key do |storage| = storage_form.text_field storage, class: 'form-text-input' = storage_form.label storage, storage, class: 'label-bold form-check-label' %br diff --git a/app/views/admin/application_settings/_whats_new.html.haml b/app/views/admin/application_settings/_whats_new.html.haml index 8ae912d24b709d..d82bb1c94e498f 100644 --- a/app/views/admin/application_settings/_whats_new.html.haml +++ b/app/views/admin/application_settings/_whats_new.html.haml @@ -1,7 +1,7 @@ = gitlab_ui_form_for @application_setting, url: preferences_admin_application_settings_path(anchor: 'js-whats-new-settings'), html: { class: 'fieldset-form whats-new-settings' } do |f| = form_errors(@application_setting, pajamas_alert: true) - - whats_new_variants.keys.each do |variant| + - whats_new_variants.each_key do |variant| .gl-mb-4 = f.gitlab_ui_radio_component :whats_new_variant, variant, whats_new_variants_label(variant), help_text: whats_new_variants_description(variant) -- GitLab