Showing 31 of 33 total issues
Class Host
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class Host
attr_reader :host_name
attr_accessor :dns_name, :domain_name, :registration_name,
:tld, :tld2, :subdomains, :ip_address, :config, :provider,
:comment, :error_message, :reason, :locale
File host.rb
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "simpleidn"
require "resolv"
module EmailAddress
##############################################################################
Class Local
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class Local
attr_reader :local
attr_accessor :mailbox, :comment, :tag, :config, :original
attr_accessor :syntax, :locale
Class Address
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Address
include Comparable
include Rewriter
attr_accessor :original, :local, :host, :config, :reason, :locale
Method valid?
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def valid?(options = {})
@error = nil
unless local.valid?
return set_error local.error
end
- Read upRead up
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 local.rb
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
module EmailAddress
##############################################################################
# EmailAddress Local part consists of
# - comments
# - mailbox
Method matches?
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def matches?(rules)
rules = Array(rules)
return false if rules.empty?
rules.each do |rule|
return rule if rule == domain_name || rule == dns_name
- Read upRead up
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 valid_format?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def valid_format?
if host_name =~ CANONICAL_HOST_REGEX && to_s.size <= MAX_HOST_LENGTH
if localhost?
return @config[:host_local] ? true : set_error(:domain_no_localhost)
end
- Read upRead up
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 valid?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def valid?(rules = {})
host_validation = rules[:host_validation] || @config[:host_validation] || :mx
dns_lookup = rules[:dns_lookup] || @config[:dns_lookup] || host_validation
self.error_message = nil
if host_name && !host_name.empty? && !@config[:host_size].include?(host_name.size)
- Read upRead up
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 valid_ip?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def valid_ip?
if !@config[:host_allow_ip]
bool = set_error(:ip_address_forbidden)
elsif ip_address.include?(":")
bool = ip_address.match(Resolv::IPv6::Regex) ? true : set_error(:ipv6_address_invalid)
- Read upRead up
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 host_name=
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def host_name=(name)
name = fully_qualified_domain_name(name.downcase)
@host_name = name
if @config[:host_remove_spaces]
@host_name = @host_name.delete(" ")
Method valid_mx?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def valid_mx?
return true unless dns_enabled?
if exchangers.nil?
set_error(:domain_unknown)
elsif exchangers.mx_ips.size > 0
- Read upRead up
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 host_name=
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def host_name=(name)
name = fully_qualified_domain_name(name.downcase)
@host_name = name
if @config[:host_remove_spaces]
@host_name = @host_name.delete(" ")
- Read upRead up
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 10 (exceeds 5 allowed). Consider refactoring. Open
def matches?(rules)
rules = Array(rules)
rules.each do |rule|
if rule.include?("/")
return rule if in_cidr?(rule)
- Read upRead up
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 txt
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def txt(alternate_host = nil)
return nil unless dns_enabled?
Resolv::DNS.open do |dns|
dns.timeouts = @config[:dns_timeout] if @config[:dns_timeout]
records = begin
- Read upRead up
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 valid?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def valid?(format = @config[:local_format] || :conventional)
if @config[:mailbox_validator].is_a?(Proc)
@config[:mailbox_validator].call(mailbox, tag)
elsif format.is_a?(Proc)
format.call(self)
- Read upRead up
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 parse_prvs
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_prvs(email, options = {})
if email.match(PRVS_REGEX)
@rewrite_scheme = :prvs
k, ddd, ssssss, email = [$1, $2, $3, $4]
- Read upRead up
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 fully_qualified_domain_name
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def fully_qualified_domain_name(host_part)
dn = @config[:address_fqdn_domain]
if !dn
if (host_part.nil? || host_part <= " ") && @config[:host_local] && @config[:host_auto_append]
"localhost"
- Read upRead up
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 parse_srs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_srs(email, options = {}, &block)
if email&.match(SRS_FORMAT_REGEX)
@rewrite_scheme = :srs
hhh, tt, domain, local, sending_domain = [$1, $2, $3, $4, $5]
# hhh = tt = sending_domain if false && hhh # Hide warnings for now :-)
- Read upRead up
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 conventional?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def conventional?
self.syntax = :invalid
if tag
return false unless mailbox =~ CONVENTIONAL_MAILBOX_REGEX &&
tag =~ CONVENTIONAL_TAG_REGEX
- Read upRead up
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"