Showing 53 of 53 total issues
File celluloid.rb
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "English"
require "logger"
require "set"
require "timeout"
Class Actor
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class Actor
attr_reader :behavior, :proxy, :tasks, :links, :mailbox, :thread, :name, :timers
attr_writer :exit_handler
class << self
Method run
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def run
while @running
begin
@timers.wait do |interval|
interval = 0 if interval && interval < 0
- 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 shutdown
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def shutdown
actors = running
Timeout.timeout(shutdown_timeout) do
Internals::Logger.debug "Terminating #{actors.size} #{actors.size > 1 ? 'actors' : 'actor'}..." unless actors.empty?
- 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 Pool
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Pool
include Celluloid
trap_exit :__crash_handler__
finalizer :__shutdown__
Method resync_accessors
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def resync_accessors
# methods for setting and getting the usual defaults
Configuration.parameters(:mandatory, :optional, :plugins, :meta).each do |key|
self.class.instance_eval do
remove_method :"#{key}!" rescue nil # avoid warnings in tests
- 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 valid?
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def valid?(configuration, fails = false)
parameters(:mandatory).each do |k|
unless configuration.key? k
if fails
raise Error::Incomplete, "Missing `:#{k}` in supervision configuration."
- 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 property
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def property(name, opts = {})
default = opts.fetch(:default, nil)
multi = opts.fetch(:multi, false)
ivar_name = "@#{name}".to_sym
- 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 linking_request
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def linking_request(receiver, type)
Celluloid.exclusive do
receiver.mailbox << LinkingRequest.new(Actor.current, type)
system_events = []
- 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 dump
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def dump
string = ""
string << "Celluloid::Actor 0x#{id.to_s(16)}"
string << " [#{name}]" if name
string << "\n"
- 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 included
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def included(klass)
klass.send :extend, ClassMethods
klass.send :include, InstanceMethods
klass.send :extend, Internals::Properties
Method value
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def value(timeout = nil)
ready = result = nil
begin
@mutex.lock
- 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 check
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def check(obj)
# NOTE: don't use respond_to? here
begin
meth = obj.method(@method)
rescue NameError
- 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 resync_accessors
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def resync_accessors
# methods for setting and getting the usual defaults
Configuration.parameters(:mandatory, :optional, :plugins, :meta).each do |key|
[:"#{key}!", :"#{key}="].each do |m|
self.class.instance_eval do
- 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 running
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def running
actors = []
@group.each do |t|
next unless t.role == :actor
actor = t.actor
- 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 shutdown
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def shutdown
actors = running
Timeout.timeout(shutdown_timeout) do
Internals::Logger.debug "Terminating #{actors.size} #{actors.size > 1 ? 'actors' : 'actor'}..." unless actors.empty?
Method value
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def value(timeout = nil)
ready = result = nil
begin
@mutex.lock
Method respond_to?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def respond_to?(meth, include_private = false)
# NOTE: use method() here since this class
# shouldn't be used directly, and method() is less
# likely to be "reimplemented" inconsistently
# with other Object.*method* methods.
- 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 terminate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def terminate
raise "Cannot terminate an exclusive task" if exclusive?
if running?
if Internals::Logger.level == Logger::DEBUG
- 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 resync_accessors
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resync_accessors
# methods for setting and getting the usual defaults
Configuration.parameters(:mandatory, :optional, :plugins, :meta).each do |key|
self.class.instance_eval do
remove_method :"#{key}!" rescue nil # avoid warnings in tests