Showing 7 of 7 total issues
Method analyze
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.analyze(payload, subpayload = false)
::OnesnooperServer::Log.debug "[#{self.name}] Scanning decoded #{subpayload ? 'sub-' : '' }payload #{payload.inspect}"
return {} if payload.blank?
scanned_payload = {}
- 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 data_in_vm_groups
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def data_in_vm_groups(timestamp, data)
data_ary = []
data['VM'].each do |vm_on_host|
next if vm_on_host.blank?
Method analyze
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.analyze(payload, subpayload = false)
::OnesnooperServer::Log.debug "[#{self.name}] Scanning decoded #{subpayload ? 'sub-' : '' }payload #{payload.inspect}"
return {} if payload.blank?
scanned_payload = {}
Method data_in_vm_groups
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def data_in_vm_groups(timestamp, data)
data_ary = []
data['VM'].each do |vm_on_host|
next if vm_on_host.blank?
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(log_dev, log_prefix = '[onesnooper-server]')
if log_dev.kind_of? ::Logger
@logger = log_dev
else
@logger = ::Logger.new(log_dev)
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(monitoring_datagram, source_ip, source_port, store_instances)
unless valid_data?(monitoring_datagram)
::OnesnooperServer::Log.error "[#{self.name}] Dropping invalid monitoring data #{monitoring_datagram.inspect}"
return DATAGRAMS.default.new
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 analyze_simple_pair
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.analyze_simple_pair(key_value, parsed, regexp, suspected_complex = false)
matched = key_value.match(regexp)
if matched
::OnesnooperServer::Log.debug "[#{self.name}] Matched #{key_value.inspect} " \
"as #{matched[:key].inspect} and #{matched[:value].inspect}"
- 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"