hackedteam/rcs-collector

View on GitHub

Showing 119 of 209 total issues

Method print_average has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def print_average(section)
    puts "Average by #{section.to_s} statistics:"

    table_width = 0
    @stats[:total].each_key do |k|
Severity: Minor
Found in lib/rcs-collector/statistics.rb - About 55 mins 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 update_status has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def update_status(component, ip, status, message, stats, type, version)
Severity: Major
Found in lib/rcs-collector/db.rb - About 50 mins to fix

    Method store_evidence_chunk has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def store_evidence_chunk(session, id, base, chunk, size, content)
    Severity: Minor
    Found in lib/rcs-collector/evidence_manager.rb - About 45 mins to fix

      Method new_uploads? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def new_uploads?(bid)
          # check if we have the uploads in the cache
          # probably and old one not yet sent
          return true if DBCache.new_uploads? bid
          # cannot reach the db, return false
      Severity: Minor
      Found in lib/rcs-collector/db.rb - About 45 mins 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_exec? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def new_exec?(bid)
          # check if we have any exec in the cache
          # probably and old one not yet sent
          return true if DBCache.new_exec? bid
          # cannot reach the db, return false
      Severity: Minor
      Found in lib/rcs-collector/db.rb - About 45 mins 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 http_put_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def http_put_file(uri, content)
          begin
            path = Dir.pwd + PUBLIC_DIR
      
            # split the path in all the subdir and the filename
      Severity: Minor
      Found in lib/rcs-collector/http_controller.rb - About 45 mins 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 commands has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.commands(peer, cookie, content)
          # retrieve the session
          session = SessionManager.instance.get cookie
      
          # invalid session
      Severity: Minor
      Found in lib/rcs-collector/sync_protocol.rb - About 45 mins 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_downloads? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def new_downloads?(bid)
          # check if we have the downloads in the cache
          # probably and old one not yet sent
          return true if DBCache.new_downloads? bid
          # cannot reach the db, return false
      Severity: Minor
      Found in lib/rcs-collector/db.rb - About 45 mins 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_filesystems? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def new_filesystems?(bid)
          # check if we have the filesystems in the cache
          # probably and old one not yet sent
          return true if DBCache.new_filesystems? bid
          # cannot reach the db, return false
      Severity: Minor
      Found in lib/rcs-collector/db.rb - About 45 mins 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 sync_update has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def sync_update(session, version, user, device, source, time)
      Severity: Minor
      Found in lib/rcs-collector/db_rest.rb - About 45 mins to fix

        Method sync_start has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def sync_start(session, version, user, device, source, time)
        Severity: Minor
        Found in lib/rcs-collector/evidence_manager.rb - About 45 mins to fix

          Method sync_start has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def sync_start(session, version, user, device, source, time)
          Severity: Minor
          Found in lib/rcs-collector/db_rest.rb - About 45 mins to fix

            Method prepare_request has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def prepare_request(method, uri, query, content, http, peer)
            Severity: Minor
            Found in lib/rcs-collector/http_parser.rb - About 45 mins to fix

              Method sync_start has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def sync_start(session, version, user, device, source, time)
              Severity: Minor
              Found in lib/rcs-collector/db.rb - About 45 mins to fix

                Method sync_update has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def sync_update(session, version, user, device, source, time)
                Severity: Minor
                Found in lib/rcs-collector/db.rb - About 45 mins to fix

                  Method parse has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def self.parse(peer, uri, cookie, content, anon_version)
                  Severity: Minor
                  Found in lib/rcs-collector/sync_protocol.rb - About 35 mins to fix

                    Method agent_status has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def agent_status(build_id, instance_id, platform, demo, level)
                    Severity: Minor
                    Found in lib/rcs-collector/db.rb - About 35 mins to fix

                      Method agent_status has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def agent_status(build_id, instance_id, platform, demo, level)
                      Severity: Minor
                      Found in lib/rcs-collector/db_rest.rb - About 35 mins to fix

                        Method protocol_execute_commands has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def protocol_execute_commands(commands)
                        
                                trace :debug, "[#{@element['name']}] Received command is: #{commands.inspect}"
                        
                                # fallback to array if it's a single command
                        Severity: Minor
                        Found in lib/rcs-controller/protocol_parser.rb - About 35 mins 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_upgrade? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def new_upgrade?(bid)
                            # cannot reach the db, return false
                            return false unless @available
                        
                            # remove any pending entry in the cache
                        Severity: Minor
                        Found in lib/rcs-collector/db.rb - About 35 mins 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