Showing 6 of 6 total issues
Method delegate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def delegate(*methods)
options = methods.pop
unless options.is_a?(Hash) && to = options[:to]
raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter)."
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"
Further reading
Method delegate
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delegate(*methods)
options = methods.pop
unless options.is_a?(Hash) && to = options[:to]
raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter)."
end
Method work_with_kalashnikov
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def work_with_kalashnikov(interval=5.0, &block)
interval = Float(interval)
@fibers = []
startup
- 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 work_sync_on
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def work_sync_on(job, &block)
log 'work sync'
if @child = fork(job)
srand # Reseeding
procline "Forked #{@child} at #{Time.now.to_i}"
- 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 work_with_kalashnikov
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def work_with_kalashnikov(interval=5.0, &block)
interval = Float(interval)
@fibers = []
startup
Method included
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(base)
base.class_eval do
get "/kalashnikov" do
render_erb 'server/views/catridges.erb'
end