Showing 45 of 63 total issues
Method filter_recursively
has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring. Open
def filter_recursively selected_element_xpaths, output_e, raw_output_e, filter_e, options={}
if filter_e
if raw_output_e.name == filter_e.name
# Namespace Selection
filter_namespace = options['namespace'] || filter_e.namespace
- 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 validate_recursively
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def validate_recursively node, xml_e, parent_xml_e: nil, validated: []
case node.stmt
when 'root', 'container'
case xml_e
when 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 start_notification_replay_thread
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def start_notification_replay_thread stream, start_time, stop_time, events
@notification_replay_thread = Thread.new do
log_info { "Notification replay start for stream: #{stream}" }
begin
@monitor.synchronize do
- 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 receive_message
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def receive_message
chunk_size = StringIO.new
chunked_msg = StringIO.new
decoded_msg = StringIO.new
read_len = 1
- 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 define_capability
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def define_capability
oper_proc('create-subscription'){ |session, datastore, input_e|
stream_e = input_e.elements['stream']
unless stream_e
log_debug { "create-subscription doesn't have stream, so use NETCONF stream" }
- 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 validate_recursively
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_recursively node, xml_e, parent_xml_e: nil, validated: []
case node.stmt
when 'root', 'container'
case xml_e
when nil
Method receive_message
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
def receive_message
chunk_size = StringIO.new
chunked_msg = StringIO.new
decoded_msg = StringIO.new
read_len = 1
File session.rb
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'time'
require 'date'
require 'thread'
require 'monitor'
require 'rexml/document'
Method operation_loop
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def operation_loop
datastore_session = @datastore.new_session self
operation = Operation.new self, @capabilities, datastore_session, @strict_capabilities, @enable_filter, logger: logger
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 filter_recursively
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filter_recursively selected_element_xpaths, output_e, raw_output_e, filter_e, options={}
if filter_e
if raw_output_e.name == filter_e.name
# Namespace Selection
filter_namespace = options['namespace'] || filter_e.namespace
Method define_capability
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
def define_capability
oper_proc('get'){ |session, datastore, input_e|
datastore.run 'get', input_e
}
Method define_capability
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
def define_capability
oper_proc('get'){ |session, datastore, input_e|
datastore.run 'get', input_e
}
Class Session
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Session
include Loggable
attr_reader :session_id
Method define_capability
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def define_capability
oper_proc('create-subscription'){ |session, datastore, input_e|
stream_e = input_e.elements['stream']
unless stream_e
log_debug { "create-subscription doesn't have stream, so use NETCONF stream" }
Class Capability
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Capability
include Loggable
@subclass_list = Array.new
Method to_rpc_error
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_rpc_error
xml_doc = REXML::Document.new
rpc_error_e = xml_doc.add_element 'rpc-error'
tag_e = rpc_error_e.add_element 'error-tag'
tag_e.text = @tag
Method operation_loop
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def operation_loop
datastore_session = @datastore.new_session self
operation = Operation.new self, @capabilities, datastore_session, @strict_capabilities, @enable_filter, logger: logger
begin
Method run
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run xml_doc
unless xml_doc.root.name == 'rpc'
log_error { "Invalid root tag: must be rpc, but got #{xml_doc.root.name}" }
raise Error['operation-not-supported'].new('protocol', 'error', logger: logger)
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 run
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run xml_doc
unless xml_doc.root.name == 'rpc'
log_error { "Invalid root tag: must be rpc, but got #{xml_doc.root.name}" }
raise Error['operation-not-supported'].new('protocol', 'error', logger: logger)
end
Method send_message
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_message msg
raw_msg = StringIO.new
case msg
when String
begin