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
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 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"