internetee/registry

View on GitHub
app/models/contact.rb

Summary

Maintainability
D
2 days
Test Coverage
A
92%

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 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 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 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

There are no issues that match your filters.

Category
Status