Showing 11 of 11 total issues
Class Droplet
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Droplet
include HealthManager::Common
attr_reader :id, :state, :live_version, :num_instances, :package_state, :last_updated, :crashes, :extra_instances
attr_accessor :desired_state_update_required
Method process_next_batch
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def process_next_batch(bulk_token, start_time, &block)
with_credentials do |user, password|
options = {
:head => { 'authorization' => [user, password] },
:query => {
- 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 update_extra_instances
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def update_extra_instances
@extra_instances.clear
num_running = 0
- 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 process_next_batch
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_next_batch(bulk_token, start_time, &block)
with_credentials do |user, password|
options = {
:head => { 'authorization' => [user, password] },
:query => {
Method update_extra_instances
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_extra_instances
@extra_instances.clear
num_running = 0
Method deep_merge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def deep_merge(first_hash, other_hash)
first_hash.merge(other_hash) do |_, oldval, newval|
oldval = oldval.to_hash if oldval.respond_to?(:to_hash)
newval = newval.to_hash if newval.respond_to?(:to_hash)
oldval.class.to_s == 'Hash' && newval.class.to_s == 'Hash' ? deep_merge(oldval, newval) : newval
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(varz, nudger, scheduler, actual_state, desired_state, droplet_registry)
Method with_credentials
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def with_credentials
if @user && @password
yield @user, @password
else
logger.info("bulk: requesting API credentials over message bus...")
- 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 schedule
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def schedule(options, &block)
raise ArgumentError unless options.length == 1
raise ArgumentError, 'block required' unless block_given?
arg = options.first
sendee = {
- 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 update_user_counts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_user_counts
with_credentials do |user, password|
options = {
:head => { 'authorization' => [user, password] },
:query => { 'model' => 'user' }
- 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 on_missing_instances
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_missing_instances(droplet)
unless actual_state.available?
logger.warn "harmonizer.actual-state.unavailable"
return
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"