cotag/spider-gazelle

View on GitHub

Showing 28 of 28 total issues

Method send_next_response has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
Open

            def send_next_response
                request, result = @responses.shift
                @transmitting = request
                return unless request

Severity: Minor
Found in lib/spider-gazelle/spider/http1.rb - About 1 day 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 parse has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.parse(args)
            options = {}

            parser = OptionParser.new do |opts|
                # ================
Severity: Major
Found in lib/spider-gazelle/options.rb - About 3 hrs to fix

    File http1.rb has 308 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'http-parser'     # C based, fast, http parser
    require 'spider-gazelle/gazelle/request'
    
    
    module SpiderGazelle
    Severity: Minor
    Found in lib/spider-gazelle/spider/http1.rb - About 3 hrs to fix

      Method send_next_response has 83 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  def send_next_response
                      request, result = @responses.shift
                      @transmitting = request
                      return unless request
      
      
      Severity: Major
      Found in lib/spider-gazelle/spider/http1.rb - About 3 hrs to fix

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

                    def execute!
                        @env['CONTENT_LENGTH'] = @env.delete('HTTP_CONTENT_LENGTH') || @body.bytesize.to_s
                        @env['CONTENT_TYPE'] = @env.delete('HTTP_CONTENT_TYPE') || 'text/plain'
                        @env['REQUEST_URI'] = @url.freeze
        
        
        Severity: Minor
        Found in lib/spider-gazelle/gazelle/request.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

        Class Http1 has 21 methods (exceeds 20 allowed). Consider refactoring.
        Open

                class Http1
                    class Callbacks
                        def initialize
                            @parser = ::HttpParser::Parser.new self
                            @logger = Logger.instance
        Severity: Minor
        Found in lib/spider-gazelle/spider/http1.rb - About 2 hrs to fix

          Method execute! has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      def execute!
                          @env['CONTENT_LENGTH'] = @env.delete('HTTP_CONTENT_LENGTH') || @body.bytesize.to_s
                          @env['CONTENT_TYPE'] = @env.delete('HTTP_CONTENT_TYPE') || 'text/plain'
                          @env['REQUEST_URI'] = @url.freeze
          
          
          Severity: Minor
          Found in lib/spider-gazelle/gazelle/request.rb - About 1 hr to fix

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

                    def self.parse(args)
                        options = {}
            
                        parser = OptionParser.new do |opts|
                            # ================
            Severity: Minor
            Found in lib/spider-gazelle/options.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_on_gazelle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                        def process_on_gazelle(request)
                            result = begin
                                request.execute!
                            rescue StandardError => e
                                Logger.instance.print_error e, 'framework error'
            Severity: Minor
            Found in lib/spider-gazelle/spider/http1.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 load_gazelles has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def load_gazelles(mode, count, options)
                        defer = @thread.defer
                        @loading[mode] = defer
            
                        if mode == :inline
            Severity: Minor
            Found in lib/spider-gazelle/spider.rb - About 1 hr to fix

              Method become_sg_master has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def become_sg_master
                          @is_master = true
                          @is_client = false
                          @is_connected = true
              
              
              Severity: Minor
              Found in lib/spider-gazelle/signaller.rb - About 1 hr to fix

                Method connect_to_sg_master has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def connect_to_sg_master
                            @pipe = @thread.pipe :ipc
                            @pipe.connect(SIGNAL_SERVER) do |client|
                                @is_client = true
                                @is_connected = true
                Severity: Minor
                Found in lib/spider-gazelle/signaller.rb - About 1 hr to fix

                  Method initialize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def initialize(tcp, env)
                          @socket, @env = tcp, env
                  
                          # Initialise the promise
                          super tcp.reactor, tcp.reactor.defer
                  Severity: Minor
                  Found in lib/spider-gazelle/upgrades/websocket.rb - About 1 hr to fix

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

                            def become_sg_master
                                @is_master = true
                                @is_client = false
                                @is_connected = true
                    
                    
                    Severity: Minor
                    Found in lib/spider-gazelle/signaller.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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def initialize(tcp, env)
                            @socket, @env = tcp, env
                    
                            # Initialise the promise
                            super tcp.reactor, tcp.reactor.defer
                    Severity: Minor
                    Found in lib/spider-gazelle/upgrades/websocket.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 load has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                                def self.load(rackup, options)
                                    begin
                                        @critical.synchronize {
                                            return if @loaded[rackup]
                    
                    
                    Severity: Minor
                    Found in lib/spider-gazelle/spider/app_store.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                                def initialize(thread, app, port, remote_ip, scheme, socket)
                    Severity: Minor
                    Found in lib/spider-gazelle/gazelle/request.rb - About 45 mins to fix

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

                              def self.sanitize(args)
                                  # Use "\0" as this character won't be used in the command
                                  cmdline = args.join("\0")
                                  components = cmdline.split("\0--", -1)
                      
                      
                      Severity: Minor
                      Found in lib/spider-gazelle/options.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 process_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def process_request(data, client)
                                  validated = @validated.include?(client)
                                  parser = @validating[client.object_id]
                      
                                  if validated
                      Severity: Minor
                      Found in lib/spider-gazelle/signaller.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 load_gazelle_thread has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              def load_gazelle_thread(reactor, thread, mode, options, loading)
                      Severity: Minor
                      Found in lib/spider-gazelle/spider.rb - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language