Showing 270 of 327 total issues

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

    def reset(fast_check=true)
      @parser.reset
      @io_buffer.reset
      @read_header = true
      @read_proxy = !!@expect_proxy_proto
Severity: Minor
Found in lib/puma/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 try_to_finish has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def try_to_finish
      if env[CONTENT_LENGTH] && above_http_content_limit(env[CONTENT_LENGTH].to_i)
        @http_content_length_limit_exceeded = true
      end

Severity: Minor
Found in lib/puma/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 test_verify_client_cert_roundtrip has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def test_verify_client_cert_roundtrip(tls1_2 = nil)
    cert_path = File.expand_path '../examples/puma/client-certs', __dir__
    bind_port

    config = <<~CONFIG
Severity: Minor
Found in test/test_integration_ssl.rb - About 1 hr to fix

    Method aggregated_results has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def aggregated_results(io)
        is_github_actions = ENV['GITHUB_ACTIONS'] == 'true'
        filtered_results = results.dup
    
        if options[:verbose]
    Severity: Minor
    Found in test/helper.rb - About 1 hr to fix

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

          def initialize(app, events = nil, options = {})
            @app = app
            @events = events || Events.new
      
            @check, @notify = nil
      Severity: Minor
      Found in lib/puma/server.rb - About 1 hr to fix

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

              def call(env)
                unless authenticate(env)
                  return rack_response(403, 'Invalid auth token', 'text/plain')
                end
        
        
        Severity: Minor
        Found in lib/puma/app/status.rb - About 1 hr to fix

          Method try_to_finish has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def try_to_finish
                if env[CONTENT_LENGTH] && above_http_content_limit(env[CONTENT_LENGTH].to_i)
                  @http_content_length_limit_exceeded = true
                end
          
          
          Severity: Minor
          Found in lib/puma/client.rb - About 1 hr to fix

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

                def str_early_hints(headers)
                  eh_str = +""
                  headers.each_pair do |k, vs|
                    next if illegal_header_key?(k)
            
            
            Severity: Minor
            Found in lib/puma/request.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 aggregated_results has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def aggregated_results(io)
                is_github_actions = ENV['GITHUB_ACTIONS'] == 'true'
                filtered_results = results.dup
            
                if options[:verbose]
            Severity: Minor
            Found in test/helper.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 ci_test_rps has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def ci_test_rps
                  host = ENV['HOST']
                  port = ENV['PORT'].to_i
            
                  str = 'a' * 65_500
            Severity: Minor
            Found in benchmarks/local/response_time_wrk.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 oob_server has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def oob_server(**options)
                @request_count = 0
                @oob_count = 0
                in_oob = Mutex.new
                @mutex = Mutex.new
            Severity: Minor
            Found in test/test_out_of_band_server.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 call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                  def call(env)
                    unless authenticate(env)
                      return rack_response(403, 'Invalid auth token', 'text/plain')
                    end
            
            
            Severity: Minor
            Found in lib/puma/app/status.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_restart_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def generate_restart_data
                  if dir = @options[:directory]
                    @restart_dir = dir
            
                  elsif Puma.windows?
            Severity: Minor
            Found in lib/puma/launcher.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 config has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def config(app, options = {})
                  require_relative '../../puma'
                  require_relative '../../puma/configuration'
                  require_relative '../../puma/log_writer'
                  require_relative '../../puma/launcher'
            Severity: Minor
            Found in lib/rack/handler/puma.rb - About 1 hr to fix

              Method read_response_array has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def read_response_array(skts, resp_count: nil, body_only: nil)
                    results = Array.new skts.length
                    Thread.new do
                      until skts.compact.empty?
                        skts.each_with_index do |skt, idx|
              Severity: Minor
              Found in test/helpers/test_puma/puma_socket.rb - About 1 hr to fix

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

                    def setup_signals
                      if @options[:fork_worker]
                        Signal.trap "SIGURG" do
                          fork_worker!
                        end
                Severity: Minor
                Found in lib/puma/cluster.rb - About 1 hr to fix

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

                      def initialize
                        sleep 5 # wait for server to boot
                  
                        @thread_loops       = nil
                        @clients_per_thread = nil
                  Severity: Minor
                  Found in benchmarks/local/bench_base.rb - About 1 hr to fix

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

                        def req_env_post_parse(env)
                          to_delete = nil
                          to_add = nil
                    
                          env.each do |k,v|
                    Severity: Minor
                    Found in lib/puma/request.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 close_clients has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def close_clients
                          closed = 0
                          @ios_to_close.each do |socket|
                            if socket && socket.to_io.is_a?(IO) && !socket.closed?
                              begin
                    Severity: Minor
                    Found in benchmarks/local/bench_base.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 close_listeners has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def close_listeners
                          @listeners.each do |l, io|
                            begin
                              io.close unless io.closed?
                              uri = URI.parse l
                    Severity: Minor
                    Found in lib/puma/binder.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

                    Severity
                    Category
                    Status
                    Source
                    Language