Showing 51 of 56 total issues
File data.rb
has 496 lines of code (exceeds 250 allowed). Consider refactoring. Open
module DBus
# FIXME: in general, when an API gives me, a user, a choice,
# remember to make it easy for the case of:
# "I don't CARE, I don't WANT to care, WHY should I care?"
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 process
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def process(msg)
return if msg.nil? # check if somethings wrong
case msg.message_type
when Message::ERROR, Message::METHOD_RETURN
- 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_one
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def parse_one(char, for_array: false)
res = nil
case char
when "a"
res = Type.new(ARRAY)
- 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
Method my_class_attribute
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def my_class_attribute(*attrs)
instance_reader = true
instance_writer = true
attrs.each do |name|
- 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
Class Object
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Object
# @return [ObjectPath] The path of the object.
attr_reader :path
# The interfaces that the object supports. Hash: String => Interface
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 run
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def run
# before blocking, empty the buffers
# https://bugzilla.novell.com/show_bug.cgi?id=537401
@buses.each_value do |b|
while (m = b.message_queue.message_from_buffer_nonblock)
- 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 next_state
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def next_state(received_words)
msg = received_words
case @state
when :WaitingForData
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]
File type.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
module DBus
# Like a {Signature} but containing only a single complete type.
#
# For documentation purposes only.
class SingleCompleteType < String; end
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 process
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process(msg)
return if msg.nil? # check if somethings wrong
case msg.message_type
when Message::ERROR, Message::METHOD_RETURN
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 my_class_attribute
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def my_class_attribute(*attrs)
instance_reader = true
instance_writer = true
attrs.each do |name|
Method define_shortcut_methods
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def define_shortcut_methods
# builds a list of duplicated methods
dup_meths = []
univocal_meths = {}
@interfaces.each_value do |intf|
- 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 parse_one
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_one(char, for_array: false)
res = nil
case char
when "a"
res = Type.new(ARRAY)