Showing 8 of 8 total issues
Class Node
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Node
include Support
extend Support
attr_reader :private_key
Method initialize
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def initialize(opts = {})
@depth = 0
@index = 0
opts[:seed] = [opts[:seed_hex]].pack("H*") if opts[:seed_hex]
if opts[:seed]
- 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 node.rb
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
module MoneyTree
class Node
include Support
extend Support
Class PrivateKey
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class PrivateKey < Key
def initialize(opts = {})
@options = opts
generate
if @options[:key]
Method node_for_path
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def node_for_path(path)
force_public = path[-4..-1] == ".pub"
path = path[0..-5] if force_public
parts = path.split("/")
nodes = []
- 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 decode_base58
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def decode_base58(base58_val)
s = base58_to_int(base58_val).to_s(16); s = (s.bytesize.odd? ? "0" + s : s)
s = "" if s == "00"
leading_zero_bytes = (base58_val.match(/^([1]+)/) ? $1 : "").size
s = ("00" * leading_zero_bytes) + s if leading_zero_bytes > 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 to_serialized_hex
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_serialized_hex(type = :public, network: :bitcoin)
raise PrivatePublicMismatch if type.to_sym == :private && private_key.nil?
version_key = type.to_sym == :private ? :extended_privkey_version : :extended_pubkey_version
hex = NETWORKS[network][version_key] # version (4 bytes)
hex += depth_hex(depth) # depth (1 byte)
- 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 parse_raw_key
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_raw_key
result = if raw_key.is_a?(Integer) then from_integer elsif hex_format? then from_hex elsif base64_format? then from_base64 elsif compressed_wif_format? then from_wif elsif uncompressed_wif_format? then from_wif else
raise KeyFormatNotFound
end
result.downcase
- 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"