internetee/registry

View on GitHub

Showing 94 of 104 total issues

Method requires has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def requires(*selectors)
      options = selectors.extract_options!
      allow_blank = options[:allow_blank] ||= false # allow_blank is false by default

      el, missing = nil, nil
Severity: Minor
Found in app/controllers/epp/base_controller.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method manage_automatic_statuses has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def manage_automatic_statuses
    unless self.class.nameserver_required?
      deactivate if nameservers.reject(&:marked_for_destruction?).empty?
      activate if nameservers.reject(&:marked_for_destruction?).size >= Setting.ns_min_count
    end
Severity: Minor
Found in app/models/domain.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method index has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def index
      params[:q] ||= {}

      search_params = params[:q].deep_dup.except(:created_at_gteq, :created_at_lteq)

Severity: Minor
Found in app/controllers/admin/domain_versions_controller.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def update
          contact = find_contact_and_update_credentials(params[:uuid], params[:name], params[:email], params[:phone])
          reparsed_request = reparsed_request(request.body.string)
          disclosed_attributes = reparsed_request[:disclosed_attributes]

Severity: Minor
Found in app/controllers/api/v1/registrant/contacts_controller.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method generate has 54 lines of code (exceeds 40 allowed). Consider refactoring.
Open

    def generate
      seller = EInvoice::Seller.new
      seller.name = invoice.seller_name
      seller.registration_number = invoice.seller_reg_no
      seller.vat_number = invoice.seller_vat_no
Severity: Major
Found in app/models/invoice/e_invoice_generator.rb - About 1 hr to fix

Method issue_prepayment_invoice has 53 lines of code (exceeds 40 allowed). Consider refactoring.
Open

  def issue_prepayment_invoice(amount, description = nil, payable: true)
    invoice = invoices.create!(
      issue_date: Time.zone.today,
      due_date: (Time.zone.now + Setting.days_to_keep_invoices_active.days).to_date,
      description: description,
Severity: Major
Found in app/models/registrar.rb - About 1 hr to fix

Method replace_nameservers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def replace_nameservers(hostname, new_attributes, domains: [])
    transaction do
      domain_scope = domains.dup
      domain_list = []
      failed_list = []
Severity: Minor
Found in app/models/registrar.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method remove_duplicates has 49 lines of code (exceeds 40 allowed). Consider refactoring.
Open

  def self.remove_duplicates
    start = Time.zone.now.to_f
    Rails.logger.info '-----> Removing legal documents duplicates'
    count = 0
    modified = []
Severity: Minor
Found in app/models/legal_document.rb - About 1 hr to fix

Method generate_json has 47 lines of code (exceeds 40 allowed). Consider refactoring.
Open

  def generate_json
    h = HashWithIndifferentAccess.new
    return h if domain.blank?

    if domain.discarded?
Severity: Minor
Found in app/models/whois_record.rb - About 1 hr to fix

Method set_status has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def set_status
    if Setting.transfer_wait_time > 0
      self.status = PENDING unless status
    else
      self.status = SERVER_APPROVED unless status
Severity: Minor
Found in app/models/domain_transfer.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def create
      auction = Auction.new(domain: params[:domain], status: Auction.statuses[:started], platform: 'manual')

      if Auction.domain_exists_in_blocked_disputed_and_registered?(params[:domain])
        flash[:alert] = "Adding #{params[:domain]} failed - domain registered or regsitration is blocked"
Severity: Minor
Found in app/controllers/admin/auctions_controller.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method to_json has 44 lines of code (exceeds 40 allowed). Consider refactoring.
Open

      def to_json(_obj = nil)
        return simple_object if @simplify

        {
          id: domain.uuid,
Severity: Minor
Found in lib/serializers/registrant_api/domain.rb - About 1 hr to fix

Method validate_each has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_each(record, attribute, value)
    validated = []
    list = value.reject(&:marked_for_destruction?)
    list.each do |x|
      next if x.send(options[:attribute]).blank?
Severity: Minor
Found in app/validators/uniqueness_multi_validator.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method transfer_domain_contacts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def transfer_domain_contacts(new_registrar)
    copied_ids = []
    domain_contacts.each do |dc|
      contact = Contact.find(dc.contact_id)
      next if copied_ids.include?(uniq_contact_hash(dc)) || contact.registrar == new_registrar
Severity: Minor
Found in app/models/concerns/domain/transferable.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method admin_status_update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def admin_status_update(update)
    return unless update

    PaperTrail.request(enabled: false) do
      update_unless_locked_by_registrant(update)
Severity: Minor
Found in app/models/domain.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method validate_nameserver_ips has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_nameserver_ips
    nameservers.to_a.reject(&:marked_for_destruction?).each do |ns|
      next unless ns.hostname.end_with?(".#{name}")
      next if ns.ipv4.present? || ns.ipv6.present?

Severity: Minor
Found in app/models/domain.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method collect_aggregation_errors has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def collect_aggregation_errors(aggregation)
    epp_errors = ActiveModel::Errors.new(self)

    aggregation.errors.details.each do |attr, error_details|
      error_details.each do |error_detail|
Severity: Minor
Found in app/models/concerns/epp_errors.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method compare_dnssec_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def compare_dnssec_data(response_container:, domain:, nameserver:)
    domain.dnskeys.each do |key|
      next unless key.flags.to_s == '257'
      next if key.validation_datetime.present?

Severity: Minor
Found in app/jobs/validate_dnssec_job.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method transfer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def transfer(frame, action, current_user)
    if discarded?
      add_epp_error('2106', nil, nil, 'Object is not eligible for transfer')
      return
    end
Severity: Minor
Found in app/models/epp/domain.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method save_to_filesystem has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def save_to_filesystem
    binary = Base64.decode64(body)
    digest = Digest::SHA1.new.update(binary).to_s

    loop do
Severity: Minor
Found in app/models/legal_document.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language