Showing 119 of 209 total issues
Method process_http_request
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_http_request
# get the peer of the communication
# if direct or thru an anonymizer
peer = http_get_forwarded_peer(@http)
Method print_total
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def print_total
puts "Total Statistics from: #{@stats[:total][:start]}"
table_width = 0
@stats[:total].each_key do |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
Method print_total
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def print_total
puts "Total Statistics from: #{@stats[:total][:start]}"
table_width = 0
@stats[:total].each_key do |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
Method http_put_file
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def http_put_file(uri, content)
begin
path = Dir.pwd + PUBLIC_DIR
# split the path in all the subdir and the filename
Method execute_select
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def execute_select(query, result)
statement = @db.createStatement()
res = statement.executeQuery(query)
meta = res.getMetaData()
- 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 store_evidence_chunk
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def store_evidence_chunk(session, id, base, chunk, size, content)
Dir::mkdir(REPO_CHUNK_DIR) if not File.directory?(REPO_CHUNK_DIR)
path = REPO_CHUNK_DIR + '/' + session[:ident] + '_' + session[:instance]
header_len = 12
Method load_from_file
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_from_file
trace :info, "Loading configuration file..."
conf_file = File.join Dir.pwd, CONF_DIR, CONF_FILE
# load the config in the @global hash
Method status_update
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def status_update(component, remoteip, status, message, disk, cpu, pcpu, type, version)
Method execute_select
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute_select(query, result)
statement = @db.createStatement()
res = statement.executeQuery(query)
meta = res.getMetaData()
Method command_id
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def command_id(peer, session, message)
# agent version
version = message.slice!(0..3).unpack('I').first
- 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(options)
run_with_rescue do
# ensure the public and log directory are present
Dir::mkdir(Dir.pwd + PUBLIC_DIR) if not File.directory?(Dir.pwd + PUBLIC_DIR)
- 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 agent_status
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def agent_status(build_id, instance_id, platform, demo, level)
# if the database has gone, reply with a fake response in order for the sync to continue
return agent_cached_status(build_id) unless @available
trace :debug, "Asking the status of [#{build_id}_#{instance_id}] to the db"
- 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!
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create!
begin
db = SQLite.open CACHE_FILE
rescue Exception => e
trace :error, "Problems creating the cache file: #{e.message}"
Method prepare_response
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prepare_response(connection, request)
@request = request
@connection = connection
@response = EM::DelegatedHttpResponse.new @connection
Method http_get_file
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def http_get_file(headers, uri, delete=true)
# retrieve the Operating System and app specific extension of the requester
os, ext = http_get_os(headers)
Method create
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(bid, ident, instance, platform, demo, level, k, ip)
Method print_average
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def print_average(section)
puts "Average by #{section.to_s} statistics:"
table_width = 0
@stats[:total].each_key do |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
Method delete_after_serve
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def delete_after_serve(file, os)
return if Config.instance.global['DONT_DELETE_AFTER_SERVE']
Thread.new do
begin
sleep 10
- 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 protocol_send_command
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def protocol_send_command(command)
# retrieve the receiver anon
receiver = @anonymizers.select{|x| x['_id'].eql? command['anon']}.first
raise "Cannot send to unknown anon [#{command['anon']}]" unless receiver
- 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 transfer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def transfer(instance, id, left)
evidence = EvidenceManager.instance.get_evidence(id, instance)
raise "evidence to be transferred is nil" if evidence.nil?
address = get_worker_address(instance)
- 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"