Showing 612 of 612 total issues
Method parse_agents
has a Cognitive Complexity of 173 (exceeds 5 allowed). Consider refactoring. Open
def parse_agents(items)
modules = []
return modules if items.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
File rest_test.rb
has 957 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'openssl'
require 'net/http'
require 'json'
require 'benchmark'
require 'open-uri'
Method parse_events
has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring. Open
def parse_events(items)
events = []
return events if items.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
File agent.rb
has 589 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative '../license'
require_relative '../alert'
require 'rcs-common/crypt'
File collector.rb
has 587 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'mongoid'
class Collector
include Mongoid::Document
include Mongoid::Timestamps
File item.rb
has 586 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'mongoid'
require_relative '../build'
require_relative '../push'
Method new_link
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
def new_link(entities)
::Alert.where(:enabled => true, :action => 'LINK').each do |alert|
# skip non matching entities
next unless match_path(alert, entities.first)
next unless match_path(alert, entities.last)
- 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 entity.rb
has 547 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'mongoid'
require 'lrucache'
require_relative '../link_manager'
require_relative '../position/proximity'
Method parse_actions
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def parse_actions(items)
actions = []
return actions if items.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
File config.rb
has 527 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rcs-common/trace'
require_relative 'indexer'
require_relative 'migration'
File rcs-kill.rb
has 517 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'singleton'
require 'pp'
require 'optparse'
require 'openssl'
Method positions_flow
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
def self.positions_flow(ids, from, to, options = {})
ext = 70*60
t = Time.at(from.to_i)
from = Time.new(t.year, t.month, t.day, t.hour, t.min, 0).to_i
- 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 46 (exceeds 5 allowed). Consider refactoring. Open
def run(options)
if options[:reset]
reset_pass options
return 0
- 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 process
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def process(grid_ev)
start_time = Time.now
raw_id = grid_ev['_id']
raise MissingAgentError.new("Unable to process evidence #{raw_id}, agent #{@agent_uid} is missing") unless agent?
- 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 license.rb
has 428 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'dongle.rb'
require_relative 'shard.rb'
# from RCS::Common
require 'rcs-common/trace'
Method import_blk_file
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def import_blk_file(blk_file)
return if blk_file.imported?
msg = "[#{@currency}] Start importing #{blk_file.path} from offeset #{blk_file.imported_bytes} (filesize is #{blk_file.filesize})"
@cli ? puts("#{msg}") : trace(:info, msg)
- 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 148 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 stream_one_chunk
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def stream_one_chunk
loop do
if @connection.closed?
@file_io.close unless @file_io.closed?
break
- 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 new_evidence
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def new_evidence(evidence)
::Alert.where(:enabled => true, :action => 'EVIDENCE').each do |alert|
agent = ::Item.where({_id: evidence.aid, _kind: 'agent'}).first
# not found
- 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 xml_to_json.rb
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'json'
require 'optparse'
require 'pp'
require 'xmlsimple'