Showing 8 of 8 total issues
Class Parser
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Parser
# OpenSSL constant
RSA_PKCS1_OAEP_PADDING = 4
# Secure note types that contain account-like information
Method parse_ACCT
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_ACCT chunk, encryption_key
StringIO.open chunk.payload do |io|
id = read_item io
name = decode_aes256_plain_auto read_item(io), encryption_key
group = decode_aes256_plain_auto read_item(io), encryption_key
- 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_private_key
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse_private_key encrypted_private_key, encryption_key
decrypted = decode_aes256 "cbc",
encryption_key[0, 16],
decode_hex(encrypted_private_key),
encryption_key
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize id, name, username, password, url, notes, group
Method request_login
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.request_login username,
password,
key_iteration_count,
multifactor_password = nil,
client_id = nil,
Method parse_accounts_and_notes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_accounts_and_notes chunks, encryption_key, private_key
accounts = []
notes = []
key = encryption_key
- 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 request_login
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.request_login username,
password,
key_iteration_count,
multifactor_password = nil,
client_id = 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 create_session
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.create_session parsed_response, key_iteration_count
ok = (parsed_response["response"] || {})["ok"]
if ok.is_a? Hash
session_id = ok["sessionid"]
if session_id.is_a? String
- 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"