Method append
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def append(type, val)
raise TypeException, "Cannot send nil" if val.nil?
type = type.chr if type.is_a?(Integer)
type = Type::Parser.new(type).parse[0] if type.is_a?(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 do_parse
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def do_parse(signature, mode: :plain)
# FIXME: better naming for packet vs value
packet = nil
data_class = Data::BY_TYPE_CODE[signature.sigtype]
- 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 make_variant
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.make_variant(value)
# TODO: mix in _make_variant to String, Integer...
if value == true
["b", true]
elsif value == false
- 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
File marshall.rb
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "socket"
require_relative "../dbus/type"
# = D-Bus main module
Method do_parse
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def do_parse(signature, mode: :plain)
# FIXME: better naming for packet vs value
packet = nil
data_class = Data::BY_TYPE_CODE[signature.sigtype]
Method append
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def append(type, val)
raise TypeException, "Cannot send nil" if val.nil?
type = type.chr if type.is_a?(Integer)
type = Type::Parser.new(type).parse[0] if type.is_a?(String)
Method append_variant
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def append_variant(val)
vartype = nil
if val.is_a?(DBus::Data::Variant)
vartype = val.member_type
vardata = val.exact_value
- 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 make_variant
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.make_variant(value)
# TODO: mix in _make_variant to String, Integer...
if value == true
["b", true]
elsif value == false
Method append_variant
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def append_variant(val)
vartype = nil
if val.is_a?(DBus::Data::Variant)
vartype = val.member_type
vardata = val.exact_value
Method append_array
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def append_array(child_type, val)
if val.is_a?(Hash)
raise TypeException, "Expected an Array but got a Hash" if child_type.sigtype != Type::DICT_ENTRY
# Damn ruby rocks here
- 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"