Showing 119 of 209 total issues
Class EvidenceManager
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class EvidenceManager
include Singleton
include RCS::Tracer
REPO_DIR = Dir.pwd + '/evidence'
Class RESTController
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class RESTController
include RCS::Tracer
STATUS_OK = 200
STATUS_REDIRECT = 302
Method migrate_sqlite_scout_column
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def migrate_sqlite_scout_column
dbs_path = File.expand_path("../../../evidence", __FILE__)
return unless Dir.exists?(dbs_path)
- 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 prepare_response
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def prepare_response(connection, request)
@request = request
@connection = connection
@response = EM::DelegatedHttpResponse.new @connection
- 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 authenticate_scout
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.authenticate_scout(peer, uri, content, anon_version)
trace :info, "[#{peer}] Authentication scout required for (#{content.length.to_s} bytes)..."
begin
# remove the base64 container
- 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_get_file
has a Cognitive Complexity of 16 (exceeds 5 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)
- 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 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(options)
if options[:alt_log]
logfilepath = File.expand_path("../../../log/rcs-collector-config.log", __FILE__)
@logger = Log4r::Logger.new("migration").tap do |logger|
Method act!
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def act!
@request[:action] = @request[:method].to_s.downcase.to_sym
# check we have a valid action
return bad_request unless public_methods(false).include?(@request[:action])
- 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 perform
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def perform
# if the database connection has gone
# try to re-login to the database again
unless DB.instance.connected?
trace :debug, "heartbeat: try to reconnect to rcs-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 authenticate_elite
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.authenticate_elite(peer, uri, content, anon_version)
trace :info, "[#{peer}] Authentication required for (#{content.length.to_s} bytes)..."
# integrity check (104 byte of data, 112 padded)
# consider random extra data to disguise the protocol
- 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 46 lines of code (exceeds 25 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
Method command_id
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def command_id(peer, session, message)
# agent version
version = message.slice!(0..3).unpack('I').first
Method run
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def run
# infinite loop for working
loop do
# pass the control to other threads
sleep 1
- 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 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
# infinite loop for working
loop do
# pass the control to other threads
sleep 1
Method cache_init
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cache_init
# if the db is available, clear the cache and populate it again
if @available
# get the global signature (per customer) for all the agents
bck_sig = db_rest_call :agent_signature
Method prepare_response
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prepare_response(connection, request)
@request = request
@connection = connection
@response = EM::DelegatedHttpResponse.new @connection
Method load_from_file
has a Cognitive Complexity of 13 (exceeds 5 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
- 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_repository
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_repository(session)
# ensure the repository directory is present
Dir::mkdir(REPO_DIR) if not File.directory?(REPO_DIR)
trace :info, "Creating repository for [#{session[:ident]}_#{session[:instance]}]"
Method commands
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.commands(peer, cookie, content)
# retrieve the session
session = SessionManager.instance.get cookie
# invalid session
Method http_get_os
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def http_get_os(headers)
# extract the user-agent
user_agent = headers[:user_agent]
return 'unknown', '' if user_agent.nil?