hackedteam/rcs-db

View on GitHub

Showing 612 of 612 total issues

Method periodic_check has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def periodic_check
    begin

      # periodically check for license file
      load_license(true)
Severity: Major
Found in lib/rcs-db/license.rb - About 3 hrs to fix

    Method offload_move_evidence has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.offload_move_evidence(params)
        old_target = ::Item.find(params[:old_target_id])
        target = ::Item.find(params[:target_id])
        agent = ::Item.find(params[:agent_id])
    
    
    Severity: Minor
    Found in lib/rcs-db/db_objects/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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        File.open(path('winpe/RCSPE/RCS.ini'), 'w') do |f|
          f.puts "[RCS]"
          f.puts "VERSION=#{File.read(Config.instance.file('VERSION'))}"
          f.puts "HUID=#{@factory.ident}"
          f.puts "HCORE=#{names[:core]}"
    Severity: Major
    Found in lib/rcs-db/build/iso.rb and 1 other location - About 3 hrs to fix
    lib/rcs-db/build/usb.rb on lines 64..88

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 116.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        File.open(path('winpe/RCSPE/RCS.ini'), 'w') do |f|
          f.puts "[RCS]"
          f.puts "VERSION=#{File.read(Config.instance.file('VERSION'))}"
          f.puts "HUID=#{@factory.ident}"
          f.puts "HCORE=#{names[:core]}"
    Severity: Major
    Found in lib/rcs-db/build/usb.rb and 1 other location - About 3 hrs to fix
    lib/rcs-db/build/iso.rb on lines 80..104

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 116.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

          Severity
          Category
          Status
          Source
          Language