lib/docker/container.rb
Class Container
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Docker::Container
include Docker::Base
# Update the @info hash, which is the only mutable state in this object.
# e.g. if you would like a live status from the #info hash, call #refresh! first.
File container.rb
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class Docker::Container
include Docker::Base
# Update the @info hash, which is the only mutable state in this object.
# e.g. if you would like a live status from the #info hash, call #refresh! first.
Method exec
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def exec(command, options = {}, &block)
# Establish values
tty = options.delete(:tty) || false
detach = options.delete(:detach) || false
user = options.delete(:user)
Method stats
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def stats(options = {})
if block_given?
options[:read_timeout] ||= 10
options[:idempotent] ||= false
parser = lambda do |chunk, remaining_bytes, total_bytes|
- 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 top
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def top(opts = {})
format = opts.delete(:format) { :array }
resp = Docker::Util.parse_json(connection.get(path_for(:top), opts))
if resp['Processes'].nil?
format == :array ? [] : {}
- 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"