Commit 7aa40b33 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix rubocop violations

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent a50741de
...@@ -46,7 +46,7 @@ module KerberosSpnegoHelper ...@@ -46,7 +46,7 @@ module KerberosSpnegoHelper
return unless krb_principal return unless krb_principal
identity = ::Identity.find_by(provider: :kerberos, extern_uid: krb_principal) identity = ::Identity.find_by(provider: :kerberos, extern_uid: krb_principal)
identity.user if identity identity&.user
end end
# The Kerberos backend will translate spnego_token into a Kerberos # The Kerberos backend will translate spnego_token into a Kerberos
......
...@@ -126,7 +126,7 @@ class Environment < ActiveRecord::Base ...@@ -126,7 +126,7 @@ class Environment < ActiveRecord::Base
return unless available? return unless available?
stop! stop!
stop_action.play(current_user) if stop_action stop_action&.play(current_user)
end end
def actions_for(environment) def actions_for(environment)
......
...@@ -95,7 +95,7 @@ class GeoNode < ActiveRecord::Base ...@@ -95,7 +95,7 @@ class GeoNode < ActiveRecord::Base
end end
def update_dependents_attributes def update_dependents_attributes
self.geo_node_key.title = "Geo node: #{self.url}" if self.geo_node_key self.geo_node_key&.title = "Geo node: #{self.url}"
if self.primary? if self.primary?
self.oauth_application = nil self.oauth_application = nil
......
...@@ -508,7 +508,7 @@ class Project < ActiveRecord::Base ...@@ -508,7 +508,7 @@ class Project < ActiveRecord::Base
def reset_cache_and_import_attrs def reset_cache_and_import_attrs
ProjectCacheWorker.perform_async(self.id) ProjectCacheWorker.perform_async(self.id)
self.import_data&.destroy if !mirror? self.import_data&.destroy unless mirror?
end end
def import_url=(value) def import_url=(value)
......
...@@ -943,11 +943,8 @@ class Repository ...@@ -943,11 +943,8 @@ class Repository
raise 'Invalid merge target' if our_commit.nil? raise 'Invalid merge target' if our_commit.nil?
raise 'Invalid merge source' if their_commit.nil? raise 'Invalid merge source' if their_commit.nil?
GitOperationService.new(user, self).with_branch( GitOperationService.new(user, self).with_branch(target_branch) do |start_commit|
target_branch) do |start_commit| merge_request&.update(in_progress_merge_commit_sha: their_commit.oid)
if merge_request
merge_request.update(in_progress_merge_commit_sha: their_commit.oid)
end
their_commit.oid their_commit.oid
end end
......
...@@ -15,7 +15,7 @@ module Issues ...@@ -15,7 +15,7 @@ module Issues
def before_create(issuable) def before_create(issuable)
if @recaptcha_verified if @recaptcha_verified
spam_log = current_user.spam_logs.find_by(id: @spam_log_id, title: issuable.title) spam_log = current_user.spam_logs.find_by(id: @spam_log_id, title: issuable.title)
spam_log.update!(recaptcha_verified: true) if spam_log spam_log&.update!(recaptcha_verified: true)
else else
issuable.spam = spam_service.check(@api) issuable.spam = spam_service.check(@api)
issuable.spam_log = spam_service.spam_log issuable.spam_log = spam_service.spam_log
......
...@@ -20,9 +20,9 @@ class AddGroupIdColumnsToProtectedBranchAccessLevels < ActiveRecord::Migration ...@@ -20,9 +20,9 @@ class AddGroupIdColumnsToProtectedBranchAccessLevels < ActiveRecord::Migration
def change def change
add_column :protected_branch_merge_access_levels, :group_id, :integer add_column :protected_branch_merge_access_levels, :group_id, :integer
add_foreign_key :protected_branch_merge_access_levels, :namespaces, column: :group_id add_foreign_key :protected_branch_merge_access_levels, :namespaces, column: :group_id # rubocop: disable Migration/AddConcurrentForeignKey
add_column :protected_branch_push_access_levels, :group_id, :integer add_column :protected_branch_push_access_levels, :group_id, :integer
add_foreign_key :protected_branch_push_access_levels, :namespaces, column: :group_id add_foreign_key :protected_branch_push_access_levels, :namespaces, column: :group_id # rubocop: disable Migration/AddConcurrentForeignKey
end end
end end
...@@ -20,6 +20,6 @@ class AddApproverGroups < ActiveRecord::Migration ...@@ -20,6 +20,6 @@ class AddApproverGroups < ActiveRecord::Migration
t.index :group_id t.index :group_id
end end
add_foreign_key :approver_groups, :namespaces, column: :group_id, on_delete: :cascade add_foreign_key :approver_groups, :namespaces, column: :group_id, on_delete: :cascade # rubocop: disable Migration/AddConcurrentForeignKey
end end
end end
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