Showing 119 of 209 total issues
File db_rest.rb
has 539 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rcs-common/trace'
require 'rcs-common/cgi'
# system
require 'net/http'
File db_cache.rb
has 507 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'sqlite'
# from RCS::Common
require 'rcs-common/trace'
Class DB
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
class DB
include Singleton
include RCS::Tracer
ACTIVE_AGENT = 0
Class DB_rest
has 48 methods (exceeds 20 allowed). Consider refactoring. Open
class DB_rest
include RCS::Tracer
def initialize(host)
@host, @port = host.split(':')
Method cache_init
has a Cognitive Complexity of 38 (exceeds 5 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
- 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
Class DBCache
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
class DBCache
extend RCS::Tracer
CACHE_FILE = Dir.pwd + '/config/cache.db'
File evidence_manager.rb
has 382 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fileutils'
require_relative 'sqlite'
# from RCS::Common
require 'rcs-common/trace'
File db.rb
has 381 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'config.rb'
require_relative 'db_rest.rb'
require_relative 'db_cache.rb'
require_relative 'my_ip.rb'
Method process_http_request
has a Cognitive Complexity of 30 (exceeds 5 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)
- 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 stream_one_chunk
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def stream_one_chunk
loop do
break if @connection.closed?
if @file_io.pos < @size
if @connection.get_outbound_data_size > BACKPRESSURE_LEVEL
- 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 91 lines of code (exceeds 25 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
Method http_get_os
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def http_get_os(headers)
# extract the user-agent
user_agent = headers[:user_agent]
return 'unknown', '' if user_agent.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 authenticate_elite
has 77 lines of code (exceeds 25 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
File http_controller.rb
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'sync_protocol'
require 'rcs-common/mime'
require 'rcs-common/crypt'
Method run!
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.run!(*argv)
# reopen the class and declare any empty trace method
# if called from command line, we don't have the trace facility
self.class_eval do
def trace(level, message)
Method run
has a Cognitive Complexity of 19 (exceeds 5 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|
- 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 19 (exceeds 5 allowed). Consider refactoring. Open
def run(options)
# delete all the instance with zero evidence pending and not in progress
if options[:purge] then
instances.each do |e|
- 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
File sync_commands.rb
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'db.rb'
require_relative 'sessions.rb'
require_relative 'evidence_manager.rb'
# from RCS::Common
Method run
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(options)
# delete all the instance with zero evidence pending and not in progress
if options[:purge] then
instances.each do |e|
File sync_protocol.rb
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'sessions'
require_relative 'db'
require_relative 'sync_commands'
# from RCS::Common