hackedteam/rcs-db

View on GitHub

Showing 453 of 612 total issues

Method add_config has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def add_config
    require_auth_level :tech
    require_auth_level :tech_config

    mongoid_query do
Severity: Minor
Found in lib/rcs-db/rest/agent.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_app_info has a Cognitive Complexity of 20 (exceeds 5 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: Minor
Found in lib/rcs-db/build/symbian.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

File rcs-core.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'net/http'
require 'json'
require 'open-uri'
require 'pp'
require 'cgi'
Severity: Minor
Found in scripts/rcs-core.rb - About 2 hrs to fix

    Method positions_flow has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.positions_flow(ids, from, to, options = {})
        ext = 70*60
    
        t = Time.at(from.to_i)
        from = Time.new(t.year, t.month, t.day, t.hour, t.min, 0).to_i
    Severity: Major
    Found in lib/rcs-db/db_objects/entity.rb - About 2 hrs to fix

      Class Config has 24 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Config
        include Singleton
        include Tracer
      
        CONF_DIR = 'config'
      Severity: Minor
      Found in lib/rcs-db/config.rb - About 2 hrs to fix

        Class EvidenceController has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class EvidenceController < RESTController
        
          SYNC_IDLE = 0
          SYNC_IN_PROGRESS = 1
          SYNC_TIMEOUTED = 2
        Severity: Minor
        Found in lib/rcs-db/rest/evidence.rb - About 2 hrs to fix

          Method inject_html_flash has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def inject_html_flash(intercept_files, progressive, redirect_user, rule, vector_files)
              appname = 'FlashSetup-' + progressive.to_s
              intercept_files << "#{redirect_user["#{rule.ident} #{rule.ident_param}"]} #{rule.action} #{appname} #{rule.resource}"
          
              begin
          Severity: Major
          Found in lib/rcs-db/tasks/injector.rb - About 2 hrs to fix

            Method new_instance has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def new_instance(agent)
                  ::Alert.where(:enabled => true, :action => 'INSTANCE').each do |alert|
            
                    #find its factory
                    factory = ::Item.where({ident: agent.ident, _kind: 'factory'}).first
            Severity: Minor
            Found in lib/rcs-db/alert.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_queued has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def process_queued(queued)
                  entry = queued.first
                  count = queued.last
            
                  trace :info, "#{count} alerts to be processed in queue"
            Severity: Minor
            Found in lib/rcs-db/alert.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 filesystem has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

              def filesystem
                require_auth_level :view
                require_auth_level :view_filesystem
            
                mongoid_query do
            Severity: Minor
            Found in lib/rcs-db/rest/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 frontend has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

              def frontend
                collectors = ::Collector.where({type: 'local'}).to_a
                anons = ::Collector.where({type: 'remote'}).to_a
                system_status = ::Status.all.to_a
            
            
            Severity: Minor
            Found in lib/rcs-db/status.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 name_from_handle has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.name_from_handle(type, handle, target_id)
            
                # use a class cache
                @@acc_cache ||= LRUCache.new(:ttl => 24.hour)
            
            
            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 common_filter has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.common_filter(params)
            
                # filtering
                filter = {}
                filter = JSON.parse(params['filter']) if params.has_key? 'filter' and params['filter'].is_a? String
            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 next_entry has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def next_entry
                injector = ::Injector.find(@params['injector_id'])
                
                base = rand(10)
                progressive = 0
            Severity: Major
            Found in lib/rcs-db/tasks/injector.rb - About 2 hrs to fix

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

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

                    def new_entity(entity)
                      ::Alert.where(:enabled => true, :action => 'ENTITY').each do |alert|
                        # skip non matching entities
                        next unless match_path(alert, entity)
                
                
                Severity: Minor
                Found in lib/rcs-db/alert.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 stream_one_chunk has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                      def stream_one_chunk
                        loop do
                          break if @connection.closed?
                          unless @grid_io.eof?
                            if @connection.get_outbound_data_size > BACKPRESSURE_LEVEL
                Severity: Minor
                Found in lib/rcs-db/em_streamer.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 new_sync has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    def new_sync(agent)
                      ::Alert.where(:enabled => true, :action => 'SYNC').each do |alert|
                        # skip non matching agents
                        next unless match_path(alert, agent)
                
                
                Severity: Minor
                Found in lib/rcs-db/alert.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 generate_certificates_anon has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  def generate_certificates_anon
                    trace :info, "Generating anon ssl certificates..."
                
                    # ensure dir is present
                    FileUtils.mkdir_p File.join($execution_directory, CERT_DIR)
                Severity: Minor
                Found in lib/rcs-db/config.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 create has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  def create
                    require_auth_level :tech
                    require_auth_level :tech_factories
                
                    # need a path to put the factory
                Severity: Minor
                Found in lib/rcs-db/rest/agent.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