Skip to content

Fix auto-correctable `Style/EmptyElse` Cop

What does this MR do and why?

Fixes auto-correctable RuboCop offenses for Style/EmptyElse in excludes

Some files have been left in exclude for the following reasons:

Comments in else clause:

  • app/models/performance_monitoring/prometheus_dashboard.rb
  • app/models/resource_state_event.rb
  • app/models/resource_timebox_event.rb
  • app/services/award_emojis/add_service.rb
  • app/workers/post_receive.rb
  • config/initializers/doorkeeper_openid_connect.rb
  • ee/app/helpers/ee/kerberos_helper.rb
  • ee/app/services/projects/update_mirror_service.rb
  • ee/lib/elastic/latest/note_instance_proxy.rb
  • ee/lib/gitlab/analytics/cycle_analytics/summary/change_failure_rate.rb
  • lib/gitlab/ci/variables/collection.rb
  • lib/gitlab/database/load_balancing/sidekiq_server_middleware.rb
  • lib/gitlab/sidekiq_daemon/monitor.rb

Causes other Cops to throw an error and fails commit hook:

  • app/controllers/concerns/sends_blob.rb
  • app/controllers/google_api/authorizations_controller.rb
  • app/finders/group_finder.rb
  • app/graphql/resolvers/group_milestones_resolver.rb
  • app/graphql/types/ci/detailed_status_type.rb
  • app/models/legacy_diff_discussion.rb
  • ee/app/services/gitlab_subscriptions/check_future_renewal_service.rb
  • lib/gitlab/auth/o_auth/provider.rb
  • lib/gitlab/database/sha256_attribute.rb
  • lib/gitlab/git.rb
  • lib/peek/views/external_http.rb

Screenshots or screen recordings

No visual changes

How to set up and validate locally

  • Run rubocop --only Style/EmptyElse

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #239356

Merge request reports