hackedteam/rcs-db

View on GitHub

Showing 453 of 612 total issues

Method config has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def config
    require_auth_level :server, :tech
    
    agent = Item.where({_kind: 'agent', _id: @params['_id']}).first
    return not_found("Agent not found: #{@params['_id']}") if agent.nil?
Severity: Minor
Found in lib/rcs-db/rest/agent.rb - About 1 hr 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 ensure_signatures has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def ensure_signatures
    if archive_mode?
      trace :info, "This is an archive installation. Signatures are not created automatically."
      return
    end
Severity: Minor
Found in lib/rcs-db/db_layer.rb - About 1 hr 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 restat has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def restat
    trace :info, "Recalculating stats for #{self._kind} #{self.name}"
    t = Time.now
    case self._kind
      when 'operation'
Severity: Minor
Found in lib/rcs-db/db_objects/item.rb - About 1 hr 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 keyword_index has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def keyword_index
      self[:kw] = []

      self[:kw] += self[:data]['latitude'].to_s.keywords unless self[:data]['latitude'].nil?
      self[:kw] += self[:data]['longitude'].to_s.keywords unless self[:data]['longitude'].nil?
Severity: Minor
Found in lib/rcs-worker/evidence/position.rb - About 1 hr 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 has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def generate_certificates(options)
    trace :info, "Generating 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 1 hr to fix

    Method create has 43 lines of code (exceeds 25 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 1 hr to fix

      Method import_blk_file has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def import_blk_file(blk_file)
              return if blk_file.imported?
      
              msg = "[#{@currency}] Start importing #{blk_file.path} from offeset #{blk_file.imported_bytes} (filesize is #{blk_file.filesize})"
              @cli ? puts("#{msg}") : trace(:info, msg)
      Severity: Minor
      Found in lib/rcs-money/importer.rb - About 1 hr to fix

        Method add_link has 42 lines of code (exceeds 25 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 1 hr to fix

          Method get has 42 lines of code (exceeds 25 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 1 hr to fix

            Method extract has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.extract(target_id, ev)
            
                # check if the position is good
                return [] if ev.data['latitude'].nil? or ev.data['longitude'].nil?
            
            
            Severity: Minor
            Found in lib/rcs-aggregator/position.rb - About 1 hr to fix

              Method melt has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def melt(params)
                  trace :debug, "Build: melting: #{params}"
              
                  executable = path('default')
                  @appname = params['appname'] || 'install'
              Severity: Minor
              Found in lib/rcs-db/build/osx.rb - About 1 hr to fix

                Method exec has 41 lines of code (exceeds 25 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 1 hr to fix

                  Method resample_channel has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def resample_channel(wav_ary, sample_rate, is_short = false)
                        errorptr = FFI::MemoryPointer.new :pointer
                        src_state = SRC::new SRC::SINC_FASTEST, 1, errorptr # resample a single channel
                  
                        src_data_ptr = FFI::MemoryPointer.new SRC::DATA.size, 1, false
                  Severity: Minor
                  Found in lib/rcs-worker/libs/SRC/src.rb - About 1 hr to fix

                    Method melt has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def melt(params)
                        trace :debug, "Build: melt #{params}"
                    
                        # generate a new anon cert
                        generate_anon_certificate
                    Severity: Minor
                    Found in lib/rcs-db/build/anon.rb - About 1 hr to fix

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

                        def generate(params)
                          trace :debug, "Build: generate: #{params}"
                      
                          # don't include support files into the outputs
                          @outputs = []
                      Severity: Minor
                      Found in lib/rcs-db/build/qrcode.rb - About 1 hr to fix

                        Method melt has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def melt(params)
                            trace :debug, "Build: melt #{params}"
                        
                            @appname = params['appname'] || 'exploit'
                        
                        
                        Severity: Minor
                        Found in lib/rcs-db/build/exploit.rb - About 1 hr to fix

                          Method restat has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def restat
                              trace :info, "Recalculating stats for #{self._kind} #{self.name}"
                              t = Time.now
                              case self._kind
                                when 'operation'
                          Severity: Minor
                          Found in lib/rcs-db/db_objects/item.rb - About 1 hr to fix

                            Method flow has 40 lines of code (exceeds 25 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 1 hr to fix

                              Method blacklisted_software? has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def blacklisted_software?(params = {})
                                  upgrade_method = :elite
                              
                                  raise BlacklistError.new("Cannot determine blacklist") if self._kind != 'agent'
                              
                              
                              Severity: Minor
                              Found in lib/rcs-db/db_objects/item.rb - About 1 hr to fix

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

                                  def self.run(options)
                                
                                    begin
                                      c = CoreDeveloper.new
                                      c.name = options[:name]
                                Severity: Minor
                                Found in scripts/rcs-core.rb - About 1 hr 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