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'
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
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|
Class EvidenceManager
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class EvidenceManager
include Singleton
include RCS::Tracer
REPO_DIR = Dir.pwd + '/evidence'
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 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 store_evidence_chunk
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def store_evidence_chunk(session, id, base, chunk, size, content)
Method sync_start
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def sync_start(session, version, user, device, source, time)
Method purge
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def purge(instance, options = {force: false, timeout: false})
# forced deletion
if options[:force]
FileUtils.rm_rf(REPO_DIR + '/' + 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"
Further reading
Method compact
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compact(instance)
# sanity check
path = REPO_DIR + '/' + instance
return unless File.exist?(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 store_evidence_chunk
has a Cognitive Complexity of 6 (exceeds 5 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
- 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 a Cognitive Complexity of 6 (exceeds 5 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]}]"
- 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"