diff options
Diffstat (limited to 'app')
130 files changed, 173 insertions, 234 deletions
diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 1204d68159f..3d918a8150b 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -468,15 +468,6 @@ const getFetchDataParams = (state) => { return { endpoint, options }; }; -export const fetchData = ({ commit, state, getters, dispatch }) => { - const { endpoint, options } = getFetchDataParams(state); - - axios - .get(endpoint, options) - .then(({ data }) => pollSuccessCallBack(data, commit, state, getters, dispatch)) - .catch(() => Flash(__('Something went wrong while fetching latest comments.'))); -}; - export const poll = ({ commit, state, getters, dispatch }) => { eTagPoll = new Poll({ resource: { @@ -493,7 +484,7 @@ export const poll = ({ commit, state, getters, dispatch }) => { if (!Visibility.hidden()) { eTagPoll.makeDelayedRequest(2500); } else { - dispatch('fetchData'); + eTagPoll.makeRequest(); } Visibility.change(() => { diff --git a/app/controllers/import/base_controller.rb b/app/controllers/import/base_controller.rb index 87cda723895..1121ecfb65c 100644 --- a/app/controllers/import/base_controller.rb +++ b/app/controllers/import/base_controller.rb @@ -97,7 +97,7 @@ class Import::BaseController < ApplicationController group = Groups::NestedCreateService.new(current_user, group_path: names).execute group.errors.any? ? current_user.namespace : group - rescue => e + rescue StandardError => e Gitlab::AppLogger.error(e) current_user.namespace diff --git a/app/controllers/import/fogbugz_controller.rb b/app/controllers/import/fogbugz_controller.rb index 17f937a3dfd..9f91f3a1e1c 100644 --- a/app/controllers/import/fogbugz_controller.rb +++ b/app/controllers/import/fogbugz_controller.rb @@ -15,7 +15,7 @@ class Import::FogbugzController < Import::BaseController def callback begin res = Gitlab::FogbugzImport::Client.new(import_params.to_h.symbolize_keys) - rescue + rescue StandardError # If the URI is invalid various errors can occur return redirect_to new_import_fogbugz_path, alert: _('Could not connect to FogBugz, check your URL') end diff --git a/app/controllers/jira_connect/application_controller.rb b/app/controllers/jira_connect/application_controller.rb index 9c311f92b69..a6529ecb4ce 100644 --- a/app/controllers/jira_connect/application_controller.rb +++ b/app/controllers/jira_connect/application_controller.rb @@ -24,7 +24,7 @@ class JiraConnect::ApplicationController < ApplicationController # Make sure `qsh` claim matches the current request render_403 unless payload['qsh'] == Atlassian::Jwt.create_query_string_hash(request.url, request.method, jira_connect_base_url) - rescue + rescue StandardError render_403 end diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb index da018b24836..5765287bd2d 100644 --- a/app/controllers/projects/repositories_controller.rb +++ b/app/controllers/projects/repositories_controller.rb @@ -35,7 +35,7 @@ class Projects::RepositoriesController < Projects::ApplicationController return if archive_not_modified? send_git_archive @repository, **repo_params - rescue => ex + rescue StandardError => ex logger.error("#{self.class.name}: #{ex}") git_not_found! end diff --git a/app/finders/ci/pipelines_finder.rb b/app/finders/ci/pipelines_finder.rb index e509cf940b8..af7b23278a4 100644 --- a/app/finders/ci/pipelines_finder.rb +++ b/app/finders/ci/pipelines_finder.rb @@ -133,7 +133,7 @@ module Ci when true items.where.not(yaml_errors: nil) when false - items.where("yaml_errors IS NULL") + items.where(yaml_errors: nil) else items end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a2ef2f1207c..6d9cb0c8175 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -72,7 +72,7 @@ module ApplicationHelper else 'Never' end - rescue + rescue StandardError 'Never' end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 6b3abb4274e..1f49452ed7e 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -228,7 +228,7 @@ module EventsHelper def event_commit_title(message) message ||= '' (message.split("\n").first || "").truncate(70) - rescue + rescue StandardError "--broken encoding" end diff --git a/app/helpers/x509_helper.rb b/app/helpers/x509_helper.rb index 009635fb629..4afc5643af4 100644 --- a/app/helpers/x509_helper.rb +++ b/app/helpers/x509_helper.rb @@ -13,7 +13,7 @@ module X509Helper end subjects - rescue + rescue StandardError {} end diff --git a/app/models/blob_viewer/dependency_manager.rb b/app/models/blob_viewer/dependency_manager.rb index a851f22bfcd..a3801025cd7 100644 --- a/app/models/blob_viewer/dependency_manager.rb +++ b/app/models/blob_viewer/dependency_manager.rb @@ -33,7 +33,7 @@ module BlobViewer @json_data ||= begin prepare! Gitlab::Json.parse(blob.data) - rescue + rescue StandardError {} end end diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 3d8e9f4c126..bb668fb7cde 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -330,7 +330,7 @@ module Ci begin build.deployment.drop! - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e, build_id: build.id) end diff --git a/app/models/ci/deleted_object.rb b/app/models/ci/deleted_object.rb index 2942a153e05..b2a949c9bb5 100644 --- a/app/models/ci/deleted_object.rb +++ b/app/models/ci/deleted_object.rb @@ -29,7 +29,7 @@ module Ci def delete_file_from_storage file.remove! true - rescue => exception + rescue StandardError => exception Gitlab::ErrorTracking.track_exception(exception) false end diff --git a/app/models/ci/persistent_ref.rb b/app/models/ci/persistent_ref.rb index 91163c85a9e..57aa1962bd2 100644 --- a/app/models/ci/persistent_ref.rb +++ b/app/models/ci/persistent_ref.rb @@ -15,13 +15,13 @@ module Ci def exist? ref_exists?(path) - rescue + rescue StandardError false end def create create_ref(sha, path) - rescue => e + rescue StandardError => e Gitlab::ErrorTracking .track_exception(e, pipeline_id: pipeline.id) end @@ -30,7 +30,7 @@ module Ci delete_refs(path) rescue Gitlab::Git::Repository::NoRepository # no-op - rescue => e + rescue StandardError => e Gitlab::ErrorTracking .track_exception(e, pipeline_id: pipeline.id) end diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index 9dd75150ac7..7c5324a2181 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -46,7 +46,7 @@ module Ci self.position = statuses.select(:stage_idx) .where.not(stage_idx: nil) .group(:stage_idx) - .order('COUNT(*) DESC') + .order('COUNT(id) DESC') .first&.stage_idx.to_i end diff --git a/app/models/concerns/cacheable_attributes.rb b/app/models/concerns/cacheable_attributes.rb index ee56322cce7..f3b47047c55 100644 --- a/app/models/concerns/cacheable_attributes.rb +++ b/app/models/concerns/cacheable_attributes.rb @@ -53,7 +53,7 @@ module CacheableAttributes return cached_record if cached_record.present? current_without_cache.tap { |current_record| current_record&.cache! } - rescue => e + rescue StandardError => e if Rails.env.production? Gitlab::AppLogger.warn("Cached record for #{name} couldn't be loaded, falling back to uncached record: #{e}") else @@ -66,7 +66,7 @@ module CacheableAttributes def expire Gitlab::SafeRequestStore.delete(request_store_cache_key) cache_backend.delete(cache_key) - rescue + rescue StandardError # Gracefully handle when Redis is not available. For example, # omnibus may fail here during gitlab:assets:compile. end diff --git a/app/models/concerns/has_repository.rb b/app/models/concerns/has_repository.rb index 774cda2c3e8..33f6904bc91 100644 --- a/app/models/concerns/has_repository.rb +++ b/app/models/concerns/has_repository.rb @@ -17,7 +17,7 @@ module HasRepository def valid_repo? repository.exists? - rescue + rescue StandardError errors.add(:base, _('Invalid repository path')) false end @@ -25,7 +25,7 @@ module HasRepository def repo_exists? strong_memoize(:repo_exists) do repository.exists? - rescue + rescue StandardError false end end diff --git a/app/models/concerns/milestoneable.rb b/app/models/concerns/milestoneable.rb index d42417bb6c1..1d9fa2b9697 100644 --- a/app/models/concerns/milestoneable.rb +++ b/app/models/concerns/milestoneable.rb @@ -28,7 +28,7 @@ module Milestoneable scope :without_release, -> do joins("LEFT OUTER JOIN milestone_releases ON #{table_name}.milestone_id = milestone_releases.milestone_id") - .where('milestone_releases.release_id IS NULL') + .where(milestone_releases: { release_id: nil }) end scope :joins_milestone_releases, -> do diff --git a/app/models/concerns/repository_storage_movable.rb b/app/models/concerns/repository_storage_movable.rb index 8607f0d94f4..990d50eb073 100644 --- a/app/models/concerns/repository_storage_movable.rb +++ b/app/models/concerns/repository_storage_movable.rb @@ -50,7 +50,7 @@ module RepositoryStorageMovable begin storage_move.container.set_repository_read_only!(skip_git_transfer_check: true) - rescue => err + rescue StandardError => err storage_move.add_error(err.message) next false end diff --git a/app/models/concerns/sha256_attribute.rb b/app/models/concerns/sha256_attribute.rb index 9dfe1b77829..5c52236ab6d 100644 --- a/app/models/concerns/sha256_attribute.rb +++ b/app/models/concerns/sha256_attribute.rb @@ -33,7 +33,7 @@ module Sha256Attribute unless column.type == :binary raise ArgumentError.new("sha256_attribute #{name.inspect} is invalid since the column type is not :binary") end - rescue => error + rescue StandardError => error Gitlab::AppLogger.error "Sha256Attribute initialization: #{error.message}" raise end diff --git a/app/models/concerns/sha_attribute.rb b/app/models/concerns/sha_attribute.rb index cbac6a210c7..e2a78e11f99 100644 --- a/app/models/concerns/sha_attribute.rb +++ b/app/models/concerns/sha_attribute.rb @@ -26,7 +26,7 @@ module ShaAttribute unless column.type == :binary raise ArgumentError.new("sha_attribute #{name.inspect} is invalid since the column type is not :binary") end - rescue => error + rescue StandardError => error Gitlab::AppLogger.error "ShaAttribute initialization: #{error.message}" raise end diff --git a/app/models/concerns/storage/legacy_namespace.rb b/app/models/concerns/storage/legacy_namespace.rb index a82cf338039..743be9287ea 100644 --- a/app/models/concerns/storage/legacy_namespace.rb +++ b/app/models/concerns/storage/legacy_namespace.rb @@ -48,7 +48,7 @@ module Storage begin send_update_instructions write_projects_repository_config - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e, full_path_before_last_save: full_path_before_last_save, full_path: full_path, diff --git a/app/models/concerns/x509_serial_number_attribute.rb b/app/models/concerns/x509_serial_number_attribute.rb index d2a5c736604..1db693ce892 100644 --- a/app/models/concerns/x509_serial_number_attribute.rb +++ b/app/models/concerns/x509_serial_number_attribute.rb @@ -33,7 +33,7 @@ module X509SerialNumberAttribute unless column.type == :binary raise ArgumentError.new("x509_serial_number_attribute #{name.inspect} is invalid since the column type is not :binary") end - rescue => error + rescue StandardError => error Gitlab::AppLogger.error "X509SerialNumberAttribute initialization: #{error.message}" raise end diff --git a/app/models/deployment_merge_request.rb b/app/models/deployment_merge_request.rb index 7949bd81605..b91785eeb57 100644 --- a/app/models/deployment_merge_request.rb +++ b/app/models/deployment_merge_request.rb @@ -12,7 +12,7 @@ class DeploymentMergeRequest < ApplicationRecord end def self.by_deployment_id(id) - where('deployments.id = ?', id) + where(deployments: { id: id }) end def self.deployed_to(name) @@ -20,7 +20,7 @@ class DeploymentMergeRequest < ApplicationRecord # (project_id, name), instead of using the index on # (name varchar_pattern_ops). This results in better performance on # GitLab.com. - where('environments.name = ?', name) + where(environments: { name: name }) .where('environments.project_id = merge_requests.target_project_id') end diff --git a/app/models/design_management/version.rb b/app/models/design_management/version.rb index 5cfd8f3ec8e..68a0b8faf4f 100644 --- a/app/models/design_management/version.rb +++ b/app/models/design_management/version.rb @@ -94,7 +94,7 @@ module DesignManagement version end - rescue + rescue StandardError raise CouldNotCreateVersion.new(sha, issue_id, design_actions) end diff --git a/app/models/environment.rb b/app/models/environment.rb index 4ee93b0ba4a..6dff8e4f5f8 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -269,7 +269,7 @@ class Environment < ApplicationRecord Gitlab::OptimisticLocking.retry_lock(deployment.deployable, name: 'environment_cancel_deployment_jobs') do |deployable| deployable.cancel! if deployable&.cancelable? end - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, environment_id: id, deployment_id: deployment.id) end end diff --git a/app/models/group.rb b/app/models/group.rb index 60a0e27428d..77424fd116d 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -109,13 +109,13 @@ class Group < Namespace scope :for_authorized_group_members, -> (user_ids) do joins(:group_members) - .where("members.user_id IN (?)", user_ids) + .where(members: { user_id: user_ids }) .where("access_level >= ?", Gitlab::Access::GUEST) end scope :for_authorized_project_members, -> (user_ids) do joins(projects: :project_authorizations) - .where("project_authorizations.user_id IN (?)", user_ids) + .where(project_authorizations: { user_id: user_ids }) end class << self @@ -153,7 +153,7 @@ class Group < Namespace def select_for_project_authorization if current_scope.joins_values.include?(:shared_projects) joins('INNER JOIN namespaces project_namespace ON project_namespace.id = projects.namespace_id') - .where('project_namespace.share_with_group_lock = ?', false) + .where(project_namespace: { share_with_group_lock: false }) .select("projects.id AS project_id, LEAST(project_group_links.group_access, members.access_level) AS access_level") else super diff --git a/app/models/hooks/web_hook_log.rb b/app/models/hooks/web_hook_log.rb index e2230a2d644..0c96d5d4b6d 100644 --- a/app/models/hooks/web_hook_log.rb +++ b/app/models/hooks/web_hook_log.rb @@ -5,9 +5,12 @@ class WebHookLog < ApplicationRecord include Presentable include DeleteWithLimit include CreatedAtFilterable + include PartitionedTable self.primary_key = :id + partitioned_by :created_at, strategy: :monthly + belongs_to :web_hook serialize :request_headers, Hash # rubocop:disable Cop/ActiveRecordSerialize diff --git a/app/models/hooks/web_hook_log_archived.rb b/app/models/hooks/web_hook_log_archived.rb new file mode 100644 index 00000000000..a1c8a44f5ba --- /dev/null +++ b/app/models/hooks/web_hook_log_archived.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# This model is not intended to be used. +# It is a temporary reference to the old non-partitioned +# web_hook_logs table. +# Please refer to https://gitlab.com/groups/gitlab-org/-/epics/5558 +# for details. +# rubocop:disable Gitlab/NamespacedClass: This is a temporary class with no relevant namespace +# WebHook, WebHookLog and all hooks are defined outside of a namespace +class WebHookLogArchived < ApplicationRecord + self.table_name = 'web_hook_logs_archived' +end diff --git a/app/models/hooks/web_hook_log_partitioned.rb b/app/models/hooks/web_hook_log_partitioned.rb deleted file mode 100644 index b4b150afb6a..00000000000 --- a/app/models/hooks/web_hook_log_partitioned.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -# This model is not yet intended to be used. -# It is in a transitioning phase while we are partitioning -# the web_hook_logs table on the database-side. -# Please refer to https://gitlab.com/groups/gitlab-org/-/epics/5558 -# for details. -# rubocop:disable Gitlab/NamespacedClass: This is a temporary class with no relevant namespace -# WebHook, WebHookLog and all hooks are defined outside of a namespace -class WebHookLogPartitioned < ApplicationRecord - include PartitionedTable - - self.table_name = 'web_hook_logs_part_0c5294f417' - self.primary_key = :id - - partitioned_by :created_at, strategy: :monthly -end diff --git a/app/models/issue.rb b/app/models/issue.rb index af78466e6a9..743e8417ced 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -87,7 +87,8 @@ class Issue < ApplicationRecord enum issue_type: { issue: 0, incident: 1, - test_case: 2 ## EE-only + test_case: 2, ## EE-only + requirement: 3 ## EE-only } alias_method :issuing_parent, :project diff --git a/app/models/issue_assignee.rb b/app/models/issue_assignee.rb index d62f0eb170c..1f7479d7b0a 100644 --- a/app/models/issue_assignee.rb +++ b/app/models/issue_assignee.rb @@ -8,7 +8,7 @@ class IssueAssignee < ApplicationRecord validates :assignee, uniqueness: { scope: :issue_id } - scope :in_projects, ->(project_ids) { joins(:issue).where("issues.project_id in (?)", project_ids) } + scope :in_projects, ->(project_ids) { joins(:issue).where(issues: { project_id: project_ids }) } scope :on_issues, ->(issue_ids) { where(issue_id: issue_ids) } scope :for_assignee, ->(user) { where(assignee: user) } end diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb index 9a86b3a3fd9..484237a6dec 100644 --- a/app/models/members/project_member.rb +++ b/app/models/members/project_member.rb @@ -16,7 +16,7 @@ class ProjectMember < Member scope :in_project, ->(project) { where(source_id: project.id) } scope :in_namespaces, ->(groups) do joins('INNER JOIN projects ON projects.id = members.source_id') - .where('projects.namespace_id in (?)', groups.select(:id)) + .where(projects: { namespace_id: groups.select(:id) }) end scope :without_project_bots, -> do @@ -69,7 +69,7 @@ class ProjectMember < Member end true - rescue + rescue StandardError false end diff --git a/app/models/merge_request_assignee.rb b/app/models/merge_request_assignee.rb index 73f8fe77b04..86bf950ae19 100644 --- a/app/models/merge_request_assignee.rb +++ b/app/models/merge_request_assignee.rb @@ -6,5 +6,5 @@ class MergeRequestAssignee < ApplicationRecord validates :assignee, uniqueness: { scope: :merge_request_id } - scope :in_projects, ->(project_ids) { joins(:merge_request).where("merge_requests.target_project_id in (?)", project_ids) } + scope :in_projects, ->(project_ids) { joins(:merge_request).where(merge_requests: { target_project_id: project_ids }) } end diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 4cf0e423a15..0999ee5fd15 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -94,7 +94,7 @@ class Milestone < ApplicationRecord end def participants - User.joins(assigned_issues: :milestone).where("milestones.id = ?", id).distinct + User.joins(assigned_issues: :milestone).where(milestones: { id: id }).distinct end def self.sort_by_attribute(method) diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 455429608b4..16e65aa0fe6 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -89,7 +89,7 @@ class Namespace < ApplicationRecord before_destroy(prepend: true) { prepare_for_destroy } after_destroy :rm_dir - scope :for_user, -> { where('type IS NULL') } + scope :for_user, -> { where(type: nil) } scope :sort_by_type, -> { order(Gitlab::Database.nulls_first_order(:type)) } scope :include_route, -> { includes(:route) } scope :by_parent, -> (parent) { where(parent_id: parent) } diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb index 9da454125eb..560ff861105 100644 --- a/app/models/network/graph.rb +++ b/app/models/network/graph.rb @@ -27,7 +27,7 @@ module Network @project .notes - .where('noteable_type = ?', 'Commit') + .where(noteable_type: 'Commit') .group('notes.commit_id') .select('notes.commit_id, count(notes.id) as note_count') .each do |item| diff --git a/app/models/note.rb b/app/models/note.rb index 3e560a09fbd..13aa8fbfbd9 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -319,7 +319,7 @@ class Note < ApplicationRecord return commit if for_commit? super - rescue + rescue StandardError # Temp fix to prevent app crash # if note commit id doesn't exist nil diff --git a/app/models/operations/feature_flag.rb b/app/models/operations/feature_flag.rb index be3f719ddb3..537543a7ff0 100644 --- a/app/models/operations/feature_flag.rb +++ b/app/models/operations/feature_flag.rb @@ -97,7 +97,7 @@ module Operations issues = ::Issue .select('issues.*, operations_feature_flags_issues.id AS link_id') .joins(:feature_flag_issues) - .where('operations_feature_flags_issues.feature_flag_id = ?', id) + .where(operations_feature_flags_issues: { feature_flag_id: id }) .order('operations_feature_flags_issues.id ASC') .includes(preload) diff --git a/app/models/personal_access_token.rb b/app/models/personal_access_token.rb index ad2f4525171..6a786f75ec1 100644 --- a/app/models/personal_access_token.rb +++ b/app/models/personal_access_token.rb @@ -55,7 +55,7 @@ class PersonalAccessToken < ApplicationRecord begin Gitlab::CryptoHelper.aes256_gcm_decrypt(encrypted_token) - rescue => ex + rescue StandardError => ex logger.warn "Failed to decrypt #{self.name} value stored in Redis for key ##{redis_key}: #{ex.class}" encrypted_token end diff --git a/app/models/project.rb b/app/models/project.rb index f18d41e3556..44c32c53d90 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1097,7 +1097,7 @@ class Project < ApplicationRecord else super end - rescue + rescue StandardError super end @@ -1559,7 +1559,7 @@ class Project < ApplicationRecord repository.after_create true - rescue => err + rescue StandardError => err Gitlab::ErrorTracking.track_exception(err, project: { id: id, full_path: full_path, disk_path: disk_path }) errors.add(:base, _('Failed to create repository')) false diff --git a/app/models/project_services/asana_service.rb b/app/models/project_services/asana_service.rb index f31bf931a41..cd8e92f183c 100644 --- a/app/models/project_services/asana_service.rb +++ b/app/models/project_services/asana_service.rb @@ -98,7 +98,7 @@ class AsanaService < Service if tuple[0] task.update(completed: true) end - rescue => e + rescue StandardError => e log_error(e.message) next end diff --git a/app/models/project_services/external_wiki_service.rb b/app/models/project_services/external_wiki_service.rb index c41783d1af4..fa6ba13eb59 100644 --- a/app/models/project_services/external_wiki_service.rb +++ b/app/models/project_services/external_wiki_service.rb @@ -39,7 +39,7 @@ class ExternalWikiService < Service def execute(_data) response = Gitlab::HTTP.get(properties['external_wiki_url'], verify: true) response.body if response.code == 200 - rescue + rescue StandardError nil end diff --git a/app/models/project_services/irker_service.rb b/app/models/project_services/irker_service.rb index 4f1ce16ebb2..07b8b554ec0 100644 --- a/app/models/project_services/irker_service.rb +++ b/app/models/project_services/irker_service.rb @@ -103,7 +103,7 @@ class IrkerService < Service begin new_recipient = URI.join(default_irc_uri, '/', recipient).to_s uri = consider_uri(URI.parse(new_recipient)) - rescue + rescue StandardError log_error("Unable to create a valid URL", default_irc_uri: default_irc_uri, recipient: recipient) end end diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb index 3e14bf44c12..7d8019d7027 100644 --- a/app/models/project_services/jira_service.rb +++ b/app/models/project_services/jira_service.rb @@ -305,7 +305,7 @@ class JiraService < IssueTrackerService ) true - rescue => error + rescue StandardError => error log_error( "Issue transition failed", error: { @@ -490,7 +490,7 @@ class JiraService < IssueTrackerService # Handle errors when doing Jira API calls def jira_request yield - rescue => error + rescue StandardError => error @error = error log_error("Error sending message", client_url: client_url, error: @error.message) nil diff --git a/app/models/project_team.rb b/app/models/project_team.rb index 1a3f362e6a1..fa99e2cb1a7 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -130,7 +130,7 @@ class ProjectTeam end true - rescue + rescue StandardError false end diff --git a/app/models/release_highlight.rb b/app/models/release_highlight.rb index 98d9899a349..4b0ae251a9f 100644 --- a/app/models/release_highlight.rb +++ b/app/models/release_highlight.rb @@ -32,7 +32,7 @@ class ReleaseHighlight begin item.tap {|i| i['body'] = Kramdown::Document.new(i['body']).to_html } - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, file_path: file_path) next diff --git a/app/models/remote_mirror.rb b/app/models/remote_mirror.rb index c7387d2197d..1ba69aa9e4d 100644 --- a/app/models/remote_mirror.rb +++ b/app/models/remote_mirror.rb @@ -214,7 +214,7 @@ class RemoteMirror < ApplicationRecord if super Gitlab::UrlSanitizer.new(super, credentials: credentials).full_url end - rescue + rescue StandardError super end @@ -275,7 +275,7 @@ class RemoteMirror < ApplicationRecord return url unless ssh_key_auth? && password.present? Gitlab::UrlSanitizer.new(read_attribute(:url), credentials: { user: user }).full_url - rescue + rescue StandardError super end diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 5fdd4551982..fb3c190a637 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -118,7 +118,7 @@ class Snippet < ApplicationRecord def self.only_include_projects_visible_to(current_user = nil) levels = Gitlab::VisibilityLevel.levels_for_user(current_user) - joins(:project).where('projects.visibility_level IN (?)', levels) + joins(:project).where(projects: { visibility_level: levels }) end def self.only_include_projects_with_snippets_enabled(include_private: false) diff --git a/app/models/storage/legacy_project.rb b/app/models/storage/legacy_project.rb index f643d52587e..092e5249a3e 100644 --- a/app/models/storage/legacy_project.rb +++ b/app/models/storage/legacy_project.rb @@ -34,7 +34,7 @@ module Storage begin gitlab_shell.mv_repository(repository_storage, "#{old_full_path}.wiki", "#{new_full_path}.wiki") return true - rescue => e + rescue StandardError => e Gitlab::AppLogger.error("Exception renaming #{old_full_path} -> #{new_full_path}: #{e}") # Returning false does not rollback after_* transaction but gives # us information about failing some of tasks diff --git a/app/models/wiki.rb b/app/models/wiki.rb index 089fc887d97..40527800783 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -88,7 +88,7 @@ class Wiki repository.create_if_not_exists raise CouldNotCreateWikiError unless repository_exists? - rescue => err + rescue StandardError => err Gitlab::ErrorTracking.track_exception(err, wiki: { container_type: container.class.name, container_id: container.id, diff --git a/app/services/audit_event_service.rb b/app/services/audit_event_service.rb index d1558c60c3d..617e70989bb 100644 --- a/app/services/audit_event_service.rb +++ b/app/services/audit_event_service.rb @@ -131,7 +131,7 @@ class AuditEventService def save_or_track(event) event.save! - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, audit_event_type: event.class.to_s) end end diff --git a/app/services/auto_merge/base_service.rb b/app/services/auto_merge/base_service.rb index 41236286d23..142eebca2e3 100644 --- a/app/services/auto_merge/base_service.rb +++ b/app/services/auto_merge/base_service.rb @@ -15,7 +15,7 @@ module AutoMerge AutoMergeProcessWorker.perform_async(merge_request.id) strategy.to_sym - rescue => e + rescue StandardError => e track_exception(e, merge_request) :failed end @@ -35,7 +35,7 @@ module AutoMerge end success - rescue => e + rescue StandardError => e track_exception(e, merge_request) error("Can't cancel the automatic merge", 406) end @@ -47,7 +47,7 @@ module AutoMerge end success - rescue => e + rescue StandardError => e track_exception(e, merge_request) error("Can't abort the automatic merge", 406) end diff --git a/app/services/boards/base_items_list_service.rb b/app/services/boards/base_items_list_service.rb index 5aebf216460..cbc7a332cbe 100644 --- a/app/services/boards/base_items_list_service.rb +++ b/app/services/boards/base_items_list_service.rb @@ -129,7 +129,7 @@ module Boards # rubocop: disable CodeReuse/ActiveRecord def label_links(label_ids) LabelLink - .where('label_links.target_type = ?', item_model) + .where(label_links: { target_type: item_model }) .where(item_model.arel_table[:id].eq(LabelLink.arel_table[:target_id]).to_sql) .where(label_id: label_ids) end diff --git a/app/services/ci/archive_trace_service.rb b/app/services/ci/archive_trace_service.rb index 9b2c7788897..bc3219fbd79 100644 --- a/app/services/ci/archive_trace_service.rb +++ b/app/services/ci/archive_trace_service.rb @@ -24,7 +24,7 @@ module Ci end rescue ::Gitlab::Ci::Trace::AlreadyArchivedError # It's already archived, thus we can safely ignore this exception. - rescue => e + rescue StandardError => e # Tracks this error with application logs, Sentry, and Prometheus. # If `archive!` keeps failing for over a week, that could incur data loss. # (See more https://docs.gitlab.com/ee/administration/job_logs.html#new-incremental-logging-architecture) diff --git a/app/services/ci/generate_codequality_mr_diff_report_service.rb b/app/services/ci/generate_codequality_mr_diff_report_service.rb index 3b1bd319a4f..50f5f894ba4 100644 --- a/app/services/ci/generate_codequality_mr_diff_report_service.rb +++ b/app/services/ci/generate_codequality_mr_diff_report_service.rb @@ -14,7 +14,7 @@ module Ci key: key(base_pipeline, head_pipeline), data: head_pipeline.pipeline_artifacts.find_by_file_type(:code_quality_mr_diff).present.for_files(merge_request.new_paths) } - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, project_id: project.id) { status: :error, diff --git a/app/services/ci/generate_coverage_reports_service.rb b/app/services/ci/generate_coverage_reports_service.rb index 4e6fbc5462a..12b1f19f4b5 100644 --- a/app/services/ci/generate_coverage_reports_service.rb +++ b/app/services/ci/generate_coverage_reports_service.rb @@ -14,7 +14,7 @@ module Ci key: key(base_pipeline, head_pipeline), data: head_pipeline.pipeline_artifacts.find_by_file_type(:code_coverage).present.for_files(merge_request.new_paths) } - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception( e, project_id: project.id, diff --git a/app/services/ci/generate_exposed_artifacts_report_service.rb b/app/services/ci/generate_exposed_artifacts_report_service.rb index 1dbcd192279..dfa7cbd7d98 100644 --- a/app/services/ci/generate_exposed_artifacts_report_service.rb +++ b/app/services/ci/generate_exposed_artifacts_report_service.rb @@ -14,7 +14,7 @@ module Ci key: key(base_pipeline, head_pipeline), data: data } - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, project_id: project.id) { status: :error, diff --git a/app/services/ci/generate_terraform_reports_service.rb b/app/services/ci/generate_terraform_reports_service.rb index d768ce777d4..0ffb2d7e34a 100644 --- a/app/services/ci/generate_terraform_reports_service.rb +++ b/app/services/ci/generate_terraform_reports_service.rb @@ -13,7 +13,7 @@ module Ci key: key(base_pipeline, head_pipeline), data: head_pipeline.terraform_reports.plans } - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, project_id: project.id) { status: :error, diff --git a/app/services/ci/job_artifacts/create_service.rb b/app/services/ci/job_artifacts/create_service.rb index 65752e56c64..a22ac87f660 100644 --- a/app/services/ci/job_artifacts/create_service.rb +++ b/app/services/ci/job_artifacts/create_service.rb @@ -136,7 +136,7 @@ module Ci rescue *OBJECT_STORAGE_ERRORS => error track_exception(error, params) error(error.message, :service_unavailable) - rescue => error + rescue StandardError => error track_exception(error, params) error(error.message, :bad_request) end diff --git a/app/services/ci/prepare_build_service.rb b/app/services/ci/prepare_build_service.rb index 3f87c711270..ec61c43cce9 100644 --- a/app/services/ci/prepare_build_service.rb +++ b/app/services/ci/prepare_build_service.rb @@ -12,7 +12,7 @@ module Ci prerequisites.each(&:complete!) build.enqueue_preparing! - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, build_id: build.id) build.drop(:unmet_prerequisites) diff --git a/app/services/ci/register_job_service.rb b/app/services/ci/register_job_service.rb index 90341b26fd6..ab5aac55515 100644 --- a/app/services/ci/register_job_service.rb +++ b/app/services/ci/register_job_service.rb @@ -169,7 +169,7 @@ module Ci @metrics.increment_queue_operation(:build_conflict_transition) Result.new(nil, nil, false) - rescue => ex + rescue StandardError => ex @metrics.increment_queue_operation(:build_conflict_exception) # If an error (e.g. GRPC::DeadlineExceeded) occurred constructing @@ -233,7 +233,7 @@ module Ci Gitlab::OptimisticLocking.retry_lock(build, 3, name: 'register_job_scheduler_failure') do |subject| subject.drop!(:scheduler_failure) end - rescue => ex + rescue StandardError => ex build.doom! # This requires extra exception, otherwise we would loose information diff --git a/app/services/ci/stop_environments_service.rb b/app/services/ci/stop_environments_service.rb index 8c9ba849d2e..7c9fc44e7f4 100644 --- a/app/services/ci/stop_environments_service.rb +++ b/app/services/ci/stop_environments_service.rb @@ -27,7 +27,7 @@ module Ci stop_actions.each do |stop_action| stop_action.play(stop_action.user) - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, deployable_id: stop_action.id) end end diff --git a/app/services/clusters/applications/check_installation_progress_service.rb b/app/services/clusters/applications/check_installation_progress_service.rb index 249abd3ff9d..10a12f30956 100644 --- a/app/services/clusters/applications/check_installation_progress_service.rb +++ b/app/services/clusters/applications/check_installation_progress_service.rb @@ -19,9 +19,7 @@ module Clusters def check_timeout if timed_out? - begin - app.make_errored!("Operation timed out. Check pod logs for #{pod_name} for more details.") - end + app.make_errored!("Operation timed out. Check pod logs for #{pod_name} for more details.") else ClusterWaitForAppInstallationWorker.perform_in( ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id) diff --git a/app/services/clusters/applications/check_upgrade_progress_service.rb b/app/services/clusters/applications/check_upgrade_progress_service.rb index bc161218618..c4fd234b302 100644 --- a/app/services/clusters/applications/check_upgrade_progress_service.rb +++ b/app/services/clusters/applications/check_upgrade_progress_service.rb @@ -51,7 +51,7 @@ module Clusters def remove_pod helm_api.delete_pod!(pod_name) - rescue + rescue StandardError # no-op end diff --git a/app/services/container_expiration_policies/cleanup_service.rb b/app/services/container_expiration_policies/cleanup_service.rb index 69e5620d986..b4d38ebdf8f 100644 --- a/app/services/container_expiration_policies/cleanup_service.rb +++ b/app/services/container_expiration_policies/cleanup_service.rb @@ -19,7 +19,7 @@ module ContainerExpirationPolicies service_result = Projects::ContainerRepository::CleanupTagsService .new(project, nil, policy_params.merge('container_expiration_policy' => true)) .execute(repository) - rescue + rescue StandardError repository.cleanup_unfinished! raise diff --git a/app/services/deployments/older_deployments_drop_service.rb b/app/services/deployments/older_deployments_drop_service.rb index 9283a5c1279..100d1267848 100644 --- a/app/services/deployments/older_deployments_drop_service.rb +++ b/app/services/deployments/older_deployments_drop_service.rb @@ -15,7 +15,7 @@ module Deployments Gitlab::OptimisticLocking.retry_lock(older_deployment.deployable, name: 'older_deployments_drop') do |deployable| deployable.drop(:forward_deployment_failure) end - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, subject_id: @deployment.id, deployment_id: older_deployment.id) end end diff --git a/app/services/design_management/copy_design_collection/copy_service.rb b/app/services/design_management/copy_design_collection/copy_service.rb index c0b32e1e9ae..496103f9e58 100644 --- a/app/services/design_management/copy_design_collection/copy_service.rb +++ b/app/services/design_management/copy_design_collection/copy_service.rb @@ -47,7 +47,7 @@ module DesignManagement end ServiceResponse.success - rescue => error + rescue StandardError => error log_exception(error) target_design_collection.error_copy! diff --git a/app/services/ide/schemas_config_service.rb b/app/services/ide/schemas_config_service.rb index 8d2ce97103d..65799c03364 100644 --- a/app/services/ide/schemas_config_service.rb +++ b/app/services/ide/schemas_config_service.rb @@ -10,7 +10,7 @@ module Ide def execute schema = predefined_schema_for(params[:filename]) || {} success(schema: schema) - rescue => e + rescue StandardError => e error(e.message) end diff --git a/app/services/import/base_service.rb b/app/services/import/base_service.rb index 2683c75e41f..4a43b2f7425 100644 --- a/app/services/import/base_service.rb +++ b/app/services/import/base_service.rb @@ -18,7 +18,7 @@ module Import group = Groups::NestedCreateService.new(current_user, group_path: namespace).execute group.errors.any? ? current_user.namespace : group - rescue => e + rescue StandardError => e Gitlab::AppLogger.error(e) current_user.namespace diff --git a/app/services/jira_import/start_import_service.rb b/app/services/jira_import/start_import_service.rb index 88cfe684125..c9ffdeb2a16 100644 --- a/app/services/jira_import/start_import_service.rb +++ b/app/services/jira_import/start_import_service.rb @@ -41,7 +41,7 @@ module JiraImport project.save! && jira_import.schedule! ServiceResponse.success(payload: { import_data: jira_import } ) - rescue => ex + rescue StandardError => ex # in case project.save! raises an error Gitlab::ErrorTracking.track_exception(ex, project_id: project.id) jira_import&.do_fail!(error_message: ex.message) diff --git a/app/services/lfs/lock_file_service.rb b/app/services/lfs/lock_file_service.rb index 1b283018c16..03f8946362b 100644 --- a/app/services/lfs/lock_file_service.rb +++ b/app/services/lfs/lock_file_service.rb @@ -12,7 +12,7 @@ module Lfs error('already locked', 409, current_lock) rescue Gitlab::GitAccess::ForbiddenError => ex error(ex.message, 403) - rescue => ex + rescue StandardError => ex error(ex.message, 500) end diff --git a/app/services/lfs/locks_finder_service.rb b/app/services/lfs/locks_finder_service.rb index 192ce3d3c2a..a77be643478 100644 --- a/app/services/lfs/locks_finder_service.rb +++ b/app/services/lfs/locks_finder_service.rb @@ -4,7 +4,7 @@ module Lfs class LocksFinderService < BaseService def execute success(locks: find_locks) - rescue => ex + rescue StandardError => ex error(ex.message, 500) end diff --git a/app/services/lfs/push_service.rb b/app/services/lfs/push_service.rb index 9e15e9ac64e..e21988aa561 100644 --- a/app/services/lfs/push_service.rb +++ b/app/services/lfs/push_service.rb @@ -16,7 +16,7 @@ module Lfs end success - rescue => err + rescue StandardError => err Gitlab::ErrorTracking.log_exception(err, extra_context) error(err.message) end diff --git a/app/services/lfs/unlock_file_service.rb b/app/services/lfs/unlock_file_service.rb index a13e89904a0..f69f4091606 100644 --- a/app/services/lfs/unlock_file_service.rb +++ b/app/services/lfs/unlock_file_service.rb @@ -12,7 +12,7 @@ module Lfs error(ex.message, 403) rescue ActiveRecord::RecordNotFound error(_('Lock not found'), 404) - rescue => ex + rescue StandardError => ex error(ex.message, 500) end diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb index 27f474b0fe7..b580ab9e66b 100644 --- a/app/services/merge_requests/merge_service.rb +++ b/app/services/merge_requests/merge_service.rb @@ -96,7 +96,7 @@ module MergeRequests rescue Gitlab::Git::PreReceiveError => e raise MergeError, "Something went wrong during merge pre-receive hook. #{e.message}".strip - rescue => e + rescue StandardError => e handle_merge_error(log_message: e.message) raise_error(GENERIC_ERROR_MESSAGE) end diff --git a/app/services/merge_requests/rebase_service.rb b/app/services/merge_requests/rebase_service.rb index 87808a21a15..ae8398e2335 100644 --- a/app/services/merge_requests/rebase_service.rb +++ b/app/services/merge_requests/rebase_service.rb @@ -27,7 +27,7 @@ module MergeRequests repository.rebase(current_user, merge_request, skip_ci: @skip_ci) true - rescue => e + rescue StandardError => e log_error(exception: e, message: REBASE_ERROR, save_message_on_model: true) false diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index 1f40c21d650..6a5a7196c61 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -213,7 +213,7 @@ module MergeRequests # If the a commit no longer exists in this repo, gitlab_git throws # a Rugged::OdbError. This is fixed in https://gitlab.com/gitlab-org/gitlab_git/merge_requests/52 @commits = @project.repository.commits_between(common_ref, @push.newrev) if common_ref - rescue + rescue StandardError end elsif @push.branch_removed? # No commits for a deleted branch. diff --git a/app/services/merge_requests/squash_service.rb b/app/services/merge_requests/squash_service.rb index faa2e921581..31c49b3ae70 100644 --- a/app/services/merge_requests/squash_service.rb +++ b/app/services/merge_requests/squash_service.rb @@ -29,7 +29,7 @@ module MergeRequests squash_sha = repository.squash(current_user, merge_request, message || merge_request.default_squash_commit_message) success(squash_sha: squash_sha) - rescue => e + rescue StandardError => e log_error(exception: e, message: 'Failed to squash merge request') false @@ -37,7 +37,7 @@ module MergeRequests def squash_in_progress? merge_request.squash_in_progress? - rescue => e + rescue StandardError => e log_error(exception: e, message: 'Failed to check squash in progress') raise SquashInProgressError, e.message diff --git a/app/services/packages/nuget/update_package_from_metadata_service.rb b/app/services/packages/nuget/update_package_from_metadata_service.rb index 1bcab00bd92..bd19a0a6b62 100644 --- a/app/services/packages/nuget/update_package_from_metadata_service.rb +++ b/app/services/packages/nuget/update_package_from_metadata_service.rb @@ -45,7 +45,7 @@ module Packages ::Packages::UpdateTagsService .new(package, package_tags) .execute - rescue => e + rescue StandardError => e raise InvalidMetadataError, e.message end diff --git a/app/services/packages/rubygems/process_gem_service.rb b/app/services/packages/rubygems/process_gem_service.rb index 59bf2a1ec28..59d3c3f1e7d 100644 --- a/app/services/packages/rubygems/process_gem_service.rb +++ b/app/services/packages/rubygems/process_gem_service.rb @@ -106,7 +106,7 @@ module Packages Packages::PackageFile.find(package_file.id).file.use_file do |file_path| Gem::Package.new(File.open(file_path)) end - rescue + rescue StandardError raise ExtractionError.new('Unable to read gem file') end diff --git a/app/services/pages/migrate_from_legacy_storage_service.rb b/app/services/pages/migrate_from_legacy_storage_service.rb index b6aa08bba01..d102f93e863 100644 --- a/app/services/pages/migrate_from_legacy_storage_service.rb +++ b/app/services/pages/migrate_from_legacy_storage_service.rb @@ -59,7 +59,7 @@ module Pages end @logger.info(message: "Pages legacy storage migration: batch processed", migrated: @migrated, errored: @errored) - rescue => e + rescue StandardError => e # This method should never raise exception otherwise all threads might be killed # and this will result in queue starving (and deadlock) Gitlab::ErrorTracking.track_exception(e) @@ -81,7 +81,7 @@ module Pages @logger.error(message: "Pages legacy storage migration: project failed to be migrated: #{result[:message]}", project_id: project.id, pages_path: project.pages_path, duration: time.round(2)) @counters_lock.synchronize { @errored += 1 } end - rescue => e + rescue StandardError => e @counters_lock.synchronize { @errored += 1 } @logger.error(message: "Pages legacy storage migration: project failed to be migrated: #{result[:message]}", project_id: project&.id, pages_path: project&.pages_path) Gitlab::ErrorTracking.track_exception(e, project_id: project&.id) diff --git a/app/services/pages/zip_directory_service.rb b/app/services/pages/zip_directory_service.rb index 6cb79452e1b..895614a84a0 100644 --- a/app/services/pages/zip_directory_service.rb +++ b/app/services/pages/zip_directory_service.rb @@ -31,7 +31,7 @@ module Pages end success(archive_path: output_file, entries_count: entries_count) - rescue => e + rescue StandardError => e FileUtils.rm_f(output_file) if output_file raise e end diff --git a/app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb b/app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb index e14241158a6..ca5df4ce017 100644 --- a/app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb +++ b/app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb @@ -66,7 +66,7 @@ module PagesDomains project_id: pages_domain.project_id, pages_domain: pages_domain.domain ) - rescue => e + rescue StandardError => e # getting authorizations is an additional network request which can raise errors Gitlab::ErrorTracking.track_exception(e) end diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 5fb0bda912e..ceec85c6248 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -72,7 +72,7 @@ module Projects rescue ActiveRecord::RecordInvalid => e message = "Unable to save #{e.inspect}: #{e.record.errors.full_messages.join(", ")}" fail(error: message) - rescue => e + rescue StandardError => e @project.errors.add(:base, e.message) if @project fail(error: e.message) end diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb index bf3d005ac1c..b151b6b3830 100644 --- a/app/services/projects/destroy_service.rb +++ b/app/services/projects/destroy_service.rb @@ -41,7 +41,7 @@ module Projects current_user.invalidate_personal_projects_count true - rescue => error + rescue StandardError => error attempt_rollback(project, error.message) false rescue Exception => error # rubocop:disable Lint/RescueException diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb index b4abb5b6df7..9879ffde60a 100644 --- a/app/services/projects/import_service.rb +++ b/app/services/projects/import_service.rb @@ -29,7 +29,7 @@ module Projects Gitlab::ErrorTracking.track_exception(e, project_path: project.full_path, importer: project.import_type) error(s_("ImportProjects|Error importing repository %{project_safe_import_url} into %{project_full_path} - %{message}") % { project_safe_import_url: project.safe_import_url, project_full_path: project.full_path, message: e.message }) - rescue => e + rescue StandardError => e message = Projects::ImportErrorFilter.filter_message(e.message) Gitlab::ErrorTracking.track_exception(e, project_path: project.full_path, importer: project.import_type) diff --git a/app/services/projects/lfs_pointers/lfs_import_service.rb b/app/services/projects/lfs_pointers/lfs_import_service.rb index 2afcce7099b..3fc82f2c410 100644 --- a/app/services/projects/lfs_pointers/lfs_import_service.rb +++ b/app/services/projects/lfs_pointers/lfs_import_service.rb @@ -16,7 +16,7 @@ module Projects end success - rescue => e + rescue StandardError => e error(e.message) end end diff --git a/app/services/projects/update_pages_configuration_service.rb b/app/services/projects/update_pages_configuration_service.rb index b63903c6c61..4272e1dc8b6 100644 --- a/app/services/projects/update_pages_configuration_service.rb +++ b/app/services/projects/update_pages_configuration_service.rb @@ -102,7 +102,7 @@ module Projects File.open(file, 'r') do |f| f.read end - rescue + rescue StandardError nil end end diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb index 6fa42b293c5..1ecf4beb7e2 100644 --- a/app/services/projects/update_pages_service.rb +++ b/app/services/projects/update_pages_service.rb @@ -48,7 +48,7 @@ module Projects end rescue InvalidStateError => e error(e.message) - rescue => e + rescue StandardError => e error(e.message) raise e end @@ -145,7 +145,7 @@ module Projects FileUtils.mkdir_p(pages_path) begin FileUtils.move(public_path, previous_public_path) - rescue + rescue StandardError end FileUtils.move(archive_public_path, public_path) ensure diff --git a/app/services/projects/update_remote_mirror_service.rb b/app/services/projects/update_remote_mirror_service.rb index 8832a1bc027..9f4f6133d92 100644 --- a/app/services/projects/update_remote_mirror_service.rb +++ b/app/services/projects/update_remote_mirror_service.rb @@ -24,7 +24,7 @@ module Projects hard_retry_or_fail(remote_mirror, e.message, tries) error(e.message) - rescue => e + rescue StandardError => e remote_mirror.hard_fail!(e.message) raise e end diff --git a/app/services/releases/create_service.rb b/app/services/releases/create_service.rb index 11fdbaf3169..1096e207e02 100644 --- a/app/services/releases/create_service.rb +++ b/app/services/releases/create_service.rb @@ -57,7 +57,7 @@ module Releases create_evidence!(release, evidence_pipeline) success(tag: tag, release: release) - rescue => e + rescue StandardError => e error(e.message, 400) end diff --git a/app/services/snippets/bulk_destroy_service.rb b/app/services/snippets/bulk_destroy_service.rb index a612d8f8dfc..430e8330b59 100644 --- a/app/services/snippets/bulk_destroy_service.rb +++ b/app/services/snippets/bulk_destroy_service.rb @@ -27,7 +27,7 @@ module Snippets rescue DeleteRepositoryError attempt_rollback_repositories service_response_error('Failed to delete snippet repositories.', 400) - rescue + rescue StandardError # In case the delete operation fails attempt_rollback_repositories service_response_error('Failed to remove snippets.', 400) diff --git a/app/services/snippets/create_service.rb b/app/services/snippets/create_service.rb index c95b459cd2a..aadf9b865b8 100644 --- a/app/services/snippets/create_service.rb +++ b/app/services/snippets/create_service.rb @@ -69,7 +69,7 @@ module Snippets end snippet_saved - rescue => e # Rescuing all because we can receive Creation exceptions, GRPC exceptions, Git exceptions, ... + rescue StandardError => e # Rescuing all because we can receive Creation exceptions, GRPC exceptions, Git exceptions, ... Gitlab::ErrorTracking.log_exception(e, service: 'Snippets::CreateService') # If the commit action failed we need to remove the repository if exists diff --git a/app/services/snippets/destroy_service.rb b/app/services/snippets/destroy_service.rb index f1f80dbaf86..9bd74306cab 100644 --- a/app/services/snippets/destroy_service.rb +++ b/app/services/snippets/destroy_service.rb @@ -30,7 +30,7 @@ module Snippets ServiceResponse.success(message: 'Snippet was deleted.') rescue DestroyError service_response_error('Failed to remove snippet repository.', 400) - rescue + rescue StandardError attempt_rollback_repository service_response_error('Failed to remove snippet.', 400) end diff --git a/app/services/snippets/update_service.rb b/app/services/snippets/update_service.rb index aedb6a4819d..4088a08272d 100644 --- a/app/services/snippets/update_service.rb +++ b/app/services/snippets/update_service.rb @@ -78,7 +78,7 @@ module Snippets create_commit(snippet) true - rescue => e + rescue StandardError => e # Restore old attributes but re-assign changes so they're not lost unless snippet.previous_changes.empty? snippet.previous_changes.each { |attr, value| snippet[attr] = value[0] } diff --git a/app/services/spam/akismet_service.rb b/app/services/spam/akismet_service.rb index e11a1dbdd96..75673518b48 100644 --- a/app/services/spam/akismet_service.rb +++ b/app/services/spam/akismet_service.rb @@ -26,7 +26,7 @@ module Spam begin is_spam, is_blatant = akismet_client.check(options[:ip_address], options[:user_agent], params) is_spam || is_blatant - rescue => e + rescue StandardError => e Gitlab::AppLogger.error("Unable to connect to Akismet: #{e}, skipping check") false end @@ -66,7 +66,7 @@ module Spam begin akismet_client.public_send(type, options[:ip_address], options[:user_agent], params) # rubocop:disable GitlabSecurity/PublicSend true - rescue => e + rescue StandardError => e Gitlab::AppLogger.error("Unable to connect to Akismet: #{e}, skipping!") false end diff --git a/app/services/spam/spam_verdict_service.rb b/app/services/spam/spam_verdict_service.rb index 7de3bad607a..2463a5227d0 100644 --- a/app/services/spam/spam_verdict_service.rb +++ b/app/services/spam/spam_verdict_service.rb @@ -58,7 +58,7 @@ module Spam # @TODO: log error via try_post https://gitlab.com/gitlab-org/gitlab/-/issues/219223 Gitlab::ErrorTracking.log_exception(e) nil - rescue + rescue StandardError # @TODO log ALLOW end diff --git a/app/services/static_site_editor/config_service.rb b/app/services/static_site_editor/config_service.rb index 7b3115468a5..3237f96290c 100644 --- a/app/services/static_site_editor/config_service.rb +++ b/app/services/static_site_editor/config_service.rb @@ -25,7 +25,7 @@ module StaticSiteEditor ServiceResponse.success(payload: data) rescue ValidationError => e ServiceResponse.error(message: e.message) - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_and_raise_exception(e) end diff --git a/app/services/todos/destroy/confidential_issue_service.rb b/app/services/todos/destroy/confidential_issue_service.rb index 6cdd8c16894..fadc76b1181 100644 --- a/app/services/todos/destroy/confidential_issue_service.rb +++ b/app/services/todos/destroy/confidential_issue_service.rb @@ -37,7 +37,7 @@ module Todos def todos Todo.joins_issue_and_assignees .where(target: issues) - .where('issues.confidential = ?', true) + .where(issues: { confidential: true }) .where('todos.user_id != issues.author_id') .where('todos.user_id != issue_assignees.user_id') end diff --git a/app/services/verify_pages_domain_service.rb b/app/services/verify_pages_domain_service.rb index a9e219547d7..eab1e91dc89 100644 --- a/app/services/verify_pages_domain_service.rb +++ b/app/services/verify_pages_domain_service.rb @@ -90,7 +90,7 @@ class VerifyPagesDomainService < BaseService records.any? do |record| record == domain.keyed_verification_code || record == domain.verification_code end - rescue => err + rescue StandardError => err log_error("Failed to check TXT records on #{domain_name} for #{domain.domain}: #{err}") false end diff --git a/app/uploaders/file_mover.rb b/app/uploaders/file_mover.rb index 887cb702acf..95bc2680ed6 100644 --- a/app/uploaders/file_mover.rb +++ b/app/uploaders/file_mover.rb @@ -54,7 +54,7 @@ class FileMover updated_text = to_model.read_attribute(update_field) .gsub(temp_file_uploader.markdown_link, uploader.markdown_link) to_model.update_attribute(update_field, updated_text) - rescue + rescue StandardError revert false end diff --git a/app/uploaders/object_storage.rb b/app/uploaders/object_storage.rb index d4c74ce277f..44dfa92f2f5 100644 --- a/app/uploaders/object_storage.rb +++ b/app/uploaders/object_storage.rb @@ -483,7 +483,7 @@ module ObjectStorage end file - rescue => e + rescue StandardError => e # in case of failure delete new file new_file.delete unless new_file.nil? # revert back to the old file diff --git a/app/views/admin/application_settings/_signin.html.haml b/app/views/admin/application_settings/_signin.html.haml index 62d6c973efe..12a9f949750 100644 --- a/app/views/admin/application_settings/_signin.html.haml +++ b/app/views/admin/application_settings/_signin.html.haml @@ -6,14 +6,14 @@ .form-check = f.check_box :password_authentication_enabled_for_web, class: 'form-check-input' = f.label :password_authentication_enabled_for_web, class: 'form-check-label' do - Password authentication enabled for web interface + = _('Password authentication enabled for web interface') .form-text.text-muted - When disabled, an external authentication provider must be used. + = _('When disabled, an external authentication provider must be used.') .form-group .form-check = f.check_box :password_authentication_enabled_for_git, class: 'form-check-input' = f.label :password_authentication_enabled_for_git, class: 'form-check-label' do - Password authentication enabled for Git over HTTP(S) + = _('Password authentication enabled for Git over HTTP(S)') .form-text.text-muted When disabled, a Personal Access Token - if Gitlab::Auth::Ldap::Config.enabled? @@ -26,11 +26,11 @@ - oauth_providers_checkboxes.each do |source| = source .form-group - = f.label :two_factor_authentication, 'Two-factor authentication', class: 'label-bold' + = f.label :two_factor_authentication, _('Two-factor authentication'), class: 'label-bold' .form-check = f.check_box :require_two_factor_authentication, class: 'form-check-input' = f.label :require_two_factor_authentication, class: 'form-check-label' do - Require all users to set up Two-factor authentication + = _('Require all users to set up two-factor authentication') .form-group = f.label :admin_mode, _('Admin Mode'), class: 'label-bold' = sprite_icon('lock', css_class: 'gl-icon') @@ -50,19 +50,19 @@ 'https://docs.gitlab.com/ee/user/profile/unknown_sign_in_notification.html', target: '_blank' .form-group - = f.label :two_factor_authentication, 'Two-factor grace period (hours)', class: 'label-bold' + = f.label :two_factor_authentication, _('Two-factor grace period (hours)'), class: 'label-bold' = f.number_field :two_factor_grace_period, min: 0, class: 'form-control gl-form-input', placeholder: '0' - .form-text.text-muted Amount of time (in hours) that users are allowed to skip forced configuration of two-factor authentication + .form-text.text-muted= _('Amount of time (in hours) that users are allowed to skip forced configuration of two-factor authentication') .form-group - = f.label :home_page_url, 'Home page URL', class: 'label-bold' + = f.label :home_page_url, _('Home page URL'), class: 'label-bold' = f.text_field :home_page_url, class: 'form-control gl-form-input', placeholder: 'http://company.example.com', :'aria-describedby' => 'home_help_block' - %span.form-text.text-muted#home_help_block We will redirect non-logged in users to this page + %span.form-text.text-muted#home_help_block= _("We will redirect non-logged in users to this page") .form-group = f.label :after_sign_out_path, _('After sign-out path'), class: 'label-bold' = f.text_field :after_sign_out_path, class: 'form-control gl-form-input', placeholder: 'http://company.example.com', :'aria-describedby' => 'after_sign_out_path_help_block' - %span.form-text.text-muted#after_sign_out_path_help_block We will redirect users to this page after they sign out + %span.form-text.text-muted#after_sign_out_path_help_block= _("We will redirect users to this page after they sign out") .form-group = f.label :sign_in_text, _('Sign-in text'), class: 'label-bold' = f.text_area :sign_in_text, class: 'form-control gl-form-input', rows: 4 .form-text.text-muted Markdown enabled - = f.submit 'Save changes', class: "gl-button btn btn-confirm" + = f.submit _('Save changes'), class: "gl-button btn btn-confirm" diff --git a/app/views/admin/application_settings/_usage.html.haml b/app/views/admin/application_settings/_usage.html.haml index a2d61bd010f..103cd157831 100644 --- a/app/views/admin/application_settings/_usage.html.haml +++ b/app/views/admin/application_settings/_usage.html.haml @@ -8,11 +8,10 @@ .form-check = f.check_box :version_check_enabled, class: 'form-check-input' = f.label :version_check_enabled, class: 'form-check-label' do - Enable version check + = _("Enable version check") .form-text.text-muted - GitLab will inform you if a new version is available. - = link_to 'Learn more', help_page_path('user/admin_area/settings/usage_statistics', anchor: 'version-check') - about what information is shared with GitLab Inc. + = _("GitLab will inform you if a new version is available.") + = _("%{link_start}Learn more%{link_end} about what information is shared with GitLab Inc.").html_safe % { link_start: "<a href='#{help_page_path("user/admin_area/settings/usage_statistics", anchor: "version-check")}'>".html_safe, link_end: '</a>'.html_safe } .form-group - can_be_configured = @application_setting.usage_ping_can_be_configured? .form-check @@ -37,4 +36,4 @@ - deactivating_usage_ping_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: deactivating_usage_ping_path } = s_('For more information, see the documentation on %{deactivating_usage_ping_link_start}deactivating the usage ping%{deactivating_usage_ping_link_end}.').html_safe % { deactivating_usage_ping_link_start: deactivating_usage_ping_link_start, deactivating_usage_ping_link_end: '</a>'.html_safe } - = f.submit 'Save changes', class: "gl-button btn btn-confirm" + = f.submit _('Save changes'), class: "gl-button btn btn-confirm" diff --git a/app/views/admin/users/edit.html.haml b/app/views/admin/users/edit.html.haml index 7d10e839cd6..e3ebb691ba9 100644 --- a/app/views/admin/users/edit.html.haml +++ b/app/views/admin/users/edit.html.haml @@ -1,5 +1,5 @@ - page_title _("Edit"), @user.name, _("Users") %h3.page-title - Edit user: #{@user.name} + = _("Edit user: %{user_name}") % { user_name: @user.name } %hr = render 'form' diff --git a/app/views/devise/mailer/unlock_instructions.text.erb b/app/views/devise/mailer/unlock_instructions.text.erb index 8d4abbf3500..9b1e2166cee 100644 --- a/app/views/devise/mailer/unlock_instructions.text.erb +++ b/app/views/devise/mailer/unlock_instructions.text.erb @@ -1,7 +1,5 @@ -Hello, <%= @resource.name %>! +<%= _('Hello, %{name}!') % { name: @resource.name } %> -Your GitLab account has been locked due to an excessive amount of unsuccessful -sign in attempts. Your account will automatically unlock in <%= distance_of_time_in_words(Devise.unlock_in) %> -or you may click the link below to unlock now. +<%= _("Your GitLab account has been locked due to an excessive amount of unsuccessful sign in attempts. Your account will automatically unlock in %{duration} or you may click the link below to unlock now.") % { duration: distance_of_time_in_words(Devise.unlock_in) } %> <%= unlock_url(@resource, unlock_token: @token) %> diff --git a/app/views/layouts/nav/sidebar/_project_menus.html.haml b/app/views/layouts/nav/sidebar/_project_menus.html.haml index ed072c0f6a2..f8db96ad673 100644 --- a/app/views/layouts/nav/sidebar/_project_menus.html.haml +++ b/app/views/layouts/nav/sidebar/_project_menus.html.haml @@ -1,47 +1,3 @@ -- if project_nav_tab? :issues - = nav_link(controller: @project.issues_enabled? ? ['projects/issues', :labels, :milestones, :boards, :iterations] : 'projects/issues') do - = link_to project_issues_path(@project), class: 'shortcuts-issues qa-issues-item' do - .nav-icon-container - = sprite_icon('issues') - %span.nav-item-name#js-onboarding-issues-link - = _('Issues') - - if @project.issues_enabled? - %span.badge.badge-pill.count.issue_counter - = number_with_delimiter(@project.open_issues_count(current_user)) - - %ul.sidebar-sub-level-items - = nav_link(controller: 'projects/issues', action: :index, html_options: { class: "fly-out-top-item" } ) do - = link_to project_issues_path(@project) do - %strong.fly-out-top-item-name - = _('Issues') - - if @project.issues_enabled? - %span.badge.badge-pill.count.issue_counter.fly-out-badge - = number_with_delimiter(@project.open_issues_count(current_user)) - %li.divider.fly-out-top-item - = nav_link(controller: :issues, action: :index) do - = link_to project_issues_path(@project), title: _('Issues') do - %span - = _('List') - - = nav_link(controller: :boards) do - = link_to project_boards_path(@project), title: boards_link_text, data: { qa_selector: "issue_boards_link" } do - %span - = boards_link_text - - = nav_link(controller: :labels) do - = link_to project_labels_path(@project), title: _('Labels'), class: 'qa-labels-link' do - %span - = _('Labels') - - = render 'projects/sidebar/issues_service_desk' - - = nav_link(controller: :milestones) do - = link_to project_milestones_path(@project), title: _('Milestones'), class: 'qa-milestones-link' do - %span - = _('Milestones') - - = render_if_exists 'layouts/nav/sidebar/project_iterations_link' - - if project_nav_tab?(:external_issue_tracker) - issue_tracker = @project.external_issue_tracker - if issue_tracker.is_a?(JiraService) && project_jira_issues_integration? diff --git a/app/views/projects/sidebar/_issues_service_desk.html.haml b/app/views/projects/sidebar/_issues_service_desk.html.haml deleted file mode 100644 index 2730fe37f28..00000000000 --- a/app/views/projects/sidebar/_issues_service_desk.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -= nav_link(controller: :issues, action: :service_desk ) do - = link_to service_desk_project_issues_path(@project), title: 'Service Desk' do - = _('Service Desk') diff --git a/app/workers/bulk_import_worker.rb b/app/workers/bulk_import_worker.rb index b4b9d9b05c1..011a3d1d5e4 100644 --- a/app/workers/bulk_import_worker.rb +++ b/app/workers/bulk_import_worker.rb @@ -29,7 +29,7 @@ class BulkImportWorker # rubocop:disable Scalability/IdempotentWorker end re_enqueue - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e, bulk_import_id: @bulk_import&.id) @bulk_import&.fail_op diff --git a/app/workers/bulk_imports/entity_worker.rb b/app/workers/bulk_imports/entity_worker.rb index 7f173b738cf..1771a1b8440 100644 --- a/app/workers/bulk_imports/entity_worker.rb +++ b/app/workers/bulk_imports/entity_worker.rb @@ -26,7 +26,7 @@ module BulkImports entity_id ) end - rescue => e + rescue StandardError => e logger.error( worker: self.class.name, entity_id: entity_id, diff --git a/app/workers/bulk_imports/pipeline_worker.rb b/app/workers/bulk_imports/pipeline_worker.rb index a6de3c36205..ea4e78cf1ec 100644 --- a/app/workers/bulk_imports/pipeline_worker.rb +++ b/app/workers/bulk_imports/pipeline_worker.rb @@ -46,7 +46,7 @@ module BulkImports pipeline_tracker.pipeline_class.new(context).run pipeline_tracker.finish! - rescue => e + rescue StandardError => e pipeline_tracker.fail_op! logger.error( diff --git a/app/workers/concerns/gitlab/github_import/object_importer.rb b/app/workers/concerns/gitlab/github_import/object_importer.rb index 575cd4862b0..1845d004728 100644 --- a/app/workers/concerns/gitlab/github_import/object_importer.rb +++ b/app/workers/concerns/gitlab/github_import/object_importer.rb @@ -32,7 +32,7 @@ module Gitlab counter.increment info(project.id, message: 'importer finished') - rescue => e + rescue StandardError => e error(project.id, e) end diff --git a/app/workers/concerns/gitlab/github_import/stage_methods.rb b/app/workers/concerns/gitlab/github_import/stage_methods.rb index e5985fb94da..916b273a28f 100644 --- a/app/workers/concerns/gitlab/github_import/stage_methods.rb +++ b/app/workers/concerns/gitlab/github_import/stage_methods.rb @@ -14,7 +14,7 @@ module Gitlab try_import(client, project) info(project_id, message: 'stage finished') - rescue => e + rescue StandardError => e error(project_id, e) end diff --git a/app/workers/concerns/limited_capacity/worker.rb b/app/workers/concerns/limited_capacity/worker.rb index 9dd8d942146..863f9063a4b 100644 --- a/app/workers/concerns/limited_capacity/worker.rb +++ b/app/workers/concerns/limited_capacity/worker.rb @@ -69,7 +69,7 @@ module LimitedCapacity job_tracker.register(jid) report_running_jobs_metrics perform_work(*args) - rescue => exception + rescue StandardError => exception raise ensure job_tracker.remove(jid) diff --git a/app/workers/concerns/waitable_worker.rb b/app/workers/concerns/waitable_worker.rb index c3abcdafcf2..e62bd8d9885 100644 --- a/app/workers/concerns/waitable_worker.rb +++ b/app/workers/concerns/waitable_worker.rb @@ -33,7 +33,7 @@ module WaitableWorker args_list.each do |args| new.perform(*args) - rescue + rescue StandardError failed << args end diff --git a/app/workers/create_commit_signature_worker.rb b/app/workers/create_commit_signature_worker.rb index f81baf20d19..8999e1acf4f 100644 --- a/app/workers/create_commit_signature_worker.rb +++ b/app/workers/create_commit_signature_worker.rb @@ -36,7 +36,7 @@ class CreateCommitSignatureWorker # This calculates and caches the signature in the database commits.each do |commit| commit&.signature - rescue => e + rescue StandardError => e Gitlab::AppLogger.error("Failed to create signature for commit #{commit.id}. Error: #{e.message}") end end diff --git a/app/workers/email_receiver_worker.rb b/app/workers/email_receiver_worker.rb index 9ceab9bb878..220611686fb 100644 --- a/app/workers/email_receiver_worker.rb +++ b/app/workers/email_receiver_worker.rb @@ -12,7 +12,7 @@ class EmailReceiverWorker # rubocop:disable Scalability/IdempotentWorker begin Gitlab::Email::Receiver.new(raw).execute - rescue => e + rescue StandardError => e handle_failure(raw, e) end end diff --git a/app/workers/gitlab/jira_import/import_issue_worker.rb b/app/workers/gitlab/jira_import/import_issue_worker.rb index d1ceda4fd6a..01082db67ed 100644 --- a/app/workers/gitlab/jira_import/import_issue_worker.rb +++ b/app/workers/gitlab/jira_import/import_issue_worker.rb @@ -13,7 +13,7 @@ module Gitlab def perform(project_id, jira_issue_id, issue_attributes, waiter_key) issue_id = create_issue(issue_attributes, project_id) JiraImport.cache_issue_mapping(issue_id, jira_issue_id, project_id) - rescue => ex + rescue StandardError => ex # Todo: Record jira issue id(or better jira issue key), # so that we can report the list of failed to import issues to the user # see https://gitlab.com/gitlab-org/gitlab/-/issues/211653 diff --git a/app/workers/issue_placement_worker.rb b/app/workers/issue_placement_worker.rb index 5b547ab0c8d..ca2f862e02a 100644 --- a/app/workers/issue_placement_worker.rb +++ b/app/workers/issue_placement_worker.rb @@ -4,6 +4,7 @@ class IssuePlacementWorker include ApplicationWorker idempotent! + deduplicate :until_executed, including_scheduled: true feature_category :issue_tracking urgency :high worker_resource_boundary :cpu diff --git a/app/workers/object_pool/create_worker.rb b/app/workers/object_pool/create_worker.rb index cf87ad95077..c2bfe4e604a 100644 --- a/app/workers/object_pool/create_worker.rb +++ b/app/workers/object_pool/create_worker.rb @@ -28,7 +28,7 @@ module ObjectPool pool.create_object_pool pool.mark_ready - rescue => e + rescue StandardError => e pool.mark_failed raise e end diff --git a/app/workers/object_storage/migrate_uploads_worker.rb b/app/workers/object_storage/migrate_uploads_worker.rb index 666bacb0188..6655e8b7281 100644 --- a/app/workers/object_storage/migrate_uploads_worker.rb +++ b/app/workers/object_storage/migrate_uploads_worker.rb @@ -132,7 +132,7 @@ module ObjectStorage def process_uploader(uploader) MigrationResult.new(uploader.upload).tap do |result| uploader.migrate!(@to_store) - rescue => e + rescue StandardError => e result.error = e end end diff --git a/app/workers/packages/composer/cache_cleanup_worker.rb b/app/workers/packages/composer/cache_cleanup_worker.rb index 638e50e18c4..1b95bbeb906 100644 --- a/app/workers/packages/composer/cache_cleanup_worker.rb +++ b/app/workers/packages/composer/cache_cleanup_worker.rb @@ -22,7 +22,7 @@ module Packages rescue ActiveRecord::RecordNotFound # ignore. likely due to object already being deleted. end - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.log_exception(e) end end diff --git a/app/workers/packages/composer/cache_update_worker.rb b/app/workers/packages/composer/cache_update_worker.rb index 664fb23284f..9d6ea25a1a5 100644 --- a/app/workers/packages/composer/cache_update_worker.rb +++ b/app/workers/packages/composer/cache_update_worker.rb @@ -15,7 +15,7 @@ module Packages return unless project Gitlab::Composer::Cache.new(project: project, name: package_name, last_page_sha: last_page_sha).execute - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.log_exception(e, project_id: project_id) end end diff --git a/app/workers/pages_domain_removal_cron_worker.rb b/app/workers/pages_domain_removal_cron_worker.rb index cb24441d2f7..cfcd2a5064d 100644 --- a/app/workers/pages_domain_removal_cron_worker.rb +++ b/app/workers/pages_domain_removal_cron_worker.rb @@ -10,7 +10,7 @@ class PagesDomainRemovalCronWorker # rubocop:disable Scalability/IdempotentWorke def perform PagesDomain.for_removal.with_logging_info.find_each do |domain| with_context(project: domain.project) { domain.destroy! } - rescue => e + rescue StandardError => e Gitlab::ErrorTracking.track_exception(e) end end diff --git a/app/workers/project_service_worker.rb b/app/workers/project_service_worker.rb index 84c3a3e52d0..8e1fef74a89 100644 --- a/app/workers/project_service_worker.rb +++ b/app/workers/project_service_worker.rb @@ -11,7 +11,7 @@ class ProjectServiceWorker # rubocop:disable Scalability/IdempotentWorker data = data.with_indifferent_access service = Service.find(hook_id) service.execute(data) - rescue => error + rescue StandardError => error service_class = service&.class&.name || "Not Found" logger.error class: self.class.name, service_class: service_class, message: error.message end diff --git a/app/workers/projects/git_garbage_collect_worker.rb b/app/workers/projects/git_garbage_collect_worker.rb index 4f908529b34..cf236f8b660 100644 --- a/app/workers/projects/git_garbage_collect_worker.rb +++ b/app/workers/projects/git_garbage_collect_worker.rb @@ -24,7 +24,7 @@ module Projects return if Gitlab::Database.read_only? # GitGarbageCollectWorker may be run on a Geo secondary ::Gitlab::Cleanup::OrphanLfsFileReferences.new(resource, dry_run: false, logger: logger).run! - rescue => err + rescue StandardError => err Gitlab::GitLogger.warn(message: "Cleaning up orphan LFS objects files failed", error: err.message) Gitlab::ErrorTracking.track_and_raise_for_dev_exception(err) end diff --git a/app/workers/remove_expired_members_worker.rb b/app/workers/remove_expired_members_worker.rb index fc2ec047e1c..1f465d77c0e 100644 --- a/app/workers/remove_expired_members_worker.rb +++ b/app/workers/remove_expired_members_worker.rb @@ -26,7 +26,7 @@ class RemoveExpiredMembersWorker # rubocop:disable Scalability/IdempotentWorker Users::DestroyService.new(nil).execute(expired_user, skip_authorization: true) end end - rescue => ex + rescue StandardError => ex logger.error("Expired Member ID=#{member.id} cannot be removed - #{ex}") end end diff --git a/app/workers/run_pipeline_schedule_worker.rb b/app/workers/run_pipeline_schedule_worker.rb index 605dd624260..adaa73ec831 100644 --- a/app/workers/run_pipeline_schedule_worker.rb +++ b/app/workers/run_pipeline_schedule_worker.rb @@ -25,7 +25,7 @@ class RunPipelineScheduleWorker # rubocop:disable Scalability/IdempotentWorker .execute!(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule) rescue Ci::CreatePipelineService::CreateError # no-op. This is a user operation error such as corrupted .gitlab-ci.yml. - rescue => e + rescue StandardError => e error(schedule, e) end diff --git a/app/workers/service_desk_email_receiver_worker.rb b/app/workers/service_desk_email_receiver_worker.rb index 8649034445c..1ae0764bda6 100644 --- a/app/workers/service_desk_email_receiver_worker.rb +++ b/app/workers/service_desk_email_receiver_worker.rb @@ -8,7 +8,7 @@ class ServiceDeskEmailReceiverWorker < EmailReceiverWorker # rubocop:disable Sca begin Gitlab::Email::ServiceDeskReceiver.new(raw).execute - rescue => e + rescue StandardError => e handle_failure(raw, e) end end diff --git a/app/workers/stuck_ci_jobs_worker.rb b/app/workers/stuck_ci_jobs_worker.rb index bd721df73c6..1bb17daf5b4 100644 --- a/app/workers/stuck_ci_jobs_worker.rb +++ b/app/workers/stuck_ci_jobs_worker.rb @@ -73,7 +73,7 @@ class StuckCiJobsWorker # rubocop:disable Scalability/IdempotentWorker Gitlab::OptimisticLocking.retry_lock(build, 3, name: 'stuck_ci_jobs_worker_drop_build') do |b| b.drop(reason) end - rescue => ex + rescue StandardError => ex build.doom! track_exception_for_build(ex, build) |