Remove Rubocop inline directives

This commit is contained in:
Artur Beljajev 2018-06-07 19:17:16 +03:00
parent 66dd10302d
commit c44f3df7f5
28 changed files with 5 additions and 169 deletions

View file

@ -3,8 +3,7 @@ module Admin
load_and_authorize_resource load_and_authorize_resource
before_action :set_default_dates, only: [:index] before_action :set_default_dates, only: [:index]
def index # rubocop: disable Metrics/AbcSize def index
ca_cache = params[:q][:created_at_lteq] ca_cache = params[:q][:created_at_lteq]
begin begin
end_time = params[:q][:created_at_lteq].try(:to_date) end_time = params[:q][:created_at_lteq].try(:to_date)

View file

@ -4,9 +4,6 @@ module Admin
before_action :set_domain, only: [:show, :edit, :update, :zonefile] before_action :set_domain, only: [:show, :edit, :update, :zonefile]
helper_method :force_delete_templates helper_method :force_delete_templates
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
def index def index
params[:q] ||= {} params[:q] ||= {}
if params[:statuses_contains] if params[:statuses_contains]
@ -35,10 +32,6 @@ module Admin
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? @domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
def show def show
@domain.valid? @domain.valid?
end end

View file

@ -18,8 +18,6 @@ class Epp::DomainsController < EppController
render_epp_response '/epp/domains/info' render_epp_response '/epp/domains/info'
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def create def create
authorize! :create, Epp::Domain authorize! :create, Epp::Domain
@domain = Epp::Domain.new_from_epp(params[:parsed_frame], current_user) @domain = Epp::Domain.new_from_epp(params[:parsed_frame], current_user)
@ -46,8 +44,6 @@ class Epp::DomainsController < EppController
end end
end end
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def update def update
authorize! :update, @domain, @password authorize! :update, @domain, @password

View file

@ -1,7 +1,6 @@
class Epp::KeyrelaysController < EppController class Epp::KeyrelaysController < EppController
skip_authorization_check # TODO: move authorization under ability skip_authorization_check # TODO: move authorization under ability
# rubocop: disable Metrics/CyclomaticComplexity
def keyrelay def keyrelay
# keyrelay temp turned off # keyrelay temp turned off
@domain = find_domain @domain = find_domain
@ -29,7 +28,6 @@ class Epp::KeyrelaysController < EppController
exactly_one_of 'expiry > relative', 'expiry > absolute' exactly_one_of 'expiry > relative', 'expiry > absolute'
end end
# rubocop: enable Metrics/CyclomaticComplexity
def find_domain def find_domain
domain_name = params[:parsed_frame].css('name').text.strip.downcase domain_name = params[:parsed_frame].css('name').text.strip.downcase

View file

@ -5,10 +5,6 @@ class Epp::SessionsController < EppController
render_epp_response('greeting') render_epp_response('greeting')
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
def login def login
success = true success = true
@api_user = ApiUser.find_by(login_params) @api_user = ApiUser.find_by(login_params)
@ -101,10 +97,6 @@ class Epp::SessionsController < EppController
handle_errors handle_errors
end end
end end
# rubocop: enable Metrics/MethodLength
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def ip_white? def ip_white?
webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip) webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip)

View file

@ -59,11 +59,9 @@ class EppController < ApplicationController
end end
if Rails.env.test? || Rails.env.development? if Rails.env.test? || Rails.env.development?
# rubocop:disable Rails/Output
puts e.backtrace.reverse.join("\n") puts e.backtrace.reverse.join("\n")
puts "\n BACKTRACE REVERSED!\n" puts "\n BACKTRACE REVERSED!\n"
puts "\n FROM-EPP-RESCUE: #{e.message}\n\n\n" puts "\n FROM-EPP-RESCUE: #{e.message}\n\n\n"
# rubocop:enable Rails/Output
else else
logger.error "FROM-EPP-RESCUE: #{e.message}" logger.error "FROM-EPP-RESCUE: #{e.message}"
logger.error e.backtrace.join("\n") logger.error e.backtrace.join("\n")
@ -78,9 +76,7 @@ class EppController < ApplicationController
end end
def generate_svtrid def generate_svtrid
# rubocop: disable Style/VariableName
@svTRID = "ccReg-#{format('%010d', rand(10**10))}" @svTRID = "ccReg-#{format('%010d', rand(10**10))}"
# rubocop: enable Style/VariableName
end end
def params_hash # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE def params_hash # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE
@ -324,16 +320,12 @@ class EppController < ApplicationController
epp_errors.empty? epp_errors.empty?
end end
# rubocop: disable Style/PredicateName
def has_attribute(ph, path) # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE def has_attribute(ph, path) # TODO: THIS IS DEPRECATED AND WILL BE REMOVED IN FUTURE
path.reduce(ph) do |location, key| path.reduce(ph) do |location, key|
location.respond_to?(:keys) ? location[key] : nil location.respond_to?(:keys) ? location[key] : nil
end end
end end
# rubocop: enable Style/PredicateName
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
def write_to_epp_log def write_to_epp_log
request_command = params[:command] || params[:action] # error receives :command, other methods receive :action request_command = params[:command] || params[:action] # error receives :command, other methods receive :action
frame = params[:raw_frame] || params[:frame] frame = params[:raw_frame] || params[:frame]
@ -356,8 +348,6 @@ class EppController < ApplicationController
uuid: request.uuid uuid: request.uuid
}) })
end end
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/PerceivedComplexity
def iptables_counter_update def iptables_counter_update
return if ENV['iptables_counter_enabled'].blank? && ENV['iptables_counter_enabled'] != 'true' return if ENV['iptables_counter_enabled'].blank? && ENV['iptables_counter_enabled'] != 'true'

View file

@ -8,8 +8,6 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
@domain = nil unless @domain.registrant_delete_confirmable?(params[:token]) @domain = nil unless @domain.registrant_delete_confirmable?(params[:token])
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/AbcSize
def update def update
@domain = Domain.find(params[:id]) @domain = Domain.find(params[:id])
unless @domain.registrant_delete_confirmable?(params[:token]) unless @domain.registrant_delete_confirmable?(params[:token])
@ -41,6 +39,4 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
end end
end end
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/AbcSize
end end

View file

@ -8,8 +8,6 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
@domain = nil unless @domain.registrant_update_confirmable?(params[:token]) @domain = nil unless @domain.registrant_update_confirmable?(params[:token])
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/AbcSize
def update def update
@domain = Domain.find(params[:id]) @domain = Domain.find(params[:id])
unless @domain.registrant_update_confirmable?(params[:token]) unless @domain.registrant_update_confirmable?(params[:token])
@ -41,6 +39,4 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
end end
end end
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/AbcSize
end end

View file

@ -4,7 +4,6 @@ class Registrant::SessionsController < Devise::SessionsController
def login def login
end end
# rubocop: disable Metrics/AbcSize
def id def id
id_code, id_issuer = request.env['SSL_CLIENT_S_DN'], request.env['SSL_CLIENT_I_DN_O'] id_code, id_issuer = request.env['SSL_CLIENT_S_DN'], request.env['SSL_CLIENT_I_DN_O']
id_code, id_issuer = 'test', RegistrantUser::ACCEPTED_ISSUER if Rails.env.development? id_code, id_issuer = 'test', RegistrantUser::ACCEPTED_ISSUER if Rails.env.development?
@ -18,14 +17,12 @@ class Registrant::SessionsController < Devise::SessionsController
redirect_to registrant_login_url redirect_to registrant_login_url
end end
end end
# rubocop: enable Metrics/AbcSize
def login_mid def login_mid
@user = User.new @user = User.new
end end
# rubocop: disable Metrics/MethodLength def mid
def mid
phone = params[:user][:phone] phone = params[:user][:phone]
endpoint = "#{ENV['sk_digi_doc_service_endpoint']}" endpoint = "#{ENV['sk_digi_doc_service_endpoint']}"
client = Digidoc::Client.new(endpoint) client = Digidoc::Client.new(endpoint)
@ -57,11 +54,7 @@ class Registrant::SessionsController < Devise::SessionsController
render json: { message: t(:no_such_user) }, status: :unauthorized render json: { message: t(:no_such_user) }, status: :unauthorized
end end
end end
# rubocop: enable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
def mid_status def mid_status
endpoint = "#{ENV['sk_digi_doc_service_endpoint']}" endpoint = "#{ENV['sk_digi_doc_service_endpoint']}"
client = Digidoc::Client.new(endpoint) client = Digidoc::Client.new(endpoint)
@ -99,9 +92,6 @@ class Registrant::SessionsController < Devise::SessionsController
render json: { message: t(:internal_error) }, status: :bad_request render json: { message: t(:internal_error) }, status: :bad_request
end end
end end
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/MethodLength
def find_user_by_idc(idc) def find_user_by_idc(idc)
return User.new unless idc return User.new unless idc

View file

@ -2,7 +2,7 @@ class Registrar
class AccountActivitiesController < BaseController class AccountActivitiesController < BaseController
load_and_authorize_resource load_and_authorize_resource
def index # rubocop: disable Metrics/AbcSize def index
params[:q] ||= {} params[:q] ||= {}
account = current_user.registrar.cash_account account = current_user.registrar.cash_account

View file

@ -3,10 +3,6 @@ class Registrar
before_action :init_domain, except: :new before_action :init_domain, except: :new
helper_method :contacts helper_method :contacts
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/MethodLength
def index def index
authorize! :view, Depp::Domain authorize! :view, Depp::Domain
@ -58,10 +54,6 @@ class Registrar
end end
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
def info def info
authorize! :info, Depp::Domain authorize! :info, Depp::Domain
@data = @domain.info(params[:domain_name]) if params[:domain_name] @data = @domain.info(params[:domain_name]) if params[:domain_name]

View file

@ -1,9 +1,5 @@
class Ability class Ability
include CanCan::Ability include CanCan::Ability
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/LineLength
# rubocop: disable Metrics/AbcSize
def initialize(user, ip = nil) def initialize(user, ip = nil)
@ip = ip @ip = ip
alias_action :show, to: :view alias_action :show, to: :view
@ -128,8 +124,4 @@ class Ability
def user def user
can :show, :dashboard can :show, :dashboard
end end
# rubocop: enable Metrics/LineLength
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/PerceivedComplexity
end end

View file

@ -28,7 +28,7 @@ class AccountActivity < ActiveRecord::Base
CSV.generate(headers: true) do |csv| CSV.generate(headers: true) do |csv|
csv << %w(registrar description activity_type receipt_date sum) csv << %w(registrar description activity_type receipt_date sum)
all.each do |x| # rubocop:disable Rails/FindEach all.each do |x|
attrs = [x.account.registrar.try(:code)] attrs = [x.account.registrar.try(:code)]
attrs += attributes.map { |attr| x.send(attr) } attrs += attributes.map { |attr| x.send(attr) }
csv << attrs csv << attrs

View file

@ -29,7 +29,6 @@ class BankStatement < ActiveRecord::Base
File.open(import_file_path, 'w') { |f| f.write(th6_file.open.read) } File.open(import_file_path, 'w') { |f| f.write(th6_file.open.read) }
end end
# rubocop: disable Metrics/AbcSize
def parse_th6_row(row) def parse_th6_row(row)
return parse_th6_header(row) if row[4, 3].strip == '000' return parse_th6_header(row) if row[4, 3].strip == '000'
return if row[4, 3].strip == '999' # skip footer return if row[4, 3].strip == '999' # skip footer
@ -50,7 +49,6 @@ class BankStatement < ActiveRecord::Base
reference_no: row[280, 35].strip reference_no: row[280, 35].strip
} }
end end
# rubocop: enable Metrics/AbcSize
def parse_th6_header(row) def parse_th6_header(row)
self.bank_code = row[7, 3].strip self.bank_code = row[7, 3].strip

View file

@ -36,8 +36,6 @@ class BankTransaction < ActiveRecord::Base
# For successful binding, reference number, invoice id and sum must match with the invoice # For successful binding, reference number, invoice id and sum must match with the invoice
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def autobind_invoice def autobind_invoice
return if binded? return if binded?
return unless registrar return unless registrar
@ -50,8 +48,6 @@ class BankTransaction < ActiveRecord::Base
return if invoice.total != sum return if invoice.total != sum
create_activity(registrar, invoice) create_activity(registrar, invoice)
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def bind_invoice(invoice_no) def bind_invoice(invoice_no)
if binded? if binded?

View file

@ -76,7 +76,6 @@ class Certificate < ActiveRecord::Base
@cached_status = REVOKED @cached_status = REVOKED
end end
# rubocop: disable Metrics/AbcSize
def sign! def sign!
csr_file = Tempfile.new('client_csr') csr_file = Tempfile.new('client_csr')
csr_file.write(csr) csr_file.write(csr)
@ -102,13 +101,10 @@ class Certificate < ActiveRecord::Base
errors.add(:base, I18n.t('failed_to_create_certificate')) errors.add(:base, I18n.t('failed_to_create_certificate'))
end end
logger.error(err) logger.error(err)
# rubocop:disable Rails/Output
puts "Certificate sign issue: #{err.inspect}" if Rails.env.test? puts "Certificate sign issue: #{err.inspect}" if Rails.env.test?
# rubocop:enable Rails/Output
return false return false
end end
end end
# rubocop: enable Metrics/AbcSize
def revoke! def revoke!
crt_file = Tempfile.new('client_crt') crt_file = Tempfile.new('client_crt')

View file

@ -311,7 +311,6 @@ class Contact < ActiveRecord::Base
self[:code] = code if new_record? # cannot change code later self[:code] = code if new_record? # cannot change code later
end end
# rubocop:disable Metrics/CyclomaticComplexity
def generate_code def generate_code
return nil unless new_record? return nil unless new_record?
return nil if registrar.blank? return nil if registrar.blank?
@ -328,7 +327,6 @@ class Contact < ActiveRecord::Base
self[:code] = "#{registrar.code}:#{code}".upcase self[:code] = "#{registrar.code}:#{code}".upcase
end end
# rubocop:enable Metrics/CyclomaticComplexity
alias_method :regenerate_code, :generate_code alias_method :regenerate_code, :generate_code

View file

@ -43,7 +43,6 @@ module Depp
) )
end end
# rubocop:disable Metrics/AbcSize
def find_by_id(id) def find_by_id(id)
data = info_xml(id) data = info_xml(id)
@ -76,7 +75,6 @@ module Depp
statuses: data.css('status').map { |s| [s['s'], s.text] } statuses: data.css('status').map { |s| [s['s'], s.text] }
) )
end end
# rubocop:enable Metrics/AbcSize
def user=(user) def user=(user)
@user = user @user = user
@ -173,8 +171,6 @@ module Depp
handle_errors(data) handle_errors(data)
end end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def update_attributes(params) def update_attributes(params)
self.ident_country_code = params[:ident_country_code] self.ident_country_code = params[:ident_country_code]
self.ident_type = params[:ident_type] self.ident_type = params[:ident_type]
@ -223,8 +219,6 @@ module Depp
data = Depp::Contact.user.request(update_xml) data = Depp::Contact.user.request(update_xml)
handle_errors(data) handle_errors(data)
end end
# rubocop:enbale Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
def delete def delete
delete_xml = Contact.epp_xml.delete( delete_xml = Contact.epp_xml.delete(
@ -238,9 +232,6 @@ module Depp
handle_errors(data) handle_errors(data)
end end
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Style/NegatedIf
# rubocop:disable Style/RedundantSelf
def extension_xml(action) def extension_xml(action)
xml = { _anonymus: [] } xml = { _anonymus: [] }
@ -259,9 +250,6 @@ module Depp
xml[:_anonymus] << legal if legal.present? xml[:_anonymus] << legal if legal.present?
xml xml
end end
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Style/NegatedIf
# rubocop:enable Style/RedundantSelf
def ident_xml def ident_xml
{ {

View file

@ -167,8 +167,6 @@ module Depp
ret.with_indifferent_access ret.with_indifferent_access
end end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def construct_params_from_server_data(data) def construct_params_from_server_data(data)
ret = default_params ret = default_params
ret[:name] = data.css('name').text ret[:name] = data.css('name').text
@ -209,8 +207,6 @@ module Depp
ret ret
end end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
def construct_custom_params_hash(domain_params) def construct_custom_params_hash(domain_params)
custom_params = { _anonymus: [] } custom_params = { _anonymus: [] }
@ -228,8 +224,6 @@ module Depp
custom_params custom_params
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def construct_edit_hash(domain_params, old_domain_params) def construct_edit_hash(domain_params, old_domain_params)
contacts = array_difference(create_contacts_hash(domain_params), create_contacts_hash(old_domain_params)) contacts = array_difference(create_contacts_hash(domain_params), create_contacts_hash(old_domain_params))
add_anon = contacts add_anon = contacts
@ -262,8 +256,6 @@ module Depp
chg: chg chg: chg
} }
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
def construct_ext_edit_hash(domain_params, old_domain_params) def construct_ext_edit_hash(domain_params, old_domain_params)
rem_keys = create_dnskeys_hash(old_domain_params) - create_dnskeys_hash(domain_params) rem_keys = create_dnskeys_hash(old_domain_params) - create_dnskeys_hash(domain_params)

View file

@ -38,7 +38,6 @@ module Depp
private private
# rubocop:disable Metrics/AbcSize
def validate_existance_in_server def validate_existance_in_server
return if errors.any? return if errors.any?
res = server.open_connection res = server.open_connection
@ -64,6 +63,5 @@ module Depp
"port: #{ENV['epp_port']}, cert_path: #{ENV['cert_path']}, key_path: #{ENV['key_path']}" "port: #{ENV['epp_port']}, cert_path: #{ENV['cert_path']}, key_path: #{ENV['key_path']}"
errors.add(:base, :invalid_cert) errors.add(:base, :invalid_cert)
end end
# rubocop:enable Metrics/AbcSize
end end
end end

View file

@ -1,4 +1,3 @@
# rubocop: disable Metrics/ClassLength
class Domain < ActiveRecord::Base class Domain < ActiveRecord::Base
include UserEvents include UserEvents
include Versions # version/domain_version.rb include Versions # version/domain_version.rb
@ -373,7 +372,6 @@ class Domain < ActiveRecord::Base
manage_automatic_statuses manage_automatic_statuses
end end
# rubocop: disable Metrics/CyclomaticComplexity
def registrant_update_confirmable?(token) def registrant_update_confirmable?(token)
return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any? return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any?
return false unless pending_update? return false unless pending_update?
@ -388,7 +386,6 @@ class Domain < ActiveRecord::Base
return false unless registrant_verification_token == token return false unless registrant_verification_token == token
true true
end end
# rubocop: enable Metrics/CyclomaticComplexity
def registrant_verification_asked? def registrant_verification_asked?
registrant_verification_asked_at.present? && registrant_verification_token.present? registrant_verification_asked_at.present? && registrant_verification_token.present?
@ -559,8 +556,6 @@ class Domain < ActiveRecord::Base
self.outzone_at = Time.current self.outzone_at = Time.current
end end
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/PerceivedComplexity
def manage_automatic_statuses def manage_automatic_statuses
if !self.class.nameserver_required? if !self.class.nameserver_required?
deactivate if nameservers.reject(&:marked_for_destruction?).empty? deactivate if nameservers.reject(&:marked_for_destruction?).empty?
@ -577,8 +572,6 @@ class Domain < ActiveRecord::Base
s_h = (statuses & [DomainStatus::SERVER_MANUAL_INZONE, DomainStatus::SERVER_HOLD]).empty? s_h = (statuses & [DomainStatus::SERVER_MANUAL_INZONE, DomainStatus::SERVER_HOLD]).empty?
statuses << DomainStatus::SERVER_HOLD if p_d && s_h statuses << DomainStatus::SERVER_HOLD if p_d && s_h
end end
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/PerceivedComplexity
def children_log def children_log
log = HashWithIndifferentAccess.new log = HashWithIndifferentAccess.new
@ -676,4 +669,3 @@ class Domain < ActiveRecord::Base
exists?(["name ILIKE ?", "%.#{zone.origin}"]) exists?(["name ILIKE ?", "%.#{zone.origin}"])
end end
end end
# rubocop: enable Metrics/ClassLength

View file

@ -19,9 +19,6 @@ class Epp::Contact < Contact
find_by(code: code) find_by(code: code)
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/AbcSize
def attrs_from(frame, new_record: false) def attrs_from(frame, new_record: false)
f = frame f = frame
at = {}.with_indifferent_access at = {}.with_indifferent_access
@ -45,9 +42,6 @@ class Epp::Contact < Contact
at.merge!(ident_attrs(f.css('ident').first)) if new_record at.merge!(ident_attrs(f.css('ident').first)) if new_record
at at
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/AbcSize
def new(frame, registrar) def new(frame, registrar)
return super if frame.blank? return super if frame.blank?

View file

@ -1,4 +1,3 @@
# rubocop: disable Metrics/ClassLength
class Epp::Domain < Domain class Epp::Domain < Domain
include EppErrors include EppErrors
@ -54,7 +53,7 @@ class Epp::Domain < Domain
end end
end end
def epp_code_map # rubocop:disable Metrics/MethodLength def epp_code_map
{ {
'2002' => [ # Command use error '2002' => [ # Command use error
[:base, :domain_already_belongs_to_the_querying_registrar] [:base, :domain_already_belongs_to_the_querying_registrar]
@ -129,10 +128,6 @@ class Epp::Domain < Domain
admin_contacts << regt if admin_domain_contacts.blank? && !regt.org? admin_contacts << regt if admin_domain_contacts.blank? && !regt.org?
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
def attrs_from(frame, current_user, action = nil) def attrs_from(frame, current_user, action = nil)
at = {}.with_indifferent_access at = {}.with_indifferent_access
@ -200,10 +195,6 @@ class Epp::Domain < Domain
frame.css("legalDocument").first.content = doc.path if doc&.persisted? frame.css("legalDocument").first.content = doc.path if doc&.persisted?
self.legal_document_id = doc.id self.legal_document_id = doc.id
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: enable Metrics/MethodLength
# rubocop: enable Metrics/AbcSize
def nameservers_attrs(frame, action) def nameservers_attrs(frame, action)
ns_list = nameservers_from(frame) ns_list = nameservers_from(frame)
@ -321,8 +312,6 @@ class Epp::Domain < Domain
attrs attrs
end end
# rubocop: disable Metrics/PerceivedComplexity
# rubocop: disable Metrics/CyclomaticComplexity
def dnskeys_attrs(frame, action) def dnskeys_attrs(frame, action)
keys = [] keys = []
return keys if frame.blank? return keys if frame.blank?
@ -347,8 +336,6 @@ class Epp::Domain < Domain
end end
errors.any? ? [] : keys errors.any? ? [] : keys
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
class DnsSecKeys class DnsSecKeys
def initialize(frame) def initialize(frame)
@ -460,8 +447,6 @@ class Epp::Domain < Domain
end end
# rubocop: disable Metrics/AbcSize
# rubocop: disable Metrics/CyclomaticComplexity
def update(frame, current_user, verify = true) def update(frame, current_user, verify = true)
return super if frame.blank? return super if frame.blank?
@ -502,8 +487,6 @@ class Epp::Domain < Domain
errors.empty? && super(at) errors.empty? && super(at)
end end
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/CyclomaticComplexity
def apply_pending_update! def apply_pending_update!
preclean_pendings preclean_pendings
@ -608,7 +591,6 @@ class Epp::Domain < Domain
### TRANSFER ### ### TRANSFER ###
# rubocop: disable Metrics/CyclomaticComplexity
def transfer(frame, action, current_user) def transfer(frame, action, current_user)
check_discarded check_discarded
@ -627,10 +609,6 @@ class Epp::Domain < Domain
end end
end end
# rubocop: enable Metrics/PerceivedComplexity
# rubocop: enable Metrics/CyclomaticComplexity
# rubocop: disable Metrics/MethodLength
# rubocop: disable Metrics/AbcSize
def query_transfer(frame, current_user) def query_transfer(frame, current_user)
if current_user.registrar == registrar if current_user.registrar == registrar
throw :epp_error, { throw :epp_error, {
@ -667,8 +645,6 @@ class Epp::Domain < Domain
return dt return dt
end end
end end
# rubocop: enable Metrics/AbcSize
# rubocop: enable Metrics/MethodLength
def approve_transfer(frame, current_user) def approve_transfer(frame, current_user)
pt = pending_transfer pt = pending_transfer
@ -717,8 +693,6 @@ class Epp::Domain < Domain
pt pt
end end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def keyrelay(parsed_frame, requester) def keyrelay(parsed_frame, requester)
if registrar == requester if registrar == requester
errors.add(:base, :domain_already_belongs_to_the_querying_registrar) and return false errors.add(:base, :domain_already_belongs_to_the_querying_registrar) and return false
@ -762,8 +736,6 @@ class Epp::Domain < Domain
true true
end end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
### VALIDATIONS ### ### VALIDATIONS ###
@ -855,4 +827,3 @@ class Epp::Domain < Domain
end end
end end
end end
# rubocop: enable Metrics/ClassLength

View file

@ -54,8 +54,6 @@ class Registrar < ActiveRecord::Base
end end
end end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def issue_prepayment_invoice(amount, description = nil) def issue_prepayment_invoice(amount, description = nil)
invoices.create( invoices.create(
due_date: (Time.zone.now.to_date + Setting.days_to_keep_invoices_active.days).end_of_day, due_date: (Time.zone.now.to_date + Setting.days_to_keep_invoices_active.days).end_of_day,
@ -99,8 +97,6 @@ class Registrar < ActiveRecord::Base
] ]
) )
end end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
def cash_account def cash_account
accounts.find_by(account_type: Account::CASH) accounts.find_by(account_type: Account::CASH)

View file

@ -17,8 +17,6 @@ class WhoisRecord < ActiveRecord::Base
@generated_json ||= generate_json @generated_json ||= generate_json
end end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def generate_json def generate_json
h = HashWithIndifferentAccess.new h = HashWithIndifferentAccess.new
return h if domain.blank? return h if domain.blank?
@ -99,9 +97,6 @@ class WhoisRecord < ActiveRecord::Base
template = Rails.root.join("app/views/for_models/#{template_name}".freeze) template = Rails.root.join("app/views/for_models/#{template_name}".freeze)
ERB.new(template.read, nil, "-").result(binding) ERB.new(template.read, nil, "-").result(binding)
end end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
def populate def populate
return if domain_id.blank? return if domain_id.blank?

View file

@ -26,13 +26,9 @@ class DomainNameValidator < ActiveModel::EachValidator
value = SimpleIDN.to_unicode(value).mb_chars.downcase.strip value = SimpleIDN.to_unicode(value).mb_chars.downcase.strip
end end
# rubocop: disable Metrics/LineLength
unicode_chars = /\u00E4\u00F5\u00F6\u00FC\u0161\u017E/ # äõöüšž unicode_chars = /\u00E4\u00F5\u00F6\u00FC\u0161\u017E/ # äõöüšž
regexp = /\A[a-zA-Z0-9#{unicode_chars.source}][a-zA-Z0-9#{unicode_chars.source}-]{0,61}[a-zA-Z0-9#{unicode_chars.source}]\.#{general_domains.source}\z/ regexp = /\A[a-zA-Z0-9#{unicode_chars.source}][a-zA-Z0-9#{unicode_chars.source}-]{0,61}[a-zA-Z0-9#{unicode_chars.source}]\.#{general_domains.source}\z/
# rubocop: enable Metrics/LineLength
# rubocop: disable Style/DoubleNegation
!!(value =~ regexp) !!(value =~ regexp)
# rubocop: enable Style/DoubleNegation
end end
def validate_blocked(value) def validate_blocked(value)

View file

@ -1,5 +1,4 @@
# EIS custom rack hack in order to enable test external interfaces EPP/REPP inside webserver network # EIS custom rack hack in order to enable test external interfaces EPP/REPP inside webserver network
# rubocop:disable Metrics/LineLength
module Rack module Rack
class Request class Request
def trusted_proxy?(ip) def trusted_proxy?(ip)
@ -11,4 +10,3 @@ module Rack
end end
end end
end end
# rubocop:enable Metrics/LineLength

View file

@ -1,5 +1,3 @@
# rubocop: disable Style/SymbolProc
# rubocop: disable Performance/Detect
namespace :import do namespace :import do
# README # README
# #
@ -360,7 +358,6 @@ namespace :import do
legacy_contact_id legacy_contact_id
) )
# rubocop: disable Lint/UselessAssignment
domain_status_columns = %w( domain_status_columns = %w(
description description
value value
@ -368,7 +365,6 @@ namespace :import do
updator_str updator_str
legacy_domain_id legacy_domain_id
) )
# rubocop: enable Lint/UselessAssignment
nameserver_columns = %w( nameserver_columns = %w(
hostname hostname
@ -786,5 +782,3 @@ def parse_zone_ns_data(domain, zone)
end end
[ns_records.strip, a_records.strip, a4_records.strip] [ns_records.strip, a_records.strip, a4_records.strip]
end end
# rubocop: enable Performance/Detect
# rubocop: enable Style/SymbolProc