Showing 15 of 21 total issues
Class Command
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Command # rubocop:disable ClassLength
include DoSnapshot::Helpers
RESET_OPTIONS = [:droplets, :exclude, :only, :keep, :quiet,
:stop, :clean, :timeout, :shutdown, :delay,
Method stub_cleanup
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def stub_cleanup
@stubs ||= {}
@stubs.each_pair do |_k, v|
remove_request_stub(v) if v.class == WebMock::RequestStub
next unless v.class == 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"
Further reading
Method setup_config
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def setup_config # rubocop:disable Metrics/AbcSize
DoSnapshot.configure do |config|
config.logger = ::Logger.new(options['log']) if options['log']
config.logger_level = Logger::DEBUG if config.verbose
config.verbose = options['trace']
- 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 stub_with_id_name
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def stub_with_id_name(request, id, name, fixture, type = :get, body = nil, status = 200) # rubocop:disable Metrics/ParameterLists
Method stub_with_id
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def stub_with_id(request, id, fixture, type = :get, body = nil, status = 200) # rubocop:disable Metrics/ParameterLists
Method fail_power_off
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fail_power_off(e)
return unless shutdown
return unless e && e.id
api.start_droplet(e.id)
rescue
- 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 dispatch_droplets
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dispatch_droplets
droplets.each do |droplet|
id = droplet.id.to_s
next if exclude.include? id
next unless only.empty? || only.include?(id)
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
Method stub_without_id
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def stub_without_id(request, fixture, type = :get, body = nil, status = 200)
Method stub_with_id_name
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def stub_with_id_name(request, id, name, fixture, status = 200)
Method assemble_gems
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def assemble_gems(target_dir = Dir.pwd)
%x{ env BUNDLE_WITHOUT="development:test" bundle show }.split("\n").each do |line|
next unless line =~ /^ \* (.*?) \((.*?)\)/
next if GEM_BLACKLIST.include?(Regexp.last_match[1])
puts "vendoring: #{Regexp.last_match[1]}-#{Regexp.last_match[2]}"
- 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 stop_droplet
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def stop_droplet(droplet)
return true unless shutdown
logger.debug 'Shutting down droplet.'
api.stop_droplet(droplet.id) unless droplet.status.include? 'off'
true
- 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 droplet
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def droplet(id)
# noinspection RubyResolve
result = client.droplets.find(id: id)
fail DropletFindError, id unless result
result
- 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 default_handler
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def default_handler(*response_codes, &block)
if response_codes.empty?
default_handlers[:any] = block
else
response_codes.each do |code|
- 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 handler
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handler(*response_codes, &block)
if response_codes.empty?
handlers[:any] = block
else
response_codes.each do |code|
- 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"