internetee/registry

View on GitHub

Showing 94 of 104 total issues

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

        def bulk_renew_domains
          @epp_errors ||= ActiveModel::Errors.new(self)
          domains = []
          if bulk_renew_params[:domains].instance_of?(Array)
            bulk_renew_params[:domains].each do |idn|
Severity: Minor
Found in app/controllers/repp/v1/domains/renews_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 send_monthly_invoices has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def send_monthly_invoices
    invoices = find_or_init_monthly_invoices
    assign_invoice_numbers(invoices)
    return if invoices.empty? || @dry

Severity: Minor
Found in app/jobs/send_monthly_invoices_job.rb - About 55 mins 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 check_availability has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def check_availability(domain_names)
      domain_names = [domain_names] if domain_names.is_a?(String)

      result = []

Severity: Minor
Found in app/models/epp/domain.rb - About 45 mins 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_code has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def generate_code
    return nil unless new_record?
    return nil if registrar.blank?
    code = self[:code]

Severity: Minor
Found in app/models/contact.rb - About 45 mins 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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def run(domain_name:, nameserver:)
    result_response = validate(domain_name: domain_name, hostname: nameserver.hostname)

    unless result_response[:result] && result_response[:reason] == :exception
      if result_response[:error_info].to_s.include? "Nameserver invalid!"
Severity: Minor
Found in app/services/nameserver_validator.rb - About 45 mins 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 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def validate(domain_name:, hostname:)
    resolver = setup_resolver(hostname)
    result = resolver.query(domain_name, 'SOA', 'IN')

    return { result: false, reason: 'answer' } if result.answer.empty?
Severity: Minor
Found in app/services/nameserver_validator.rb - About 45 mins 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 find_or_create_by_api_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def find_or_create_by_api_data(user_data = {})
      return false unless user_data[:ident]
      return false unless user_data[:first_name]
      return false unless user_data[:last_name]

Severity: Minor
Found in app/models/registrant_user.rb - About 45 mins 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 construct_epp_errors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def construct_epp_errors
    epp_errors = ActiveModel::Errors.new(self)
    errors.each do |error|
      attr = error.attribute.to_s.split('.')[0].to_sym
      next if attr == :epp_errors
Severity: Minor
Found in app/models/concerns/epp_errors.rb - About 45 mins 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_format has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_format(value)
      return true unless value

      value = value.mb_chars.downcase.strip

Severity: Minor
Found in app/validators/domain_name_validator.rb - About 45 mins 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_parent_errors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def collect_parent_errors(attr, errors)
    errors = [errors] if errors.is_a?(String)

    epp_errors = ActiveModel::Errors.new(self)
    errors.each do |err|
Severity: Minor
Found in app/models/concerns/epp_errors.rb - About 45 mins 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 matches? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def matches?(request)
    # TODO: Maybe move this to controller to keep params clean
    return redirect_to_error_controller(request) if request.params[:action] == 'wrong_schema'

    request = parse_raw_frame(request) if request.params[:raw_frame]
Severity: Minor
Found in lib/epp_constraint.rb - About 45 mins 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_html has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_html
    self.class.columns.each do |column|
      next unless column.type == :string

      c_name = column.name
Severity: Minor
Found in app/models/contact.rb - About 45 mins 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 find_or_create_by_user_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def find_or_create_by_user_data(user_data = {})
      return unless user_data[:first_name]
      return unless user_data[:last_name]
      return unless user_data[:ident]
      return unless user_data[:country_code]
Severity: Minor
Found in app/models/registrant_user.rb - About 45 mins 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 language_select has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def language_select(object, method, choices = nil, options = {}, html_options = {}, &block)
Severity: Minor
Found in app/helpers/form_helper.rb - About 45 mins to fix

Method language_select has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def language_select(method, choices = nil, options = {}, html_options = {}, &block)
Severity: Minor
Found in app/helpers/default_form_builder.rb - About 35 mins to fix

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(street, zip, city, state, country_code)
Severity: Minor
Found in app/models/contact/address.rb - About 35 mins to fix

Method all_domains has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def all_domains(page: nil, per: nil, params:, requester: nil)
    filter_sql = qualified_domain_ids(params[:domain_filter])

    # get sorting rules
    sorts = params.fetch(:sort, {}).first || []
Severity: Minor
Found in app/models/contact.rb - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def update
        auction = Auction.find_by!(uuid: params[:uuid])

        case params[:status]
        when Auction.statuses[:awaiting_payment]
Severity: Minor
Found in app/controllers/api/v1/auctions_controller.rb - About 35 mins 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 req_poll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def req_poll
      @notification = current_user.unread_notifications.order('created_at DESC').take

      render_epp_response 'epp/poll/poll_no_messages' and return unless @notification

Severity: Minor
Found in app/controllers/epp/polls_controller.rb - About 35 mins 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 description_in_language has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def description_in_language(price:, yearly:)
    timeframe_string = yearly ? 'yearly' : 'monthly'
    locale_string = "registrar.invoice_#{timeframe_string}_product_description"
    length = yearly ? price.duration.in_years.to_i : price.duration.in_months.to_i

Severity: Minor
Found in app/models/concerns/registrar/book_keeping.rb - About 35 mins 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