hackedteam/rcs-db

View on GitHub

Showing 453 of 612 total issues

Method setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def setup
        signatures = @params['signatures']

        return bad_request(msg: 'Expected signatures') if signatures.blank?

Severity: Minor
Found in lib/rcs-db/rest/sync.rb - About 25 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 number_without_calling_code has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.number_without_calling_code(number)
        parsed = number.to_s.strip
        twochrs = parsed[0..1]

        if twochrs[0] != '+' and twochrs != '00'
Severity: Minor
Found in lib/rcs-db/country_calling_codes.rb - About 25 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 agent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def agent
        return not_authorized(msg: 'Invalid signature') unless valid_signature?

        agent_id = Moped::BSON::ObjectId.from_string(@params['agent_id']) rescue nil

Severity: Minor
Found in lib/rcs-db/rest/sync.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    require_auth_level :sys, :tech

    mongoid_query do
      core = ::Core.where({name: @params['_id']}).first
Severity: Minor
Found in lib/rcs-db/rest/core.rb - About 25 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 upload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def upload
    require_auth_level :server, :tech

    mongoid_query do
      agent = Item.where({_kind: 'agent', _id: @params['_id']}).first
Severity: Minor
Found in lib/rcs-db/rest/agent.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

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

    Zip::File.open(path('output.zip'), Zip::File::CREATE) do |z|
      @outputs.keep_if {|x| x['winpe'] or x['installer'] or x['usb_bootable']}.each do |out|
Severity: Minor
Found in lib/rcs-db/build/usb.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    require_auth_level :admin
    require_auth_level :admin_operations

    updatable_fields = ['name', 'desc', 'status', 'contact']
Severity: Minor
Found in lib/rcs-db/rest/operation.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    require_auth_level :sys
    require_auth_level :sys_connectors

    mongoid_query do
Severity: Minor
Found in lib/rcs-db/rest/connector.rb - About 25 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_limits has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_limits(limit)

    @limits[:magic] = limit[:check]

    @limits[:type] = limit[:type]
Severity: Minor
Found in lib/rcs-db/license.rb - About 25 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 exec has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def exec
    require_auth_level :server, :tech, :view

    mongoid_query do
      agent = Item.where({_kind: 'agent', _id: @params['_id']}).first
Severity: Minor
Found in lib/rcs-db/rest/agent.rb - About 25 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 status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def status
        unless has_signatures?
          return server_error(msg: 'Need signatures', result: 'NEED_SIGNATURES')
        end

Severity: Minor
Found in lib/rcs-db/rest/sync.rb - About 25 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 count has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def count
    require_auth_level :view

    mongoid_query do

Severity: Minor
Found in lib/rcs-db/rest/evidence.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

  def next_entry
    @description = "Exporting filesystem structure"

    # filter by target
    target = Item.where({_id: @params['filter']['target']}).first
Severity: Minor
Found in lib/rcs-db/tasks/filesystem.rb - About 25 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 alert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def alert
    require_auth_level :admin
    require_auth_level :admin_users

    mongoid_query do
Severity: Minor
Found in lib/rcs-db/rest/group.rb - About 25 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 total has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def total
    # filter by target
    target = Item.where({_id: @params['filter']['target']}).first
    return not_found("Target not found") if target.nil?

Severity: Minor
Found in lib/rcs-db/tasks/filesystem.rb - About 25 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 cleanup_storage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def cleanup_storage
    count = 0
    db = DB.instance

    total_size =  db.db_stats['dataSize']
Severity: Minor
Found in lib/rcs-db/migration.rb - About 25 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 filter_for_partial_backup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.filter_for_partial_backup(params)

    # extract the id from the string
    id = Moped::BSON::ObjectId.from_string(params[:what][-24..-1])

Severity: Minor
Found in lib/rcs-db/backup.rb - About 25 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 most_visited_places has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.most_visited_places(target_id, params = {})
    match = {type: :position}
    match[:day] = {'$gte' => params['from'], '$lte' => params['to']} if params['from'] and params['to']
    limit = params['num'] || 5
    group = {_id: '$data.position', count: {"$sum" => "$count"}, radius: {"$min" => "$data.radius"}}
Severity: Minor
Found in lib/rcs-db/db_objects/aggregate.rb - About 25 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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.find(id)
    begin
      self.all['shards'].each do |shard|
        if shard['_id'] == id
          host, port = shard['host'].split(':')
Severity: Minor
Found in lib/rcs-db/shard.rb - About 25 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 matching has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.matching(*items)
    items2id = items.inject({}) do |h, item|
      h[item.id] = item if item.respond_to?(:id)
      h
    end
Severity: Minor
Found in lib/rcs-db/db_objects/watched_item.rb - About 25 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