Commit 6ce2b6c9 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Obey Cop/AvoidReturnFromBlocks and Cop/AvoidBreakFromStrongMemoize

parent e50d7588
......@@ -35,7 +35,7 @@ module Geo
# Clean up the state of sync to start a new cycle
registry.delete
log_info("Clean up #{type} sync status")
return
break
end
log_info("Finished #{type} sync")
......
......@@ -12,7 +12,7 @@ module Geo
unless file_registry
log_error('Could not find file_registry')
return
break
end
if File.exist?(file_path)
......
......@@ -18,7 +18,7 @@ module Geo
if Gitlab::Geo.secondary_nodes.empty?
log_info('No secondary nodes, delete all Geo Event Log entries')
Geo::EventLog.delete_all
return
break
end
cursor_last_event_ids = Gitlab::Geo.secondary_nodes.map do |node|
......@@ -27,7 +27,7 @@ module Geo
if cursor_last_event_ids.include?(nil)
log_info('Could not get status of all nodes, not deleting any entries from Geo Event Log', unhealthy_node_count: cursor_last_event_ids.count(nil))
return
break
end
log_info('Delete Geo Event Log entries up to id', geo_event_log_id: cursor_last_event_ids.min)
......
......@@ -12,7 +12,7 @@ module Geo
# Prevent multiple Sidekiq workers from performing repositories clean up
try_obtain_lease do
geo_node = GeoNode.find(geo_node_id)
return unless geo_node.selective_sync?
break unless geo_node.selective_sync?
Project.where.not(id: geo_node.projects).find_in_batches(batch_size: BATCH_SIZE) do |batch|
batch.each do |project|
......
......@@ -49,7 +49,7 @@ module API
post ":id/mirror/pull" do
authenticate_with_webhook_token!
return render_api_error!('The project is not mirrored', 400) unless project.mirror?
break render_api_error!('The project is not mirrored', 400) unless project.mirror?
project.force_import_job!
......
......@@ -48,7 +48,7 @@ module EE
def changes
strong_memoize(:changes) do
return [] unless newrev
next [] unless newrev
project.repository.raw_changes_between(oldrev, newrev)
end
......
......@@ -28,11 +28,11 @@ module Gitlab
host = @hosts[@index]
@index = (@index + 1) % @hosts.length
return host if host.online?
break host if host.online?
# Return nil once we have cycled through all hosts and none were
# available.
return if @index == started_at
break if @index == started_at
end
end
end
......
......@@ -194,7 +194,7 @@ module SystemCheck
if (match = line.match(regexp))
raw_content = match[:content]
# remove linebreak, and lead and trailing spaces
return raw_content.chomp.strip
return raw_content.chomp.strip # rubocop:disable Cop/AvoidReturnFromBlocks
end
end
end
......
......@@ -32,7 +32,7 @@ module API
namespace = find_namespace(params[:id])
return not_found!('Namespace') unless namespace
break not_found!('Namespace') unless namespace
if namespace.update(declared_params)
present namespace, with: Entities::Namespace, current_user: current_user
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment