mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Remove Rubocop inline directives
This commit is contained in:
parent
66dd10302d
commit
c44f3df7f5
28 changed files with 5 additions and 169 deletions
|
@ -1,9 +1,5 @@
|
|||
class 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)
|
||||
@ip = ip
|
||||
alias_action :show, to: :view
|
||||
|
@ -128,8 +124,4 @@ class Ability
|
|||
def user
|
||||
can :show, :dashboard
|
||||
end
|
||||
|
||||
# rubocop: enable Metrics/LineLength
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ class AccountActivity < ActiveRecord::Base
|
|||
CSV.generate(headers: true) do |csv|
|
||||
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 += attributes.map { |attr| x.send(attr) }
|
||||
csv << attrs
|
||||
|
|
|
@ -29,7 +29,6 @@ class BankStatement < ActiveRecord::Base
|
|||
File.open(import_file_path, 'w') { |f| f.write(th6_file.open.read) }
|
||||
end
|
||||
|
||||
# rubocop: disable Metrics/AbcSize
|
||||
def parse_th6_row(row)
|
||||
return parse_th6_header(row) if row[4, 3].strip == '000'
|
||||
return if row[4, 3].strip == '999' # skip footer
|
||||
|
@ -50,7 +49,6 @@ class BankStatement < ActiveRecord::Base
|
|||
reference_no: row[280, 35].strip
|
||||
}
|
||||
end
|
||||
# rubocop: enable Metrics/AbcSize
|
||||
|
||||
def parse_th6_header(row)
|
||||
self.bank_code = row[7, 3].strip
|
||||
|
|
|
@ -36,8 +36,6 @@ class BankTransaction < ActiveRecord::Base
|
|||
|
||||
|
||||
# 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
|
||||
return if binded?
|
||||
return unless registrar
|
||||
|
@ -50,8 +48,6 @@ class BankTransaction < ActiveRecord::Base
|
|||
return if invoice.total != sum
|
||||
create_activity(registrar, invoice)
|
||||
end
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
|
||||
def bind_invoice(invoice_no)
|
||||
if binded?
|
||||
|
|
|
@ -76,7 +76,6 @@ class Certificate < ActiveRecord::Base
|
|||
@cached_status = REVOKED
|
||||
end
|
||||
|
||||
# rubocop: disable Metrics/AbcSize
|
||||
def sign!
|
||||
csr_file = Tempfile.new('client_csr')
|
||||
csr_file.write(csr)
|
||||
|
@ -102,13 +101,10 @@ class Certificate < ActiveRecord::Base
|
|||
errors.add(:base, I18n.t('failed_to_create_certificate'))
|
||||
end
|
||||
logger.error(err)
|
||||
# rubocop:disable Rails/Output
|
||||
puts "Certificate sign issue: #{err.inspect}" if Rails.env.test?
|
||||
# rubocop:enable Rails/Output
|
||||
return false
|
||||
end
|
||||
end
|
||||
# rubocop: enable Metrics/AbcSize
|
||||
|
||||
def revoke!
|
||||
crt_file = Tempfile.new('client_crt')
|
||||
|
|
|
@ -311,7 +311,6 @@ class Contact < ActiveRecord::Base
|
|||
self[:code] = code if new_record? # cannot change code later
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/CyclomaticComplexity
|
||||
def generate_code
|
||||
return nil unless new_record?
|
||||
return nil if registrar.blank?
|
||||
|
@ -328,7 +327,6 @@ class Contact < ActiveRecord::Base
|
|||
|
||||
self[:code] = "#{registrar.code}:#{code}".upcase
|
||||
end
|
||||
# rubocop:enable Metrics/CyclomaticComplexity
|
||||
|
||||
alias_method :regenerate_code, :generate_code
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ module Depp
|
|||
)
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def find_by_id(id)
|
||||
data = info_xml(id)
|
||||
|
||||
|
@ -76,7 +75,6 @@ module Depp
|
|||
statuses: data.css('status').map { |s| [s['s'], s.text] }
|
||||
)
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
def user=(user)
|
||||
@user = user
|
||||
|
@ -173,8 +171,6 @@ module Depp
|
|||
handle_errors(data)
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def update_attributes(params)
|
||||
self.ident_country_code = params[:ident_country_code]
|
||||
self.ident_type = params[:ident_type]
|
||||
|
@ -223,8 +219,6 @@ module Depp
|
|||
data = Depp::Contact.user.request(update_xml)
|
||||
handle_errors(data)
|
||||
end
|
||||
# rubocop:enbale Metrics/AbcSize
|
||||
# rubocop:enable Metrics/MethodLength
|
||||
|
||||
def delete
|
||||
delete_xml = Contact.epp_xml.delete(
|
||||
|
@ -238,9 +232,6 @@ module Depp
|
|||
handle_errors(data)
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/CyclomaticComplexity
|
||||
# rubocop:disable Style/NegatedIf
|
||||
# rubocop:disable Style/RedundantSelf
|
||||
def extension_xml(action)
|
||||
xml = { _anonymus: [] }
|
||||
|
||||
|
@ -259,9 +250,6 @@ module Depp
|
|||
xml[:_anonymus] << legal if legal.present?
|
||||
xml
|
||||
end
|
||||
# rubocop:enable Metrics/CyclomaticComplexity
|
||||
# rubocop:enable Style/NegatedIf
|
||||
# rubocop:enable Style/RedundantSelf
|
||||
|
||||
def ident_xml
|
||||
{
|
||||
|
|
|
@ -167,8 +167,6 @@ module Depp
|
|||
ret.with_indifferent_access
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def construct_params_from_server_data(data)
|
||||
ret = default_params
|
||||
ret[:name] = data.css('name').text
|
||||
|
@ -209,8 +207,6 @@ module Depp
|
|||
|
||||
ret
|
||||
end
|
||||
# rubocop:enable Metrics/MethodLength
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
def construct_custom_params_hash(domain_params)
|
||||
custom_params = { _anonymus: [] }
|
||||
|
@ -228,8 +224,6 @@ module Depp
|
|||
custom_params
|
||||
end
|
||||
|
||||
# rubocop: disable Metrics/PerceivedComplexity
|
||||
# rubocop: disable Metrics/CyclomaticComplexity
|
||||
def construct_edit_hash(domain_params, old_domain_params)
|
||||
contacts = array_difference(create_contacts_hash(domain_params), create_contacts_hash(old_domain_params))
|
||||
add_anon = contacts
|
||||
|
@ -262,8 +256,6 @@ module Depp
|
|||
chg: chg
|
||||
}
|
||||
end
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
|
||||
def construct_ext_edit_hash(domain_params, old_domain_params)
|
||||
rem_keys = create_dnskeys_hash(old_domain_params) - create_dnskeys_hash(domain_params)
|
||||
|
|
|
@ -38,7 +38,6 @@ module Depp
|
|||
|
||||
private
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def validate_existance_in_server
|
||||
return if errors.any?
|
||||
res = server.open_connection
|
||||
|
@ -64,6 +63,5 @@ module Depp
|
|||
"port: #{ENV['epp_port']}, cert_path: #{ENV['cert_path']}, key_path: #{ENV['key_path']}"
|
||||
errors.add(:base, :invalid_cert)
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# rubocop: disable Metrics/ClassLength
|
||||
class Domain < ActiveRecord::Base
|
||||
include UserEvents
|
||||
include Versions # version/domain_version.rb
|
||||
|
@ -373,7 +372,6 @@ class Domain < ActiveRecord::Base
|
|||
manage_automatic_statuses
|
||||
end
|
||||
|
||||
# rubocop: disable Metrics/CyclomaticComplexity
|
||||
def registrant_update_confirmable?(token)
|
||||
return false if (statuses & [DomainStatus::FORCE_DELETE, DomainStatus::DELETE_CANDIDATE]).any?
|
||||
return false unless pending_update?
|
||||
|
@ -388,7 +386,6 @@ class Domain < ActiveRecord::Base
|
|||
return false unless registrant_verification_token == token
|
||||
true
|
||||
end
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
|
||||
def registrant_verification_asked?
|
||||
registrant_verification_asked_at.present? && registrant_verification_token.present?
|
||||
|
@ -559,8 +556,6 @@ class Domain < ActiveRecord::Base
|
|||
self.outzone_at = Time.current
|
||||
end
|
||||
|
||||
# rubocop: disable Metrics/CyclomaticComplexity
|
||||
# rubocop: disable Metrics/PerceivedComplexity
|
||||
def manage_automatic_statuses
|
||||
if !self.class.nameserver_required?
|
||||
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?
|
||||
statuses << DomainStatus::SERVER_HOLD if p_d && s_h
|
||||
end
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
|
||||
def children_log
|
||||
log = HashWithIndifferentAccess.new
|
||||
|
@ -676,4 +669,3 @@ class Domain < ActiveRecord::Base
|
|||
exists?(["name ILIKE ?", "%.#{zone.origin}"])
|
||||
end
|
||||
end
|
||||
# rubocop: enable Metrics/ClassLength
|
||||
|
|
|
@ -19,9 +19,6 @@ class Epp::Contact < Contact
|
|||
find_by(code: code)
|
||||
end
|
||||
|
||||
# rubocop: disable Metrics/PerceivedComplexity
|
||||
# rubocop: disable Metrics/CyclomaticComplexity
|
||||
# rubocop: disable Metrics/AbcSize
|
||||
def attrs_from(frame, new_record: false)
|
||||
f = frame
|
||||
at = {}.with_indifferent_access
|
||||
|
@ -45,9 +42,6 @@ class Epp::Contact < Contact
|
|||
at.merge!(ident_attrs(f.css('ident').first)) if new_record
|
||||
at
|
||||
end
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
# rubocop: enable Metrics/AbcSize
|
||||
|
||||
def new(frame, registrar)
|
||||
return super if frame.blank?
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# rubocop: disable Metrics/ClassLength
|
||||
class Epp::Domain < Domain
|
||||
include EppErrors
|
||||
|
||||
|
@ -54,7 +53,7 @@ class Epp::Domain < Domain
|
|||
end
|
||||
end
|
||||
|
||||
def epp_code_map # rubocop:disable Metrics/MethodLength
|
||||
def epp_code_map
|
||||
{
|
||||
'2002' => [ # Command use error
|
||||
[: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?
|
||||
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)
|
||||
at = {}.with_indifferent_access
|
||||
|
||||
|
@ -200,10 +195,6 @@ class Epp::Domain < Domain
|
|||
frame.css("legalDocument").first.content = doc.path if doc&.persisted?
|
||||
self.legal_document_id = doc.id
|
||||
end
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
# rubocop: enable Metrics/MethodLength
|
||||
# rubocop: enable Metrics/AbcSize
|
||||
|
||||
def nameservers_attrs(frame, action)
|
||||
ns_list = nameservers_from(frame)
|
||||
|
@ -321,8 +312,6 @@ class Epp::Domain < Domain
|
|||
attrs
|
||||
end
|
||||
|
||||
# rubocop: disable Metrics/PerceivedComplexity
|
||||
# rubocop: disable Metrics/CyclomaticComplexity
|
||||
def dnskeys_attrs(frame, action)
|
||||
keys = []
|
||||
return keys if frame.blank?
|
||||
|
@ -347,8 +336,6 @@ class Epp::Domain < Domain
|
|||
end
|
||||
errors.any? ? [] : keys
|
||||
end
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
|
||||
class DnsSecKeys
|
||||
def initialize(frame)
|
||||
|
@ -460,8 +447,6 @@ class Epp::Domain < Domain
|
|||
end
|
||||
|
||||
|
||||
# rubocop: disable Metrics/AbcSize
|
||||
# rubocop: disable Metrics/CyclomaticComplexity
|
||||
def update(frame, current_user, verify = true)
|
||||
return super if frame.blank?
|
||||
|
||||
|
@ -502,8 +487,6 @@ class Epp::Domain < Domain
|
|||
|
||||
errors.empty? && super(at)
|
||||
end
|
||||
# rubocop: enable Metrics/AbcSize
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
|
||||
def apply_pending_update!
|
||||
preclean_pendings
|
||||
|
@ -608,7 +591,6 @@ class Epp::Domain < Domain
|
|||
|
||||
### TRANSFER ###
|
||||
|
||||
# rubocop: disable Metrics/CyclomaticComplexity
|
||||
def transfer(frame, action, current_user)
|
||||
check_discarded
|
||||
|
||||
|
@ -627,10 +609,6 @@ class Epp::Domain < Domain
|
|||
end
|
||||
end
|
||||
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
# rubocop: disable Metrics/MethodLength
|
||||
# rubocop: disable Metrics/AbcSize
|
||||
def query_transfer(frame, current_user)
|
||||
if current_user.registrar == registrar
|
||||
throw :epp_error, {
|
||||
|
@ -667,8 +645,6 @@ class Epp::Domain < Domain
|
|||
return dt
|
||||
end
|
||||
end
|
||||
# rubocop: enable Metrics/AbcSize
|
||||
# rubocop: enable Metrics/MethodLength
|
||||
|
||||
def approve_transfer(frame, current_user)
|
||||
pt = pending_transfer
|
||||
|
@ -717,8 +693,6 @@ class Epp::Domain < Domain
|
|||
pt
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def keyrelay(parsed_frame, requester)
|
||||
if registrar == requester
|
||||
errors.add(:base, :domain_already_belongs_to_the_querying_registrar) and return false
|
||||
|
@ -762,8 +736,6 @@ class Epp::Domain < Domain
|
|||
|
||||
true
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
# rubocop:enable Metrics/MethodLength
|
||||
|
||||
### VALIDATIONS ###
|
||||
|
||||
|
@ -855,4 +827,3 @@ class Epp::Domain < Domain
|
|||
end
|
||||
end
|
||||
end
|
||||
# rubocop: enable Metrics/ClassLength
|
||||
|
|
|
@ -54,8 +54,6 @@ class Registrar < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def issue_prepayment_invoice(amount, description = nil)
|
||||
invoices.create(
|
||||
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
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
# rubocop:enable Metrics/MethodLength
|
||||
|
||||
def cash_account
|
||||
accounts.find_by(account_type: Account::CASH)
|
||||
|
|
|
@ -17,8 +17,6 @@ class WhoisRecord < ActiveRecord::Base
|
|||
@generated_json ||= generate_json
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def generate_json
|
||||
h = HashWithIndifferentAccess.new
|
||||
return h if domain.blank?
|
||||
|
@ -99,9 +97,6 @@ class WhoisRecord < ActiveRecord::Base
|
|||
template = Rails.root.join("app/views/for_models/#{template_name}".freeze)
|
||||
ERB.new(template.read, nil, "-").result(binding)
|
||||
end
|
||||
# rubocop:enable Metrics/MethodLength
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
|
||||
def populate
|
||||
return if domain_id.blank?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue