Showing 23 of 23 total issues
Class Image
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Docker::Image
include Docker::Base
# Given a command and optional list of streams to attach to, run a command on
# an Image. This will not modify the Image, but rather create a new Container
Class Container
has 27 methods (exceeds 20 allowed). Consider refactoring. 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 request
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def request(*args, &block)
retries ||= 0
request = compile_request_params(*args, &block)
log_request(request)
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"
Further reading
File container.rb
has 261 lines of code (exceeds 250 allowed). Consider refactoring. 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 image.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Docker::Image
include Docker::Base
# Given a command and optional list of streams to attach to, run a command on
# an Image. This will not modify the Image, but rather create a new Container
Method request
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request(*args, &block)
retries ||= 0
request = compile_request_params(*args, &block)
log_request(request)
begin
Method exec
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exec(command, options = {}, &block)
# Establish values
tty = options.delete(:tty) || false
detach = options.delete(:detach) || false
user = options.delete(:user)
Method hijack_for
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hijack_for(stdin, block, msg_stack, tty)
attach_block = attach_for(block, msg_stack, tty)
lambda do |socket|
debug "hijack: hijacking the HTTP socket"
Method create_tar
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_tar(hash = {})
output = StringIO.new
Gem::Package::TarWriter.new(output) do |tar|
hash.each do |file_name, file_details|
permissions = file_details.is_a?(Hash) ? file_details[:permissions] : 0640
- 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 docker_context
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def docker_context(directory)
all_files = glob_all_files(File.join(directory, "**/*"))
dockerignore = File.join(directory, '.dockerignore')
return all_files unless all_files.include?(dockerignore)
- 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
Docker.logger.warn(
<<~RETRY_WARNING
Automatically retrying with content type '#{response_cause}'
Original Error: #{ex}
RETRY_WARNING
Method build_from_tar
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_from_tar(tar, opts = {}, connection = Docker.connection,
creds = nil, &block)
Method build_from_dir
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_from_dir(dir, opts = {}, connection = Docker.connection,
creds = nil, &block)
Method load
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def load(tar, opts = {}, conn = Docker.connection, creds = nil, &block)
Method add_file_to_tar
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_file_to_tar(tar, name, mode, size, mtime)
Method compile_request_params
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def compile_request_params(http_method, path, query = nil, opts = nil, &block)
Method file_hash_from_paths
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def file_hash_from_paths(local_paths)
local_paths.each_with_object({}) do |local_path, file_hash|
unless File.exist?(local_path)
raise ArgumentError, "#{local_path} does not exist."
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 create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create(opts = {}, creds = nil, conn = Docker.connection, &block)
credentials = creds.nil? ? Docker.creds : MultiJson.dump(creds)
headers = credentials && Docker::Util.build_auth_header(credentials) || {}
body = ''
conn.post(
- 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 hijack_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def hijack_for(stdin, block, msg_stack, tty)
attach_block = attach_for(block, msg_stack, tty)
lambda do |socket|
debug "hijack: hijacking the HTTP socket"
- 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 run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run(cmd = nil, options = {})
opts = {'Image' => self.id}.merge(options)
opts["Cmd"] = cmd.is_a?(String) ? cmd.split(/\s+/) : cmd
begin
Docker::Container.create(opts, connection)
- 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"