Skip to content

Commit

Permalink
Fixed codeclimate errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei Tsõganov authored and Sergei Tsõganov committed Apr 14, 2022
1 parent ecb23b4 commit bcd1b3f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions app/interactions/actions/contact_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ def call
def maybe_change_email
return if Rails.env.test?

[:regex, :mx].each do |m|
%i[regex mx].each do |m|
result = Actions::SimpleMailValidator.run(email: contact.email, level: m)

next if result

err_text = "email '#{contact.email}' didn't pass validation"
contact.add_epp_error('2005', nil, nil,
"#{I18n.t(:parameter_value_syntax_error)} #{err_text}")
contact.add_epp_error('2005', nil, nil, "#{I18n.t(:parameter_value_syntax_error)} #{err_text}")
@error = true
return
end
Expand Down
3 changes: 1 addition & 2 deletions app/interactions/actions/contact_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ def maybe_change_email
next if result

err_text = "email '#{new_attributes[:email]}' didn't pass validation"
contact.add_epp_error('2005', nil, nil,
"#{I18n.t(:parameter_value_syntax_error)} #{err_text}")
contact.add_epp_error('2005', nil, nil, "#{I18n.t(:parameter_value_syntax_error)} #{err_text}")
@error = true
return
end
Expand Down
3 changes: 1 addition & 2 deletions app/interactions/actions/domain_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ def validate_email(email)
next if result

err_text = "email #{email} didn't pass validation"
domain.add_epp_error('2005', nil, nil,
"#{I18n.t(:parameter_value_syntax_error)} #{err_text}")
domain.add_epp_error('2005', nil, nil, "#{I18n.t(:parameter_value_syntax_error)} #{err_text}")
@error = true
return
end
Expand Down

0 comments on commit bcd1b3f

Please sign in to comment.