Showing 67 of 1,476 total issues
Method initialize
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options = {})
@user = options[:user]
@password = options[:password]
@chain = (options[:chain] || 'hive').to_sym
@url = options[:url] || Api::default_url(@chain)
- 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 recover_transaction
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def recover_transaction(signatures, expected_rpc_id, after)
debug "Looking for signatures: #{signatures.map{|s| s[0..5]}} since: #{after}"
count = 0
start = Time.now.utc
- 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
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def process(broadcast = false)
prepare
if broadcast
loop 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 extract_signatures
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def extract_signatures(options)
return [] unless defined? options[:params].map
params = options[:params]
- 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 payload
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def payload
params = {}
Operation::param_names(@type.to_sym).each do |p|
next unless defined? p
- 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 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(options = {})
options = options.dup
options.each do |k, v|
k = k.to_sym
if VALID_OPTIONS.include?(k.to_sym)
Method request
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def request(options)
request = post_request
skip_health_check = options.delete(:skip_health_check)
request.body = JSON[options.merge(jsonrpc: '2.0', id: rpc_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 send_log
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def send_log(level, obj, prefix = nil)
log_message = case obj
when String
log_message = if !!prefix
"#{prefix} :: #{obj}"
- 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 operations
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def operations(type = nil, start = nil, mode = :irreversible, options = {include_virtual: false}, &block)
type = [type].flatten.compact.map(&:to_sym)
include_virtual = !!options[:include_virtual]
if virtual_op_type?(type)
Method post
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def post(options = {})
tags = [options[:tags] || []].flatten
title = options[:title].to_s
permlink = options[:permlink] || title.downcase.gsub(/[^a-z0-9\-]+/, '-')
parent_permlink = options[:parent_permlink] || tags[0]
Method shutdown
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def shutdown
@api.shutdown if !!@api
@network_broadcast_api.shutdown if !!@network_broadcast_api
if @self_logger
- 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 handle_error
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_error(response, request_options, method_name, tries)
parser = ErrorParser.new(response)
_signatures, exp = extract_signatures(request_options)
if (!!exp && exp < Time.now.utc) || (tries > 2 && !parser.node_degraded?)
Method method_missing
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def method_missing(m, *args, &block)
super unless respond_to_missing?(m)
@latest_values ||= []
@latest_values.shift(5) if @latest_values.size > 20
Method recover_transaction
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def recover_transaction(signatures, expected_rpc_id, after)
debug "Looking for signatures: #{signatures.map{|s| s[0..5]}} since: #{after}"
count = 0
start = Time.now.utc
Method process
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process(broadcast = false)
prepare
if broadcast
loop do
Method http
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def http
return @http_memo[http_id] if @http_memo.keys.include? http_id
@http_memo[http_id] = if @persist && @persist_error_count < 10
idempotent = api_name != :network_broadcast_api
- 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 prepare
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prepare
raise TransactionError, "No wif or private key." unless !!@wif || !!@private_key
@payload = nil
Method default_failover_urls
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.default_failover_urls(chain)
case chain.to_sym
when :steem, :hive
begin
_api = Radiator::Api.new(url: DEFAULT_HIVE_FAILOVER_URLS.sample, failover_urls: DEFAULT_HIVE_FAILOVER_URLS)
Method to_bytes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def to_bytes
bytes = [id(@type.to_sym)].pack('C')
Operation::param_names(@type.to_sym).each do |p|
next unless defined? p
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options = {})
@root_url = options[:root_url] || 'https://api.steem-engine.net/rpc'
@self_hashie_logger = false
@hashie_logger = if options[:hashie_logger].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"