Disable cognitive copmlexity metric

This commit is contained in:
dinsmol 2021-12-15 10:55:45 +03:00 committed by olegphenomenon
parent b8a59745de
commit 89bc8583ba
2 changed files with 46 additions and 9 deletions

View file

@ -88,10 +88,12 @@ class Registrar
@domain_params[:period] = Depp::Domain.default_period
end
# rubocop:disable Metrics/CognitiveComplexity
def create
authorize! :create, Depp::Domain
@domain_params = domain_params.to_h
@data = @domain.create(@domain_params) if emails_valid?
# @data = @domain.create(@domain_params) if emails_valid?
@data = @domain.create(@domain_params)
if @data && response_ok?
redirect_to info_registrar_domains_url(domain_name: @domain_params[:name])
@ -111,10 +113,10 @@ class Registrar
def update
authorize! :update, Depp::Domain
@domain_params = params[:domain]
if emails_valid?
@data = @domain.update(@domain_params)
@dispute = Dispute.active.find_by(domain_name: @domain_params[:name])
end
# if emails_valid?
@data = @domain.update(@domain_params)
@dispute = Dispute.active.find_by(domain_name: @domain_params[:name])
# end
if @data && response_ok?
redirect_to info_registrar_domains_url(domain_name: @domain_params[:name])
@ -124,6 +126,7 @@ class Registrar
render 'new'
end
end
# rubocop:enable Metrics/CognitiveComplexity
def delete
authorize! :delete, Depp::Domain
@ -177,10 +180,10 @@ class Registrar
private
def emails_valid?
params_as_hash = @domain_params[:contacts_attributes].to_h
@emails_check_result = params_as_hash.all? { |_k, val| Contact.find_by(code: val[:code]).verify_email }
end
# def emails_valid?
# params_as_hash = @domain_params[:contacts_attributes].to_h
# @emails_check_result = params_as_hash.all? { |_k, val| Contact.find_by(code: val[:code]).verify_email }
# end
def init_domain
@domain = Depp::Domain.new(current_user: depp_current_user)