Showing 12 of 16 total issues
File avp_names.rb
has 996 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Diameter
module Constants
include AVPType
include Vendors
Class AVP
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class AVP
include Internals
include Constants::AVPType
attr_reader :code, :mandatory, :vendor_id
File stack.rb
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'uri'
require 'socket'
require 'diameter/peer'
require 'diameter/message'
require 'diameter/stack_transport_helpers'
Class Stack
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Stack
include Internals
# @!group Setup methods
Method send_request
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_request(req, options={})
fail "Must pass a request" unless req.request
req.add_origin_host_and_realm(@local_host, @local_realm)
peer = options[:peer]
Method handle_message
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def handle_message(msg_bytes, cxn)
# Common processing - ensure that this message has come in on this
# peer's expected connection, and update the last time we saw
# activity on this peer
msg = Message.from_bytes(msg_bytes)
- 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 send_request
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def send_request(req, options={})
fail "Must pass a request" unless req.request
req.add_origin_host_and_realm(@local_host, @local_realm)
peer = options[:peer]
- 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 to_s
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def to_s
has_all_ascii_values =
@content.bytes.reject { |c| (32 < c && c < 126) }.empty?
could_be_32bit_num = (@content.length == 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 main_loop
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main_loop
rs, _ws, es = IO.select(@all_connections + [@wakeup_pipe_rd], [], @all_connections)
es.each do |e|
# :nocov:
Method main_loop
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def main_loop
rs, _ws, es = IO.select(@all_connections + [@wakeup_pipe_rd], [], @all_connections)
es.each do |e|
# :nocov:
- 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 create_answer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_answer(result_code, opts={})
fail "Cannot answer an answer" if answer
avps = []
avps << avp_by_name("Session-Id") unless avp_by_name("Session-Id").nil?
- 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 app_avps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def app_avps
avps = []
@auth_apps.each do |app_id, vendor|
avps << if vendor == 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"