hackedteam/rcs-db

View on GitHub

Showing 612 of 612 total issues

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 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

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

              when 'GSM'
                q = {map: {cellTowers: [
                    {mobileCountryCode: self[:data][:cell][:mcc], mobileNetworkCode: self[:data][:cell][:mnc], locationAreaCode: self[:data][:cell][:lac], cellId: self[:data][:cell][:cid], signalStrength: self[:data][:cell][:db], timingAdvance: self[:data][:cell][:adv], age: self[:data][:cell][:age]}
                ], radioType: 'gsm'}}
      Severity: Major
      Found in lib/rcs-worker/evidence/position.rb and 1 other location - About 1 hr to fix
      lib/rcs-worker/evidence/position.rb on lines 23..26

      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 68.

      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

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

              when 'CDMA'
                q = {map: {cellTowers: [
                    {mobileCountryCode: self[:data][:cell][:mcc], mobileNetworkCode: self[:data][:cell][:sid], locationAreaCode: self[:data][:cell][:nid], cellId: self[:data][:cell][:bid], signalStrength: self[:data][:cell][:db], timingAdvance: self[:data][:cell][:adv], age: self[:data][:cell][:age]}
                ], radioType: 'cdma'}}
      Severity: Major
      Found in lib/rcs-worker/evidence/position.rb and 1 other location - About 1 hr to fix
      lib/rcs-worker/evidence/position.rb on lines 19..22

      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 68.

      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 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 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 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 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 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

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

                      def send_response
                        fail "response still not prepared" if @response.nil?
                        @response.send_headers
                        streamer = EM::GridStreamer.new(@connection, @grid_io, :http_chunks => false)
                        streamer.callback do
                    Severity: Major
                    Found in lib/rcs-db/rest_response.rb and 1 other location - About 1 hr to fix
                    lib/rcs-db/rest_response.rb on lines 233..239

                    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 66.

                    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

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

                      def send_response
                        fail "response still not prepared" if @response.nil?
                        @response.send_headers
                        streamer = EM::FilesystemStreamer.new(@connection, @filename, :http_chunks => false )
                        streamer.callback do
                    Severity: Major
                    Found in lib/rcs-db/rest_response.rb and 1 other location - About 1 hr to fix
                    lib/rcs-db/rest_response.rb on lines 302..308

                    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 66.

                    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 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 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 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 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 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
                              Severity
                              Category
                              Status
                              Source
                              Language