mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
Fix rubocop issues that are new to Ruby 2.4
This commit is contained in:
parent
82dbd3e8b8
commit
cf16aa4039
4 changed files with 12 additions and 7 deletions
|
@ -145,7 +145,9 @@ class EppController < ApplicationController
|
||||||
# VALIDATION
|
# VALIDATION
|
||||||
def latin_only
|
def latin_only
|
||||||
return true if params['frame'].blank?
|
return true if params['frame'].blank?
|
||||||
return true if params['frame'].match?(/\A[\p{Latin}\p{Z}\p{P}\p{S}\p{Cc}\p{Cf}\w_\'\+\-\.\(\)\/]*\Z/i)
|
if params['frame'].match?(/\A[\p{Latin}\p{Z}\p{P}\p{S}\p{Cc}\p{Cf}\w_\'\+\-\.\(\)\/]*\Z/i)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
epp_errors << {
|
epp_errors << {
|
||||||
msg: 'Parameter value policy error. Allowed only Latin characters.',
|
msg: 'Parameter value policy error. Allowed only Latin characters.',
|
||||||
|
|
|
@ -34,9 +34,13 @@ module Versions
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_from_id_role_username(str)
|
def user_from_id_role_username(str)
|
||||||
user = ApiUser.find_by(id: $1) if str.match(/^(\d+)-(ApiUser:|api-)/)
|
if str.match(/^(\d+)-(ApiUser:|api-)/)
|
||||||
|
user = ApiUser.find_by(id: $1)
|
||||||
|
end
|
||||||
unless user.present?
|
unless user.present?
|
||||||
user = AdminUser.find_by(id: $1) if str.match(/^(\d+)-AdminUser:/)
|
user = if str.match(/^(\d+)-AdminUser:/)
|
||||||
|
AdminUser.find_by(id: $1)
|
||||||
|
end
|
||||||
unless user.present?
|
unless user.present?
|
||||||
# on import we copied Registrar name, which may eql code
|
# on import we copied Registrar name, which may eql code
|
||||||
registrar = Registrar.find_by(name: str)
|
registrar = Registrar.find_by(name: str)
|
||||||
|
|
|
@ -100,7 +100,7 @@ class Nameserver < ActiveRecord::Base
|
||||||
|
|
||||||
def check_puny_symbols
|
def check_puny_symbols
|
||||||
regexp = /(\A|\.)..--/
|
regexp = /(\A|\.)..--/
|
||||||
errors.add(:hostname, :invalid) if hostname =~ regexp
|
errors.add(:hostname, :invalid) if hostname.match?(regexp)
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_ipv4_format
|
def validate_ipv4_format
|
||||||
|
|
|
@ -10,9 +10,8 @@ class Contact::Ident::RegNoValidator < ActiveModel::EachValidator
|
||||||
|
|
||||||
return unless format
|
return unless format
|
||||||
|
|
||||||
unless value.match?(format)
|
return if value.match?(format)
|
||||||
record.errors.add(attribute, :invalid_reg_no, country: record.country)
|
record.errors.add(attribute, :invalid_reg_no, country: record.country)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue