Showing 31 of 33 total issues
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 matches?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def matches?(*rules)
rules.flatten!
match = local.matches?(rules)
match ||= host.matches?(rules)
return match if match
- 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 find_provider
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_provider # :nodoc:
return provider if provider
Config.providers.each do |provider, config|
if config[:host_match] && matches?(config[:host_match])
- 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_size?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def valid_size?
return set_error(:local_size_long) if local.size > STANDARD_MAX_SIZE
if @host&.hosted_service?
return false if @config[:local_private_size] && !valid_size_checks(@config[:local_private_size])
elsif @config[:local_size] && !valid_size_checks(@config[:local_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
Avoid too many return
statements within this method. Open
return rule if self.provider && provider_matches?(rule)
Avoid too many return
statements within this method. Open
return rule if ip_matches?(rule)
Avoid too many return
statements within this method. Open
return rule if domain_matches?(rule)
Avoid too many return
statements within this method. Open
return false unless host.valid?
Avoid too many return
statements within this method. Open
return false unless local.valid?
Method format
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def format(form = @config[:local_format] || :conventional)
if @config[:local_format].is_a?(Proc)
@config[:local_format].call(self)
elsif form == :conventional
conventional
- 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 error_messages
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.error_messages(hash = {}, locale = "en", *extra)
hash = extra.first if extra.first.is_a? Hash
@errors[locale] ||= {}
@errors[locale]["email_address"] ||= {}
- 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"