Method decode_sensor_data
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def decode_sensor_data
# For Argos data data prior to 2014-03-01 (DS/DIAG data) the sensor data may either integer or hex
# Argos data from 2014-03-01 and onwards (XML from SOAP web service) contain both integer and hex data,
# as well as platform_model string
- 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 decode_sensor_data
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decode_sensor_data
# For Argos data data prior to 2014-03-01 (DS/DIAG data) the sensor data may either integer or hex
# Argos data from 2014-03-01 and onwards (XML from SOAP web service) contain both integer and hex data,
# as well as platform_model string
Method inject_platform_deployment_metadata
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def inject_platform_deployment_metadata
deployment = deployment_hash
if not deployment.nil? and deployment.key? :id
Method inject_platform_deployment_metadata
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def inject_platform_deployment_metadata
deployment = deployment_hash
if not deployment.nil? and deployment.key? :id
- 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 inject_indvidual
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def inject_indvidual
deployment = deployment_hash
if deployment.key? :individual
- 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 deeply nested control flow statements. Open
if self[:type] =~ /^(ds|diag)$/
decoder.sensor_data_format = "hex"
self[:sensor_data_format] = "hex"
end
Method next_deployment_after_measured
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def next_deployment_after_measured
measured = Time.parse(self[:measured]||self[:positioned])
# Simple case first: measured is after deployed and before terminated
if idx = deployments.find_index { |d|
- 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"