Method dispatch_request
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def dispatch_request(message)
request = Request.new(message, @servers)
request.each do |server|
@logger.debug "[#{message.id}] Sending request #{message.question.inspect} to server #{server.inspect}" if @logger
- 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 addresses_for
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def addresses_for(name, resource_class = Resolv::DNS::Resource::IN::A, options = {})
name = fully_qualified_name(name)
cache = options.fetch(:cache, {})
retries = options.fetch(:retries, DEFAULT_RETRIES)
- 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 addresses_for
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def addresses_for(name, resource_class = Resolv::DNS::Resource::IN::A, options = {})
name = fully_qualified_name(name)
cache = options.fetch(:cache, {})
retries = options.fetch(:retries, DEFAULT_RETRIES)
Method valid_response
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def valid_response(message, response)
if response.tc != 0
@logger.warn "[#{message.id}] Received truncated response!" if @logger
elsif response.id != message.id
@logger.warn "[#{message.id}] Received response with incorrect message id: #{response.id}!" if @logger
- 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_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fully_qualified_name(name)
# If we are passed an existing deconstructed name:
if Resolv::DNS::Name === name
if name.absolute?
return 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"