diff --git a/.rubocop_todo/performance/block_given_with_explicit_block.yml b/.rubocop_todo/performance/block_given_with_explicit_block.yml index ff1f5e568eac460e5f5ae136100a5c92218d6620..b919dbd19e6ef2fdf9bd54742131a80bd7026060 100644 --- a/.rubocop_todo/performance/block_given_with_explicit_block.yml +++ b/.rubocop_todo/performance/block_given_with_explicit_block.yml @@ -1,9 +1,6 @@ --- # Cop supports --auto-correct. Performance/BlockGivenWithExplicitBlock: - # Offense count: 53 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: - 'app/controllers/concerns/redis_tracking.rb' - 'app/helpers/badges_helper.rb' @@ -26,11 +23,14 @@ Performance/BlockGivenWithExplicitBlock: - 'lib/gitlab/metrics/methods/metric_options.rb' - 'lib/gitlab/null_request_store.rb' - 'lib/gitlab/quick_actions/dsl.rb' + - 'lib/gitlab/redis/multi_store.rb' - 'lib/gitlab/safe_request_loader.rb' - 'lib/gitlab/search/query.rb' - 'lib/gitlab/string_placeholder_replacer.rb' - 'lib/gitlab/terraform/state_migration_helper.rb' + - 'lib/gitlab/usage/metrics/instrumentations/base_metric.rb' - 'lib/gitlab/usage/metrics/instrumentations/database_metric.rb' + - 'lib/gitlab/usage/metrics/instrumentations/numbers_metric.rb' - 'lib/gitlab/usage_data_queries.rb' - 'lib/gitlab/utils/usage_data.rb' - 'qa/qa/page/view.rb' @@ -38,5 +38,6 @@ Performance/BlockGivenWithExplicitBlock: - 'spec/lib/gitlab/slash_commands/deploy_spec.rb' - 'spec/support/helpers/graphql_helpers.rb' - 'spec/support/helpers/query_recorder.rb' + - 'spec/support/helpers/stub_method_calls.rb' - 'tooling/lib/tooling/helm3_client.rb' - 'tooling/lib/tooling/test_map_packer.rb' diff --git a/.rubocop_todo/performance/collection_literal_in_loop.yml b/.rubocop_todo/performance/collection_literal_in_loop.yml index 4b012bf6645768e55b20d55f571aa7244ed7a1e8..50fd75827fbaea698c6e18c135f31e8af154a9a7 100644 --- a/.rubocop_todo/performance/collection_literal_in_loop.yml +++ b/.rubocop_todo/performance/collection_literal_in_loop.yml @@ -1,12 +1,8 @@ --- Performance/CollectionLiteralInLoop: - # Offense count: 45 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: - 'config/application.rb' - 'config/initializers/1_settings.rb' - - 'ee/app/models/ee/merge_request.rb' - 'ee/spec/features/admin/admin_settings_spec.rb' - 'ee/spec/support/shared_examples/features/protected_branches_access_control_shared_examples.rb' - 'ee/spec/workers/app_sec/dast/profile_schedule_worker_spec.rb' @@ -20,15 +16,18 @@ Performance/CollectionLiteralInLoop: - 'lib/tasks/gitlab/seed/group_seed.rake' - 'spec/bin/sidekiq_cluster_spec.rb' - 'spec/controllers/groups_controller_spec.rb' + - 'spec/finders/ci/runners_finder_spec.rb' - 'spec/lib/banzai/reference_parser/base_parser_spec.rb' - 'spec/lib/gitlab/database/migration_helpers/restrict_gitlab_schema_spec.rb' - 'spec/lib/gitlab/file_detector_spec.rb' - 'spec/lib/gitlab/search/abuse_detection_spec.rb' - 'spec/lib/gitlab/utils/markdown_spec.rb' + - 'spec/metrics_server/metrics_server_spec.rb' - 'spec/models/analytics/cycle_analytics/aggregation_spec.rb' - 'spec/models/ci/build_spec.rb' - 'spec/models/ci/pipeline_spec.rb' - 'spec/models/namespace_statistics_spec.rb' + - 'spec/models/project_spec.rb' - 'spec/presenters/ci/build_runner_presenter_spec.rb' - 'spec/presenters/packages/nuget/packages_metadata_presenter_spec.rb' - 'spec/presenters/packages/nuget/service_index_presenter_spec.rb' diff --git a/.rubocop_todo/performance/constant_regexp.yml b/.rubocop_todo/performance/constant_regexp.yml index 4ed40db498f88756d400db9bb237954af5795538..23d03ced8d7331e92951ee90367e4f583395dccf 100644 --- a/.rubocop_todo/performance/constant_regexp.yml +++ b/.rubocop_todo/performance/constant_regexp.yml @@ -1,15 +1,13 @@ --- # Cop supports --auto-correct. Performance/ConstantRegexp: - # Offense count: 46 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: - 'app/models/commit.rb' - 'app/models/commit_range.rb' - 'app/models/custom_emoji.rb' - 'app/models/gpg_key.rb' - 'app/models/merge_request.rb' + - 'app/models/packages/package.rb' - 'app/models/project.rb' - 'app/models/wiki.rb' - 'ee/app/models/ee/epic.rb' @@ -27,5 +25,6 @@ Performance/ConstantRegexp: - 'lib/gitlab/regex.rb' - 'scripts/perf/query_limiting_report.rb' - 'scripts/validate_migration_schema' + - 'spec/features/users/email_verification_on_login_spec.rb' - 'spec/models/concerns/token_authenticatable_spec.rb' - 'spec/services/notes/copy_service_spec.rb' diff --git a/.rubocop_todo/performance/method_object_as_block.yml b/.rubocop_todo/performance/method_object_as_block.yml index 265e03073db0fd76cc39311e609ea8edf98696f0..1bc82ff05ece39ae51d0b51f9b844ba2aa959594 100644 --- a/.rubocop_todo/performance/method_object_as_block.yml +++ b/.rubocop_todo/performance/method_object_as_block.yml @@ -1,8 +1,5 @@ --- Performance/MethodObjectAsBlock: - # Offense count: 150 - # Temporarily disabled due to too many offenses - Enabled: false Exclude: - 'app/controllers/concerns/metrics_dashboard.rb' - 'app/controllers/concerns/requires_whitelisted_monitoring_client.rb' @@ -30,7 +27,6 @@ Performance/MethodObjectAsBlock: - 'ee/app/graphql/resolvers/vulnerabilities/scanners_resolver.rb' - 'ee/app/services/dashboard/projects/create_service.rb' - 'ee/app/services/security/findings/cleanup_service.rb' - - 'ee/app/services/security/ingestion/bulk_insertable_task.rb' - 'ee/app/services/security/ingestion/ingest_reports_service.rb' - 'ee/app/services/security/ingestion/tasks/ingest_vulnerability_statistics.rb' - 'ee/app/services/security/store_findings_metadata_service.rb' @@ -38,6 +34,7 @@ Performance/MethodObjectAsBlock: - 'ee/lib/ee/container_registry/client.rb' - 'ee/lib/ee/gitlab/ci/config_ee.rb' - 'ee/lib/ee/gitlab/etag_caching/router/rails.rb' + - 'ee/lib/gitlab/ingestion/bulk_insertable_task.rb' - 'ee/spec/services/groups/participants_service_spec.rb' - 'lib/api/helpers/packages/conan/api_helpers.rb' - 'lib/bulk_imports/pipeline.rb' @@ -80,6 +77,7 @@ Performance/MethodObjectAsBlock: - 'lib/gitlab/utils.rb' - 'lib/peek/views/detailed_view.rb' - 'lib/tasks/gitlab/assets.rake' + - 'lib/unnested_in_filters/rewriter.rb' - 'qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb' - 'rubocop/cop/avoid_return_from_blocks.rb' - 'rubocop/cop/gitlab/mark_used_feature_flags.rb' @@ -95,5 +93,6 @@ Performance/MethodObjectAsBlock: - 'spec/support/helpers/migrations_helpers.rb' - 'spec/support/shared_examples/models/active_record_enum_shared_examples.rb' - 'spec/support_specs/helpers/stub_feature_flags_spec.rb' + - 'tooling/lib/tooling/find_codeowners.rb' - 'tooling/lib/tooling/test_map_packer.rb' - 'tooling/quality/test_level.rb' diff --git a/app/views/layouts/_flash.html.haml b/app/views/layouts/_flash.html.haml index 21cccb863982c6fa19d38f330d5921d591e30412..ab4b3cf6afd920ecb5c9fa8260e5b6ae8f5ad83d 100644 --- a/app/views/layouts/_flash.html.haml +++ b/app/views/layouts/_flash.html.haml @@ -1,6 +1,7 @@ -# We currently only support `alert`, `notice`, `success`, 'toast', and 'raw' - icons = {'alert' => 'error', 'notice' => 'information-o', 'success' => 'check-circle'} - type_to_variant = {'alert' => 'danger', 'notice' => 'info', 'success' => 'success'} +- closable = %w[alert notice success] .flash-container.flash-container-page.sticky{ data: { qa_selector: 'flash_container' } } - flash.each do |key, value| - if key == 'toast' && value @@ -13,6 +14,6 @@ %div{ class: "flash-#{key} mb-2", data: { testid: "alert-#{type_to_variant[key]}" } } = sprite_icon(icons[key], css_class: 'align-middle mr-1') unless icons[key].nil? %span= value - - if %w(alert notice success).include?(key) + - if closable.include?(key) %div{ class: "close-icon-wrapper js-close-icon" } = sprite_icon('close', css_class: 'close-icon gl-vertical-align-baseline!') diff --git a/spec/views/layouts/_flash.html.haml_spec.rb b/spec/views/layouts/_flash.html.haml_spec.rb index 82c06feb4fb579a5806c8beb08d9d1943d55abbd..a4bed09368fbfac5a8d0006e3941006fdfad931e 100644 --- a/spec/views/layouts/_flash.html.haml_spec.rb +++ b/spec/views/layouts/_flash.html.haml_spec.rb @@ -9,7 +9,11 @@ end describe 'closable flash messages' do - %w(alert notice success).each do |flash_type| + where(:flash_type) do + %w[alert notice success] + end + + with_them do let(:flash) { { flash_type => 'This is a closable flash message' } } it 'shows a close button' do @@ -19,10 +23,14 @@ end describe 'non closable flash messages' do - %w(error message toast warning).each do |flash_type| + where(:flash_type) do + %w[error message toast warning] + end + + with_them do let(:flash) { { flash_type => 'This is a non closable flash message' } } - it 'shows a close button' do + it 'does not show a close button' do expect(rendered).not_to include('js-close-icon') end end