hackedteam/rcs-common

View on GitHub

Showing 60 of 90 total issues

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

    def unserialize(stream)
      header_begin = stream.pos

      tot_size = stream.read(4).unpack('L').shift
      version = stream.read(4).unpack('L').shift
Severity: Minor
Found in lib/rcs-common/serializer.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 decode_content has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def decode_content(common_info, chunks)
      stream = StringIO.new chunks.join

      # ABLogStruct
      magic_ver = read_uint32 stream
Severity: Minor
Found in lib/rcs-common/evidence/addressbook.rb - About 1 hr to fix

    Method decode_content has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def decode_content(common_info, chunks)
        stream = StringIO.new chunks.join
    
        until stream.eof?
          info =  Hash[common_info]
    Severity: Minor
    Found in lib/rcs-common/evidence/calendar.rb - About 1 hr to fix

      Method unserialize has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def unserialize(stream)
            header_begin = stream.pos
      
            tot_size = stream.read(4).unpack('L').shift
            version = stream.read(4).unpack('L').shift
      Severity: Minor
      Found in lib/rcs-common/serializer.rb - About 1 hr to fix

        Method decode_content has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def decode_content(common_info, chunks)
            stream = StringIO.new chunks.join
        
            until stream.eof?
              info = Hash[common_info]
        Severity: Minor
        Found in lib/rcs-common/evidence/file.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 request has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def request(payload, options = {}, retry_count = self.max_retries)
                msg = options[:store] ? [] : [payload]
                msg = ["#{payload.size} B", options.inspect]
                trace(:debug, "REQ #{msg.join(' | ')}")
        
        
        Severity: Minor
        Found in lib/rcs-common/updater/client.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 decode_additional_header has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def decode_additional_header(data)
            raise EvidenceDeserializeError.new("incomplete MAIL") if data.nil? or data.bytesize == 0
        
            ret = Hash.new
            ret[:data] = Hash.new
        Severity: Minor
        Found in lib/rcs-common/evidence/mail.rb - About 1 hr to fix

          Method decode_content has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def decode_content(common_info, chunks)
              info = Hash[common_info]
              info[:data] ||= Hash.new
              info[:data][:type] = :mail
          
          
          Severity: Minor
          Found in lib/rcs-common/evidence/mail.rb - About 1 hr to fix

            Method append has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    def append(file_id, data, options = {})
                      attributes = if options[:filename]
                        files_collection.find(filename: file_id).first
                      else
                        file_id = objectid(file_id)
            Severity: Minor
            Found in lib/rcs-common/gridfs.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 decode_additional_header has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def decode_additional_header(data)
                raise EvidenceDeserializeError.new("incomplete MAIL") if data.nil? or data.bytesize == 0
            
                ret = Hash.new
                ret[:data] = Hash.new
            Severity: Minor
            Found in lib/rcs-common/evidence/mail.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 establish_database_connection has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def establish_database_connection(wait_until_connected: false)
                  loop do
                    connected = database.respond_to?(:connect!) ? database.connect!(component) : database.connect
            
                    if connected
            Severity: Minor
            Found in lib/rcs-common/component.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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                  def run
                    @return_code = nil
                    @output = ""
            
                    cmd = "#{'ruby ' if ruby?}#{storable? ? filepath : payload}"
            Severity: Minor
            Found in lib/rcs-common/updater/payload.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 invoke has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                  def invoke(args)
                    if address? and ([String, Symbol].include?(args.class))
                      task_name, address = args, self.address
                    elsif !address? and args.kind_of?(Hash)
                      task_name, address =  *args.to_a.flatten
            Severity: Minor
            Found in lib/rcs-common/updater/dsl.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 require_release has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                  def require_release(path, warn: false, required: true)
                    if path.include?("-release")
                      new_path = path
                    else
                      new_path = path.gsub(/(.*)rcs-([^\/]+)/, '\1rcs-\2-release')
            Severity: Minor
            Found in lib/rcs-common/path_utils.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 trace_setup has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def trace_setup
                pwd = File.expand_path(Dir.pwd)
            
                raise "FATAL: Invalid execution directory." unless File.directory?("#{pwd}/lib")
            
            
            Severity: Minor
            Found in lib/rcs-common/trace.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 process_http_request has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def process_http_request
                    EM.defer do
                      begin
                        trace(:info, "[#{@http[:host]}] REQ #{@http_protocol} #{@http_request_method} #{@http_content.size} bytes from #{remote_addr}")
            
            
            Severity: Minor
            Found in lib/rcs-common/updater/server.rb - About 1 hr to fix

              Method decode_content has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def decode_content(common_info, chunks)
                  stream = StringIO.new chunks.join
              
                  until stream.eof?
                    tm = stream.read 36
              Severity: Minor
              Found in lib/rcs-common/evidence/chat.rb - About 1 hr to fix

                Method append has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def append(file_id, data, options = {})
                          attributes = if options[:filename]
                            files_collection.find(filename: file_id).first
                          else
                            file_id = objectid(file_id)
                Severity: Minor
                Found in lib/rcs-common/gridfs.rb - About 1 hr to fix

                  Method decode_from_to has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def decode_from_to(common_info, stream)
                      tm = stream.read 36
                      info = Hash[common_info]
                      info[:da] = Time.gm(*(tm.unpack('L*')), 0)
                      info[:data] = Hash.new if info[:data].nil?
                  Severity: Minor
                  Found in lib/rcs-common/evidence/chat.rb - About 1 hr to fix

                    Method request has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def request(payload, options = {}, retry_count = self.max_retries)
                            msg = options[:store] ? [] : [payload]
                            msg = ["#{payload.size} B", options.inspect]
                            trace(:debug, "REQ #{msg.join(' | ')}")
                    
                    
                    Severity: Minor
                    Found in lib/rcs-common/updater/client.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language