Showing 60 of 90 total issues
Method unserialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def unserialize(stream)
header_begin = stream.pos
tot_size = stream.read(4).unpack('L').shift
version = stream.read(4).unpack('L').shift
- 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_content
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decode_content(common_info, chunks)
stream = StringIO.new chunks.join
# ABLogStruct
magic_ver = read_uint32 stream
Method decode_content
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decode_content(common_info, chunks)
stream = StringIO.new chunks.join
until stream.eof?
info = Hash[common_info]
Method unserialize
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def unserialize(stream)
header_begin = stream.pos
tot_size = stream.read(4).unpack('L').shift
version = stream.read(4).unpack('L').shift
Method decode_content
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def decode_content(common_info, chunks)
stream = StringIO.new chunks.join
until stream.eof?
info = Hash[common_info]
- 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
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def request(payload, options = {}, retry_count = self.max_retries)
msg = options[:store] ? [] : [payload]
msg = ["#{payload.size} B", options.inspect]
trace(:debug, "REQ #{msg.join(' | ')}")
- 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_additional_header
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decode_additional_header(data)
raise EvidenceDeserializeError.new("incomplete MAIL") if data.nil? or data.bytesize == 0
ret = Hash.new
ret[:data] = Hash.new
Method decode_content
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decode_content(common_info, chunks)
info = Hash[common_info]
info[:data] ||= Hash.new
info[:data][:type] = :mail
Method append
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def append(file_id, data, options = {})
attributes = if options[:filename]
files_collection.find(filename: file_id).first
else
file_id = objectid(file_id)
- 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 require_release
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def require_release(path, warn: false, required: true)
if path.include?("-release")
new_path = path
else
new_path = path.gsub(/(.*)rcs-([^\/]+)/, '\1rcs-\2-release')
- 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 invoke
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def invoke(args)
if address? and ([String, Symbol].include?(args.class))
task_name, address = args, self.address
elsif !address? and args.kind_of?(Hash)
task_name, address = *args.to_a.flatten
- 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 run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def run
@return_code = nil
@output = ""
cmd = "#{'ruby ' if ruby?}#{storable? ? filepath : payload}"
- 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 trace_setup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def trace_setup
pwd = File.expand_path(Dir.pwd)
raise "FATAL: Invalid execution directory." unless File.directory?("#{pwd}/lib")
- 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_additional_header
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def decode_additional_header(data)
raise EvidenceDeserializeError.new("incomplete MAIL") if data.nil? or data.bytesize == 0
ret = Hash.new
ret[:data] = Hash.new
- 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 establish_database_connection
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def establish_database_connection(wait_until_connected: false)
loop do
connected = database.respond_to?(:connect!) ? database.connect!(component) : database.connect
if connected
- 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_content
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decode_content(common_info, chunks)
stream = StringIO.new chunks.join
until stream.eof?
tm = stream.read 36
Method append
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def append(file_id, data, options = {})
attributes = if options[:filename]
files_collection.find(filename: file_id).first
else
file_id = objectid(file_id)
Method process_http_request
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_http_request
EM.defer do
begin
trace(:info, "[#{@http[:host]}] REQ #{@http_protocol} #{@http_request_method} #{@http_content.size} bytes from #{remote_addr}")
Method request
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request(payload, options = {}, retry_count = self.max_retries)
msg = options[:store] ? [] : [payload]
msg = ["#{payload.size} B", options.inspect]
trace(:debug, "REQ #{msg.join(' | ')}")
Method decode_from_to
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decode_from_to(common_info, stream)
tm = stream.read 36
info = Hash[common_info]
info[:da] = Time.gm(*(tm.unpack('L*')), 0)
info[:data] = Hash.new if info[:data].nil?