internetee/registry

View on GitHub

Showing 94 of 104 total issues

Class Domain has 97 methods (exceeds 25 allowed). Consider refactoring.
Open

class Domain < ApplicationRecord
  include UserEvents
  include Roids
  include Versions # version/domain_version.rb
  include Domain::Expirable
Severity: Major
Found in app/models/domain.rb - About 1 day to fix

File domain.rb has 637 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Domain < ApplicationRecord
  include UserEvents
  include Roids
  include Versions # version/domain_version.rb
  include Domain::Expirable
Severity: Major
Found in app/models/domain.rb - About 1 day to fix

Class Contact has 57 methods (exceeds 25 allowed). Consider refactoring.
Open

class Contact < ApplicationRecord
  include Versions # version/contact_version.rb
  include Roids
  include EppErrors
  include UserEvents
Severity: Major
Found in app/models/contact.rb - About 7 hrs to fix

File contact.rb has 453 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'deserializers/xml/legal_document'

class Contact < ApplicationRecord
  include Versions # version/contact_version.rb
  include Roids
Severity: Minor
Found in app/models/contact.rb - About 6 hrs to fix

Method remove_duplicates has a Cognitive Complexity of 28 (exceeds 5 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 4 hrs 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

Class BaseController has 37 methods (exceeds 25 allowed). Consider refactoring.
Open

  class BaseController < ApplicationController
    class AuthorizationError < StandardError; end
    skip_before_action :verify_authenticity_token
    check_authorization
    layout false
Severity: Minor
Found in app/controllers/epp/base_controller.rb - About 4 hrs to fix

Method perform has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def perform(domain_name: nil)
    if domain_name.nil?
      domains = Domain.all.select { |domain| domain.created_at < Time.zone.now - NameserverValidator::VALIDATION_DOMAIN_PERIOD }
                      .select { |domain| domain.nameservers.exists? }

Severity: Minor
Found in app/jobs/nameserver_record_validation_job.rb - About 3 hrs 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

File domain.rb has 316 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'deserializers/xml/legal_document'
require 'deserializers/xml/nameserver'
require 'deserializers/xml/domain_create'
require 'deserializers/xml/domain_update'
class Epp::Domain < Domain
Severity: Minor
Found in app/models/epp/domain.rb - About 3 hrs to fix

Method upload_spreadsheet has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def upload_spreadsheet
      if params[:q].nil?
        flash[:alert] = 'No file upload! Look at the left of upload button!'
        redirect_to admin_auctions_path and return
      end
Severity: Minor
Found in app/controllers/admin/auctions_controller.rb - About 3 hrs 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

File base_controller.rb has 307 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Epp
  class BaseController < ApplicationController
    class AuthorizationError < StandardError; end
    skip_before_action :verify_authenticity_token
    check_authorization
Severity: Minor
Found in app/controllers/epp/base_controller.rb - About 3 hrs to fix

Class DomainUpdate has 30 methods (exceeds 25 allowed). Consider refactoring.
Open

  class DomainUpdate # rubocop:disable Metrics/ClassLength
    attr_reader :domain, :params, :bypass_verify

    def initialize(domain, params, bypass_verify)
      @domain = domain
Severity: Minor
Found in app/interactions/actions/domain_update.rb - About 2 hrs to fix

File registrar.rb has 275 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Registrar < ApplicationRecord # rubocop:disable Metrics/ClassLength
  include Versions # version/registrar_version.rb
  include Registrar::BookKeeping
  include EmailVerifable
  include Registrar::LegalDoc
Severity: Minor
Found in app/models/registrar.rb - About 2 hrs to fix

Method login has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def login
      success = true
      @api_user = ApiUser.find_by(login_params)

      webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip)
Severity: Minor
Found in app/controllers/epp/sessions_controller.rb - About 2 hrs 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 perform has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def perform(domain_name: nil)
    unless domain_name.nil?
      domain = Domain.find_by(name: domain_name)

      return logger.info "This domain not contain any dnskeys" if domain.dnskeys.empty?
Severity: Minor
Found in app/jobs/validate_dnssec_job.rb - About 2 hrs 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 login has 73 lines of code (exceeds 40 allowed). Consider refactoring.
Open

    def login
      success = true
      @api_user = ApiUser.find_by(login_params)

      webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip)
Severity: Major
Found in app/controllers/epp/sessions_controller.rb - About 2 hrs to fix

Method domains_by_registrar has 73 lines of code (exceeds 40 allowed). Consider refactoring.
Open

      def domains_by_registrar(date_to)
        sql = <<-SQL
          SELECT
            registrar_id,
            SUM(domain_count) AS total_domain_count
Severity: Major
Found in app/controllers/repp/v1/stats_controller.rb - About 2 hrs to fix

Method epp_code_map has 70 lines of code (exceeds 40 allowed). Consider refactoring.
Open

  def epp_code_map
    {
      '2002' => [ # Command use error
        %i[base domain_already_belongs_to_the_querying_registrar],
      ],
Severity: Major
Found in app/models/epp/domain.rb - About 2 hrs to fix

File domains_controller.rb has 255 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'deserializers/xml/domain_delete'
module Epp
  class DomainsController < BaseController
    before_action :find_domain, only: %i[info renew update transfer delete]
    before_action :find_password, only: %i[info update transfer delete]
Severity: Minor
Found in app/controllers/epp/domains_controller.rb - About 2 hrs to fix

Method cr_id has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def cr_id
      # try this, rebuild user for registrar before searching history? really?
      registrar = creator.try(:registrar)
      if registrar.present?            # Did creator return a kind of User that has a registrar?
        registrar.code
Severity: Minor
Found in app/models/concerns/user_events.rb - About 2 hrs 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 dnskey_update_enabled has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def dnskey_update_enabled
      find_domain

      if @domain.dnskey_update_enabled? && !params[:parsed_frame].css('update').empty?
        flag = true
Severity: Minor
Found in app/controllers/epp/domains_controller.rb - About 2 hrs 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