hackedteam/rcs-db

View on GitHub

Showing 453 of 612 total issues

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

    def exec_with_output(command, params = "", options = {})

      trace :debug, "Executing with output: #{File.basename(command)} #{params}"

      full_command = command + " " + params
Severity: Minor
Found in lib/rcs-db/exec.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

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

  def self.get_wav_frames(data, mode)

    decoder = Speex.decoder_init(Speex.lib_get_mode(mode))

    # enable enhancement
Severity: Minor
Found in lib/rcs-worker/libs/speex/speex.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 link_similar_position has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def link_similar_position
    return if type != :position
    return if level != :manual

    self.class.same_path_of(self).positions_within(position, 100).each do |other_entity|
Severity: Minor
Found in lib/rcs-db/db_objects/entity.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 get_wav_frames has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.get_wav_frames(data)

    stream = StringIO.new data

    prefix = stream.read(6)
Severity: Minor
Found in lib/rcs-worker/libs/amr/amr.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 post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def post
      content = @request[:content]['content']

      return conflict unless content
      return conflict if content.bytesize == 0
Severity: Minor
Found in lib/rcs-worker/worker_controller.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 nc_push has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.nc_push(object)
    begin
      # find a network controller in the status list
      nc = ::Status.where({type: 'nc'}).any_in(status: [::Status::OK, ::Status::WARN]).first

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

      def ping!
        request("/sync/status") do |code, content|
          if code == 200
            update_status(content[:status])
          else
Severity: Minor
Found in lib/rcs-db/archive_node.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 edge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def edge id, source_node, target_node, data = {}, opts = {}
      _graph[:edge] ||= []
      add_ampersat_to_keys(opts)
      elem = {:'@id' => id, :'@source' => source_node, :'@target' => target_node}.merge(opts)

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

  def delete_item(id)
    if self.dashboard_ids.include? id
      trace :debug, "Deleting Item #{id} from #{self.name} dashboard"
      self.dashboard_ids.delete(id)
      self.save
Severity: Minor
Found in lib/rcs-db/db_objects/user.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 send_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def send_response
    fail "response still not prepared" if @response.nil?
    @response.send_headers
    streamer = EM::FilesystemStreamer.new(@connection, @filename, :http_chunks => false )
    streamer.callback do
Severity: Minor
Found in lib/rcs-db/rest_response.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