hackedteam/rcs-db

View on GitHub

Showing 612 of 612 total issues

Method print_section has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def print_section(section)
    puts "Last 5 #{section.to_s} statistics:"

    table_width = 0
    @stats[:total].each_key do |k|
Severity: Minor
Found in lib/rcs-db/statistics.rb - About 35 mins to fix

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 sign has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def sign(params)
    trace :debug, "Build: signing: #{params}"

    trace :debug, "Build: creating sisx files"

Severity: Minor
Found in lib/rcs-db/build/symbian.rb - About 35 mins to fix

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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    require_auth_level :view
    require_auth_level :view_edit

    mongoid_query do
Severity: Minor
Found in lib/rcs-db/rest/evidence.rb - About 35 mins to fix

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 unpack has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def unpack
    super

    trace :debug, "Build: apktool extract: #{@tmpdir}/apk"

Severity: Minor
Found in lib/rcs-db/build/android.rb - About 35 mins to fix

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 patch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def patch(params)
    trace :debug, "Build: patching: #{params}"

    # enforce demo flag accordingly to the license
    # or raise if cannot build
Severity: Minor
Found in lib/rcs-db/build/android.rb - About 35 mins to fix

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 next_entry has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def next_entry
    yield @description = "Pushing topology"

    # mark all the anonymizers as "not configured"
    ::Collector.where({type: 'remote'}).each do |anon|
Severity: Minor
Found in lib/rcs-db/tasks/topology.rb - About 35 mins to fix

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 silent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def silent
    trace :debug, "Build: silent installer"

    apktool = path('apktool.jar')
    File.chmod(0755, path('aapt')) if File.exist? path('aapt')
Severity: Minor
Found in lib/rcs-db/build/android.rb - About 35 mins to fix

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 pack has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def pack(params)
    trace :debug, "Build: pack: #{params}"

    Zip::File.open(path('installer.zip'), Zip::File::CREATE) do |z|
      Dir[path('ios/**')].each do |file|
Severity: Minor
Found in lib/rcs-db/build/ios.rb - About 35 mins to fix

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 enqueue_all_previous_evidences has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def enqueue_all_previous_evidences
    trace(:info, "Sending to the connector queue all the previous evidence that matches the connector #{name}...")

    operation_id, target_id, agent_id = *path

Severity: Minor
Found in lib/rcs-db/db_objects/connector.rb - About 35 mins to fix

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 sync_indexes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def sync_indexes(mongoid_document_class)
    diff = index_diff(mongoid_document_class)
    return unless diff

    if diff[:missing_collection]
Severity: Minor
Found in lib/rcs-db/db_layer.rb - About 35 mins to fix

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 merge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def merge(merging)
    raise "cannot merge a target over a person" if merging.type == :target
    raise "cannot merge different type of entities" unless [:person, :target].include? self.type and [:person, :target].include? merging.type

    trace :debug, "Merging entities: #{merging.name} -> #{self.name}"
Severity: Minor
Found in lib/rcs-db/db_objects/entity.rb - About 35 mins to fix

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 linked_to? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def linked_to? another_entity, options = {}
    filter = {}
    filter[:type] = options[:type] if options[:type]
    filter[:level] = options[:level] if options[:level]

Severity: Minor
Found in lib/rcs-db/db_objects/entity.rb - About 35 mins to fix

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 7 (exceeds 5 allowed). Consider refactoring.
Open

        def process(object, options = {})
          if object.kind_of?(Array)
            process_array(object, options)
          elsif object.respond_to?(:context) && object.context.respond_to?(:query)
            process_mongoid_criteria(object, options)
Severity: Minor
Found in lib/rcs-db/cache.rb - About 35 mins to fix

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 add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.add(params)
    self.create! do |aq|
      aq.alert = [params[:alert]._id] if params[:alert]
      aq.evidence = [params[:evidence]._id] if params[:evidence]
      aq.path = params[:path]
Severity: Minor
Found in lib/rcs-db/db_objects/queue.rb - About 35 mins to fix

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 handle_regexp_for_queries has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.handle_regexp_for_queries(type, value)
    if type.to_s != 'phone'
      value
    else
      # if the type is phone but the value contains no numbers
Severity: Minor
Found in lib/rcs-db/db_objects/entity.rb - About 35 mins to fix

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_rows has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def print_rows(session, shard = nil)
        entries = {}

        pipeline = [{'$group' => {'_id' => '$filename', 'count' => {'$sum' => 1}, 'size' => {'$sum' => '$length'}}}]

Severity: Minor
Found in lib/rcs-worker/queue_stats.rb - About 35 mins to fix

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 destroy_callback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy_callback
    # remove the item form any dashboard or recent
    ::User.all.each {|u| u.delete_item(self._id)}
    # remove the item form the alerts
    ::Alert.all.each {|a| a.delete_if_item(self._id)}
Severity: Minor
Found in lib/rcs-db/db_objects/item.rb - About 35 mins to fix

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 load has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def load(params)
    raise "Some cores were not loaded in the DB. Please check them." unless RCS::DB::Core.all_loaded?

    core = ::Core.where({name: @platform}).first
    raise "Core for #{@platform} not found" if core.nil?
Severity: Minor
Found in lib/rcs-db/build.rb - About 35 mins to fix

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 each_filter_key_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.each_filter_key_value string
    key_values = string.split(',')
    key_values.each do |kv|
      key, value = kv.split(':').map(&:strip)
      key.downcase!
Severity: Minor
Found in lib/rcs-db/db_objects/evidence.rb - About 35 mins to fix

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 index_collection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.index_collection(evidence)
    chunk = 500
    cursor = 0
    count = evidence.where(:kw.exists => false).count
    puts "#{count} evidence to be indexed"
Severity: Minor
Found in lib/rcs-db/indexer.rb - About 35 mins to fix

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

Severity
Category
Status
Source
Language