Showing 303 of 498 total issues
Method release_read_lock
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def release_read_lock
while true
c = @Counter.value
if @Counter.compare_and_set(c, c-1)
# If one or more writers were waiting, and we were the last reader, wake a writer up
- 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 ns_wait_until
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ns_wait_until(timeout = nil, &condition)
if timeout
wait_until = Concurrent.monotonic_time + timeout
loop do
now = Concurrent.monotonic_time
- 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 create_simple_logger
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.create_simple_logger(level = Logger::FATAL, output = $stderr)
# TODO (pitr-ch 24-Dec-2016): figure out why it had to be replaced, stdlogger was deadlocking
lambda do |severity, progname, message = nil, &block|
return false if severity < level
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(delayed, blockers_count, default_executor, executor, args, &task)
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(delayed, blockers_count, default_executor, executor, args, &task)
Avoid deeply nested control flow statements. Open
elsif @Counter.compare_and_set(c, c+1)
@HeldCount.value = held + 1
return true
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(delayed, blockers_count, default_executor, executor, args, &task)
Method compare_and_set
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def compare_and_set(expected_val, new_val, expected_mark, new_mark)
# Memoize a valid reference to the current AtomicReference for
# later comparison.
current = reference
curr_val, curr_mark = current
- 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 reason
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def reason(timeout = nil, timeout_value = nil, resolve_on_timeout = nil)
if wait_until_resolved timeout
internal_state.reason
else
if resolve_on_timeout
- 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 take
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def take
mine = synchronize do
return Concurrent::NULL if ns_closed? && putting.empty?
ref = Concurrent::AtomicReference.new(nil)
- 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 consume_signal
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def consume_signal(message)
if AbstractSignal === message
case message
when Ask
@reply = message.probe
- 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 push
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def push(message, timeout = nil)
pushed_op = @Mutex.synchronize do
return timeout ? true : self if ns_try_push(message)
pushed = Promises.resolvable_future
- 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 value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def value(timeout = nil, timeout_value = nil, resolve_on_timeout = nil)
if wait_until_resolved timeout
internal_state.value
else
if resolve_on_timeout
- 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 ns_shift_message
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ns_shift_message(matcher, remove = true)
i = 0
while true
message = @Messages.fetch(i, NOTHING)
return NOTHING if message == NOTHING
- 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
break if !running_writer?(c) && !running_readers?(c) && @Counter.compare_and_set(c, c+RUNNING_WRITER-WAITING_WRITER)
Method on_envelope
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_envelope(envelope)
command, reason = envelope.message
case command
when :terminated?
terminated?
- 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 InstanceVariableSetVolatile
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ThreadContext context,
IRubyObject module,
IRubyObject self,
IRubyObject name,
IRubyObject value) {
Method resolve
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def resolve(fulfilled = true, value = nil, reason = nil, raise_on_reassign = true, reserved = false)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(core, subsequent, core_options, trapping = false, terminate_children = true)
Method create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.create(type, channel, environment, name, executor)