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
return unless krb_principal
identity = ::Identity.find_by(provider: :kerberos, extern_uid: krb_principal)
identity.user if identity
identity&.user
end
# The Kerberos backend will translate spnego_token into a Kerberos
......
......@@ -126,7 +126,7 @@ class Environment < ActiveRecord::Base
return unless available?
stop!
stop_action.play(current_user) if stop_action
stop_action&.play(current_user)
end
def actions_for(environment)
......
......@@ -95,7 +95,7 @@ class GeoNode < ActiveRecord::Base
end
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?
self.oauth_application = nil
......
......@@ -508,7 +508,7 @@ class Project < ActiveRecord::Base
def reset_cache_and_import_attrs
ProjectCacheWorker.perform_async(self.id)
self.import_data&.destroy if !mirror?
self.import_data&.destroy unless mirror?
end
def import_url=(value)
......
......@@ -943,11 +943,8 @@ class Repository
raise 'Invalid merge target' if our_commit.nil?
raise 'Invalid merge source' if their_commit.nil?
GitOperationService.new(user, self).with_branch(
target_branch) do |start_commit|
if merge_request
merge_request.update(in_progress_merge_commit_sha: their_commit.oid)
end
GitOperationService.new(user, self).with_branch(target_branch) do |start_commit|
merge_request&.update(in_progress_merge_commit_sha: their_commit.oid)
their_commit.oid
end
......
......@@ -15,7 +15,7 @@ module Issues
def before_create(issuable)
if @recaptcha_verified
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
issuable.spam = spam_service.check(@api)
issuable.spam_log = spam_service.spam_log
......
......@@ -20,9 +20,9 @@ class AddGroupIdColumnsToProtectedBranchAccessLevels < ActiveRecord::Migration
def change
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_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
......@@ -20,6 +20,6 @@ class AddApproverGroups < ActiveRecord::Migration
t.index :group_id
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
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