Showing 13 of 68 total issues
Method combine
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def combine
log('Starting combine')
log("options : #{options.inspect}")
shares = []
- 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 split
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def split
log('Starting split')
log('options : ' + options.inspect)
args = {}
- 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 combine
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def combine
log('Starting combine')
log("options : #{options.inspect}")
shares = []
Method split
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def split
log('Starting split')
log('options : ' + options.inspect)
args = {}
Method combine
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def combine
# unwrap 'human' shares into binary shares
if all_shares_appear_human?(shares)
@shares = convert_shares_human_to_binary(shares)
end
- 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 combine
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def combine
# unwrap 'human' shares into binary shares
if all_shares_appear_human?(shares)
@shares = convert_shares_human_to_binary(shares)
end
Method exit_if_binary!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def exit_if_binary!(str)
str.each_byte { |c|
# OK, 9 (TAB), 10 (CR), 13 (LF), >=32 for normal ASCII
# Usage of anything other than 10, 13, and 32-126 ASCII decimal codes
# looks as though contents are binary and not standard text.
- 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_secret_from_shares!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def extract_secret_from_shares!(hash_id, shares_bytes)
secret = []
# build up an Array of index values from each share
# u[i] equal to the first octet of the ith share
- 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 unpad
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.unpad(str, k = TSS::PADDING_BLOCK_SIZE_BYTES)
return str if k.zero?
str_bytes = str.is_a?(Array) ? str : TSS::Util.utf8_to_bytes(str)
val = str_bytes.last
raise 'Input is not padded or padding is corrupt' if val > k
- 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
Consider simplifying this complex logical expression. Open
if c < 9 || (c > 10 && c < 13) || (c > 13 && c < 32) || c == 127
err('STDIN secret appears to contain binary data.')
exit(1)
end
Method split
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def split
num_shares_not_less_than_threshold!(threshold, num_shares)
# Append needed PKCS#7 padding to the string
secret_padded = padding ? Util.pad(secret) : secret
- 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 convert_shares_human_to_binary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def convert_shares_human_to_binary(shares)
shares.map do |s|
s_b64 = s.match(Util::HUMAN_SHARE_RE)
if s_b64.present? && s_b64.to_a[1].present?
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 shares_bytes_have_valid_indexes!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def shares_bytes_have_valid_indexes!(shares_bytes)
u = shares_bytes.map do |s|
raise TSS::ArgumentError, 'invalid shares, no index' if s[0].blank?
raise TSS::ArgumentError, 'invalid shares, zero index' if s[0] == 0
s[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"