Showing 5 of 5 total issues
Method poll
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def poll(session, idle_time = 0.2, timeout = 5)
Timeout::timeout(timeout) do
until yield
print "." unless silenced
process_events(session)
- 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 attach_function
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.attach_function(c_name = nil, name, args, returns, &block)
Method with_string_buffer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def with_string_buffer(length, *args)
if length > 0
with_buffer(:char, size: length + 1) do |buffer, size|
error = yield buffer, size
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(pointer_or_count)
count = if pointer_or_count.is_a?(FFI::Pointer)
if pointer_or_count.null?
0
else
- 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 try
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def try(name, *args, &block)
public_send(name, *args, &block).tap do |error|
if error.is_a?(APIError)
raise error unless error.is_a?(IsLoadingError)
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"