Method run
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(args = [])
opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
o.banner = "Usage: zold remote <command> [options]
Available commands:
#{Rainbow('remote show').green}
File remote.rb
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'slop'
require 'semantic'
require 'rainbow'
require 'net/http'
require 'json'
Method update
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def update(opts)
st = Time.now
seen = Set.new
capacity = []
opts['depth'].times do
- 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
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update(opts)
st = Time.now
seen = Set.new
capacity = []
opts['depth'].times do
Method elect
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def elect(opts)
scores = []
@remotes.iterate(@log, farm: @farm, threads: opts['threads']) do |r|
uri = '/'
res = r.http(uri).get
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def run(args = [])
opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
o.banner = "Usage: zold remote <command> [options]
Available commands:
#{Rainbow('remote show').green}
- 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 show
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def show
@remotes.all.each do |r|
score = Rainbow("/#{r[:score]}").color(r[:score].positive? ? :green : :red)
@log.info(
[
- 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 reboot
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def reboot(r, json, opts)
return unless json['repo'] == Zold::REPO
mine = Semantic::Version.new(VERSION)
if mine < Semantic::Version.new(json['version'])
if opts['reboot']
- 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 add
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add(host, port, opts)
if opts['ignore-node'].include?("#{host}:#{port}")
@log.debug("#{host}:#{port} won't be added since it's in the --ignore-node list")
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"
Further reading
Method select
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def select(opts)
@remotes.all.shuffle.sort_by { |r| r[:errors] }.reverse.each_with_index do |r, idx|
next if idx < opts['max-nodes']
next if r[:master] && !opts['masters-too']
@remotes.remove(r[:host], r[:port])
- 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 trim
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def trim(opts)
all = @remotes.all
all.each do |r|
next if r[:errors] <= opts['tolerate']
@remotes.remove(r[:host], r[:port]) if !opts['masters-too'] || !r[:master]
- 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"