Showing 67 of 1,476 total issues
Method healthy?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def healthy?(url)
begin
# Note, not all nodes support the /health uri. But even if they don't,
# they'll respond status code 200 OK, even if the body shows an error.
- 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 method_names
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def method_names
@method_names ||= [
:head_block_number,
:head_block_id,
:time,
Method initialize
has 29 lines of code (exceeds 25 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?
Method send_log
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_log(level, obj, prefix = nil)
log_message = case obj
when String
log_message = if !!prefix
"#{prefix} :: #{obj}"
Method shutdown
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def shutdown
flappy = false
begin
unless @api.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
Method broadcast!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def broadcast!(auto_reset = false)
raise ChainError, "Required option: chain" if @chain.nil?
raise ChainError, "Required option: account_name, wif" if @account_name.nil? || @wif.nil?
begin
- 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 get_blocks
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_blocks(block_number, &block)
block_number = [*(block_number)].flatten
if !!block
block_number.each do |i|
- 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 healthy?
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def healthy?(url)
begin
# Note, not all nodes support the /health uri. But even if they don't,
# they'll respond status code 200 OK, even if the body shows an error.
Method shutdown
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def shutdown
@uri = nil
@http_id = nil
@http_memo.each do |k|
v = @http_memo.delete(k)
Method request
has 26 lines of code (exceeds 25 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)]
Method transactions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def transactions(start = nil, mode = :irreversible, &block)
blocks(start, mode) do |b, block_number|
next if (_transactions = b.transactions).nil?
return _transactions unless !!block
- 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 post
has a Cognitive Complexity of 8 (exceeds 5 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]
- 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
Avoid deeply nested control flow statements. Open
if !!response['id']
warning "Unexpected rpc_id (expected: #{options[:id]}, got: #{response['id']}), retrying ...", method_name, true
else
# The node has broken the jsonrpc spec.
warning "Node did not provide jsonrpc id (expected: #{options[:id]}, got: nothing), retrying ...", method_name, true
Avoid deeply nested control flow statements. Open
debug_payload(options, body) if ENV['DEBUG'] == 'true'
Avoid deeply nested control flow statements. Open
elsif response.keys.include?('error')
handle_error(response, options, method_name, tries)
else
Hashie::Mash.new(response)
Avoid deeply nested control flow statements. Open
if response.keys.include?('error')
handle_error(response, options, method_name, tries)
end
Method operations
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def operations(type = nil, start = nil, mode = :irreversible, options = {include_virtual: false}, &block)
Method type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def type(chain, key, param, value)
return if value.nil?
t = TYPES[key] or return value
p = t[param] or return value
- 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 stopped?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def stopped?
http_active = if @http_memo.nil?
false
else
@http_memo.values.map do |http|
- 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 signature
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def signature
public_key_hex = @private_key.pub
ec = Bitcoin::OpenSSL_EC
digest_hex = digest.freeze
count = 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"