hackedteam/rcs-db

View on GitHub

Showing 453 of 612 total issues

Method add_link has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def add_link(params)

    first_entity = params[:from]
    second_entity = params[:to]

Severity: Minor
Found in lib/rcs-db/link_manager.rb - About 3 hrs 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 export has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

      def export(evidence, opts)
        # expand the sytles in the dest dir
        FileTask.expand_styles do |name, content|
          yield 'stream', name, {content: content}
        end
Severity: Minor
Found in lib/rcs-db/tasks/evidence.rb - About 3 hrs 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 23 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    require_auth_level :admin, :sys, :tech, :view

    mongoid_query do
      user = User.find(@params['_id'])
Severity: Minor
Found in lib/rcs-db/rest/user.rb - About 3 hrs 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 feed has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def feed(point)

    unless @point_buffer.empty?

      # all the points in the buffer intersect the new point
Severity: Minor
Found in lib/rcs-db/position/positioner.rb - About 3 hrs 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_app_info has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_app_info(file)
    # Read info from original package

    fd = File.open(file, "rb")
    raise "Invalid input file" unless fd
Severity: Major
Found in lib/rcs-db/build/symbian.rb - About 3 hrs to fix

    Method run has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

      def run(options)
    
        return analyze(options[:analyze]) if options[:analyze]
    
        $local_address = options[:ip]
    Severity: Minor
    Found in scripts/rcs-kill.rb - About 3 hrs 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_rule has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

      def update_rule
        require_auth_level :tech, :sys
    
        mongoid_query do
    
    
    Severity: Minor
    Found in lib/rcs-db/rest/injector.rb - About 3 hrs 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 periodic_check has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

      def periodic_check
        begin
    
          # periodically check for license file
          load_license(true)
    Severity: Minor
    Found in lib/rcs-db/license.rb - About 3 hrs 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 do_backup has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.do_backup(now, backup, save_status = true)
    
        trace :info, "Performing backup [#{backup.name}]..."
    
        Audit.log :actor => '<system>', :action => 'backup.start', :desc => "Performing backup #{backup.name}"
    Severity: Minor
    Found in lib/rcs-db/backup.rb - About 3 hrs 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 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def status
        require_auth_level :server, :tech
        
        demo = (@params['demo'] == 'true') ? true : false
        level = @params['level'].to_sym
    Severity: Major
    Found in lib/rcs-db/rest/agent.rb - About 3 hrs to fix

      File db_layer.rb has 292 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'mongoid'
      require 'rbconfig'
      require 'socket'
      require 'rcs-common/trace'
      require 'rcs-common/fixnum'
      Severity: Minor
      Found in lib/rcs-db/db_layer.rb - About 3 hrs to fix

        Method process_http_request has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          def process_http_request
            #trace :debug, "[#{@peer}] Incoming HTTP Connection"
            size = (@http_post_content) ? @http_post_content.bytesize : 0
        
            # get it again since if the connection is kept-alive we need a fresh timing for each
        Severity: Minor
        Found in lib/rcs-db/events.rb - About 2 hrs 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 21 (exceeds 5 allowed). Consider refactoring.
        Open

          def destroy_callback
            unless self.data['_grid'].nil?
              RCS::DB::GridFS.delete(self.data['_grid'], agent.path.last.to_s) rescue nil
            end
        
        
        Severity: Minor
        Found in lib/rcs-db/db_objects/evidence.rb - About 2 hrs 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 request has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

              def request(path, body = {}, opts = {})
                trace :info, "Request #{path} on archive node #{address}"
        
                headers = {'x_sync_signature' => signature, 'Connection' => 'keep-alive'}
        
        
        Severity: Minor
        Found in lib/rcs-db/archive_node.rb - About 2 hrs 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 prepare_response has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          def prepare_response(connection, request)
        
            @request = request
            @connection = connection
            @response = EM::DelegatedHttpResponse.new @connection
        Severity: Minor
        Found in lib/rcs-db/rest_response.rb - About 2 hrs 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 flow has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.flow(params)
            start_time = Time.now # for debugging
        
            # aggregate all the entities by their handles' handle
            # so if 2 entities share the same handle you'll get {'foo.bar@gmail.com' => ['entity1_id', 'entity2_id']}
        Severity: Minor
        Found in lib/rcs-db/db_objects/entity.rb - About 2 hrs 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 has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def get(params)
        
              trace :debug, "Positioning: resolving #{params.inspect}"
        
              request = params.dup
        Severity: Minor
        Found in lib/rcs-db/position/resolver.rb - About 2 hrs 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 run has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def run(options)
        
            if options[:reset]
              reset_pass options
              return 0
        Severity: Major
        Found in lib/rcs-db/config.rb - About 2 hrs to fix

          Class Evidence has 25 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Evidence
            include Mongoid::Document
            include RCS::TargetScoped
            include RCS::DB::Proximity
            include RCS::Tracer
          Severity: Minor
          Found in lib/rcs-db/db_objects/evidence.rb - About 2 hrs to fix

            File entity.rb has 284 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require_relative '../link_manager'
            
            module RCS
            module DB
            
            
            Severity: Minor
            Found in lib/rcs-db/rest/entity.rb - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language