hackedteam/rcs-db

View on GitHub

Showing 453 of 612 total issues

Method upgrade has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def upgrade
    require_auth_level :server, :sys

    mongoid_query do
      collector = Collector.find(@params['_id'])
Severity: Minor
Found in lib/rcs-db/rest/collector.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 a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def run(options)

    # config file parsing
    return 1 unless RCS::DB::Config.instance.load_from_file

Severity: Minor
Found in lib/rcs-worker/backlog.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 cleanup_storage has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def cleanup_storage
    count = 0
    db = DB.instance

    total_size =  db.db_stats['dataSize']
Severity: Major
Found in lib/rcs-db/migration.rb - About 2 hrs to fix

    Method prepare_response has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def prepare_response(connection, request)
    
        @request = request
        @connection = connection
        @response = EM::DelegatedHttpResponse.new @connection
    Severity: Major
    Found in lib/rcs-db/rest_response.rb - About 2 hrs to fix

      Method generate has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def generate(params)
          trace :debug, "Build: generate: #{params}"
      
          names = {}
          funcnames = []
      Severity: Major
      Found in lib/rcs-db/build/iso.rb - About 2 hrs to fix

        Method extract_chat has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.extract_chat(ev)
            data = []
        
            # "peer" attribute was present before 9.0.0
            # than has been replaced by "from" and "rcpt"
        Severity: Minor
        Found in lib/rcs-aggregator/peer.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 process_position_aggregate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.process_position_aggregate entity, aggregate
            position = aggregate.position
            position_ary = [position[:longitude], position[:latitude]]
        
            operation_id = entity.path.first
        Severity: Minor
        Found in lib/rcs-intelligence/processor.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 pack has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def pack(params)
            trace :debug, "Build: pack: #{params}"
        
            case params['type']
              when 'remote'
        Severity: Minor
        Found in lib/rcs-db/build/blackberry.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 keywordize_position has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.keywordize_position(data, note)
            kw = SortedSet.new
        
            kw += data['latitude'].to_s.keywords unless data['latitude'].nil?
            kw += data['longitude'].to_s.keywords unless data['longitude'].nil?
        Severity: Minor
        Found in lib/rcs-db/indexer.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 a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

              def run(options)
                run_with_rescue do
                  # initialize random number generator
                  srand(Time.now.to_i)
        
        
        Severity: Minor
        Found in lib/rcs-db/db.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 perform has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.perform
        
            now = Time.now.getutc
        
            begin
        Severity: Minor
        Found in lib/rcs-db/backup.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 exec has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def exec(command, params = "", options = {})
        
              original_command = command
        
              trace :debug, "Executing: #{File.basename(command)}"
        Severity: Minor
        Found in lib/rcs-db/exec.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 patch has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def patch(params)
            # skip the phase if not needed
            return if params.nil? or params[:core].nil?
        
            trace :debug, "Build: patching [#{params[:core]}] file"
        Severity: Major
        Found in lib/rcs-db/build.rb - About 2 hrs to fix

          Method process_http_request has 55 lines of code (exceeds 25 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: Major
          Found in lib/rcs-db/events.rb - About 2 hrs to fix

            Class Build has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Build
              include RCS::Tracer
            
              attr_reader :outputs
              attr_reader :scrambled
            Severity: Minor
            Found in lib/rcs-db/build.rb - About 2 hrs to fix

              File rest.rb has 256 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require_relative 'audit'
              require_relative 'rest_response'
              
              # from RCS::Common
              require 'rcs-common/trace'
              Severity: Minor
              Found in lib/rcs-db/rest.rb - About 2 hrs to fix

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

                  def run
                    process = Proc.new do
                      begin
                        @total = total
                        next_entry do
                Severity: Minor
                Found in lib/rcs-db/tasks.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 burn_one_license has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                  def burn_one_license(type, platform)
                
                    # check if the platform can be used
                    unless @limits[:agents][platform][0]
                      trace :warn, "You don't have a license for #{platform.to_s}. Queuing agent..."
                Severity: Minor
                Found in lib/rcs-db/license.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 do_backup has 52 lines of code (exceeds 25 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: Major
                Found in lib/rcs-db/backup.rb - About 2 hrs to fix

                  File backup.rb has 252 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require_relative 'db_layer'
                  
                  # from RCS::Common
                  require 'rcs-common/trace'
                  
                  
                  Severity: Minor
                  Found in lib/rcs-db/backup.rb - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language