socketry/falcon

View on GitHub

Showing 10 of 17 total issues

Method compare has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def compare
    host = "http://127.0.0.1:9292"
    
    threads = 2 # Etc.nprocessors
    
Severity: Minor
Found in examples/benchmark/bake.rb - About 1 hr to fix

    Method call has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                def call(request)
                    request_path, query_string = request.path.split('?', 2)
                    server_name, server_port = (request.authority || '').split(':', 2)
                    
                    env = {
    Severity: Minor
    Found in lib/falcon/adapters/rack.rb - About 1 hr to fix

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

                  def read(length = nil, buffer = nil)
                      buffer ||= Async::IO::Buffer.new
                      buffer.clear
                      
                      until buffer.bytesize == length
      Severity: Minor
      Found in lib/falcon/adapters/input.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 setup has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  def setup(container)
                      if proxy = container[:proxy]
                          proxy.kill(:HUP)
                      end
                      
      Severity: Minor
      Found in lib/falcon/controller/virtual.rb - About 1 hr to fix

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

                    def call(request)
                        request_path, query_string = request.path.split('?', 2)
                        server_name, server_port = (request.authority || '').split(':', 2)
                        
                        env = {
        Severity: Minor
        Found in lib/falcon/adapters/rack.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 unwrap_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                    def unwrap_request(request, env)
                        if content_type = request.headers.delete('content-type')
                            env[CONTENT_TYPE] = content_type
                        end
                        
        Severity: Minor
        Found in lib/falcon/adapters/rack.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 compare has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def compare
            host = "http://127.0.0.1:9292"
            
            threads = 2 # Etc.nprocessors
            
        Severity: Minor
        Found in examples/benchmark/bake.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 wrap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                    def self.wrap(status, headers, body)
                        # In no circumstance do we want this header propagating out:
                        if length = headers.delete(CONTENT_LENGTH)
                            # We don't really trust the user to provide the right length to the transport.
                            length = Integer(length)
        Severity: Minor
        Found in lib/falcon/adapters/output.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 build_ssl_context has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def build_ssl_context(hostname = self.hostname)
                    authority = Localhost::Authority.fetch(hostname)
                    
                    authority.server_context.tap do |context|
                        context.alpn_select_cb = lambda do |protocols|
        Severity: Minor
        Found in lib/falcon/endpoint.rb - About 25 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 wrap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                    def self.wrap(status, headers, body, request = nil)
                        headers, meta = wrap_headers(headers)
                        
                        if block = meta['rack.hijack']
                            body = Async::HTTP::Body::Hijack.wrap(request, &block)
        Severity: Minor
        Found in lib/falcon/adapters/response.rb - About 25 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