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 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 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 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"