Class Base
has 78 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
include EventEmitter
include Spawn
class << self
File base.rb
has 631 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "warden/container/spawn"
require "warden/errors"
require "warden/event_emitter"
require "warden/util"
Method acquire
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def acquire(opts = {})
if !@resources.has_key?("container_id")
@resources["container_id"] = self.class.generate_container_id
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 acquire
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def acquire(opts = {})
if !@resources.has_key?("container_id")
@resources["container_id"] = self.class.generate_container_id
end
Method spawn_job
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def spawn_job(run_options, *args)
job_id = self.class.generate_job_id
job_root = job_path(job_id)
FileUtils.mkdir_p(job_root)
Method spawn_job
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def spawn_job(run_options, *args)
job_id = self.class.generate_job_id
job_root = job_path(job_id)
FileUtils.mkdir_p(job_root)
- 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 restore
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def restore
acquire
if @resources.has_key?("ports")
self.class.port_pool.delete(*@resources["ports"])
- 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 before_destroy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def before_destroy
check_state_in(State::Born, State::Active, State::Stopped, State::Destroyed)
return if self.state == State::Destroyed
begin
- 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"