Showing 118 of 118 total issues
Method join
has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring. Open
def join(wallet, ledger: '/dev/null', baseline: false, master: false)
if @id.nil?
@id = wallet.id
@key = wallet.key
@network = wallet.network
- 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 255 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 node [options]'
o.string '--invoice',
'The invoice you want to collect money to or the wallet ID',
File front.rb
has 529 lines of code (exceeds 250 allowed). Consider refactoring. Open
$stdout.sync = true
require 'get_process_mem'
require 'thin'
require 'haml'
File node.rb
has 478 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'open3'
require 'slop'
require 'shellwords'
require 'backtrace'
require 'fileutils'
Method join
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
def join(wallet, ledger: '/dev/null', baseline: false, master: false)
if @id.nil?
@id = wallet.id
@key = wallet.key
@network = wallet.network
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}
Method merge_one
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def merge_one(opts, patch, wallet, name, baseline: false, master: false)
start = Time.now
@log.debug("Adding copy ##{name}#{master ? ' (master)' : ''} to the patch #{wallet.mnemo}...")
if opts['depth'].positive?
patch.join(wallet, ledger: opts['ledger'], baseline: baseline, master: master) do |txn|
- 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 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 paid
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def paid
txns = @wallet.txns
scored = txns.map do |t|
next if t.amount.positive?
pfx, body = t.details.split(' ', 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 initialize
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def initialize(id, date, amount, prefix, bnf, details)
raise 'The ID can\'t be NIL' if id.nil?
raise "ID of transaction can't be negative: #{id}" if id < 1
@id = id
raise 'The time can\'t be NIL' if date.nil?
- 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
Class Wallet
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Wallet
# The name of the main production network. All other networks
# must have different names.
MAINET = 'zold'
Method propagate
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def propagate(id, _)
start = Time.now
modified = []
total = 0
network = @wallets.acq(id, &:network)
- 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 74 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 pay wallet target amount [details] [options]
Where:
'wallet' is the sender's wallet ID
Method pay
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def pay(wallet, opts)
raise 'The wallet is absent' unless wallet.exists?
tax = Tax.new(wallet)
debt = total = tax.debt
@log.info("The current debt of #{wallet.mnemo} is #{debt} (#{debt.to_i} zents), \
- 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 21 (exceeds 5 allowed). Consider refactoring. Open
def run(args = [])
opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
o.banner = 'Usage: zold node [options]'
o.string '--invoice',
'The invoice you want to collect money to or the wallet 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 merge
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def merge(id, cps, opts)
start = Time.now
cps = cps.all(masters_first: !opts['edge-baseline'])
patch = Patch.new(@wallets, log: @log)
score = 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 fetch_one
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def fetch_one(id, r, cps, opts)
if opts['ignore-node'].include?(r.to_s)
@log.debug("#{r} ignored because of --ignore-node")
return 0
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 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 start
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def start
raise 'Block must be given to start()' unless block_given?
@entrance.start do
@seen = Set.new
@modified = Queue.new
- 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 exec
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.exec(threads, set = (0..threads - 1).to_a, &block)
raise 'The thread pool is empty' if POOL.empty?
raise "Number of threads #{threads} has to be positive" unless threads.positive?
list = set.dup
total = [threads, set.count].min
- 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"