Showing 6 of 6 total issues
Method has_valid_length?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def has_valid_length?(address, version)
if version == 0
return address.length < 35
elsif version == 1
return address.length == 33
- 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_address_info
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_address_info(address)
if !address.nil? && !address.empty?
decoded = decode(address)
if has_valid_length?(address, decoded[:version].to_i(16)) && is_checksum_valid?(decoded)
info = NETWORKS[decoded[:version].to_i(16)]
- 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 too many return
statements within this method. Open
return address.length == 34 || address.length == 35
Avoid too many return
statements within this method. Open
return address.length == 35
Avoid too many return
statements within this method. Open
return false
Method b58tos
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def b58tos(string)
value = 0
prefix = 0
string.each_char do |char|
index = BASE58.index(char)
- 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"