Showing 327 of 327 total issues

Class TestPumaControlCli has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

class TestPumaControlCli < TestConfigFileBase
  include SSLHelper

  def setup
    # use a pipe to get info across thread boundary
Severity: Minor
Found in test/test_pumactl.rb - About 2 hrs to fix

    Method send_request has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def send_request
          uri = URI.parse @control_url
    
          # create server object by scheme
          server =
    Severity: Minor
    Found in benchmarks/local/puma_info.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

    Method send_signal has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def send_signal
          unless @pid
            raise 'Neither pid nor control url available'
          end
    
    
    Severity: Minor
    Found in lib/puma/control_cli.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

    Method handle_request has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def handle_request(client, requests)
          env = client.env
          io_buffer = client.io_buffer
          socket  = client.io   # io may be a MiniSSL::Socket
          app_body = nil
    Severity: Major
    Found in lib/puma/request.rb - About 2 hrs to fix

      Method str_headers has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def str_headers(env, status, headers, res_body, io_buffer, force_keep_alive)
      
            line_ending = LINE_END
            colon = COLON
      
      
      Severity: Major
      Found in lib/puma/request.rb - About 2 hrs to fix

        File bench_base.rb has 278 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'optparse'
        
        module TestPuma
        
          HOST4 = ENV.fetch('PUMA_TEST_HOST4', '127.0.0.1')
        Severity: Minor
        Found in benchmarks/local/bench_base.rb - About 2 hrs to fix

          File test_pumactl.rb has 278 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require_relative "helper"
          require_relative "helpers/config_file"
          require_relative "helpers/ssl"
          
          require 'pathname'
          Severity: Minor
          Found in test/test_pumactl.rb - About 2 hrs to fix

            Class TestCLI has 24 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class TestCLI < Minitest::Test
              include SSLHelper if ::Puma::HAS_SSL
              include TmpPath
              include TestPuma::PumaSocket
            
            
            Severity: Minor
            Found in test/test_cli.rb - About 2 hrs to fix

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

                  def initialize(argv, stdout=STDOUT, stderr=STDERR)
                    @state = nil
                    @quiet = false
                    @pidfile = nil
                    @pid = nil
              Severity: Major
              Found in benchmarks/local/puma_info.rb - About 2 hrs to fix

                Method select_loop has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    def select_loop
                      close_selector = true
                      begin
                        until @input.closed? && @input.empty?
                          # Wakeup any registered object that receives incoming data.
                Severity: Minor
                Found in lib/puma/reactor.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

                File test_integration_ssl.rb has 274 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require_relative 'helper'
                require_relative "helpers/integration"
                
                if ::Puma::HAS_SSL # don't load any files if no ssl support
                  require "net/http"
                Severity: Minor
                Found in test/test_integration_ssl.rb - About 2 hrs to fix

                  File test_thread_pool.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require_relative "helper"
                  
                  require "puma/thread_pool"
                  
                  class TestThreadPool < Minitest::Test
                  Severity: Minor
                  Found in test/test_thread_pool.rb - About 2 hrs to fix

                    File thread_pool.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'thread'
                    
                    require_relative 'io_buffer'
                    
                    module Puma
                    Severity: Minor
                    Found in lib/puma/thread_pool.rb - About 2 hrs to fix

                      Class TestIntegration has 23 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class TestIntegration < Minitest::Test
                        include TmpPath
                        HOST  = "127.0.0.1"
                        TOKEN = "xxyyzz"
                        RESP_READ_LEN = 65_536
                      Severity: Minor
                      Found in test/helpers/integration.rb - About 2 hrs to fix

                        File puma_socket.rb has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'socket'
                        require_relative '../test_puma'
                        require_relative 'response'
                        
                        module TestPuma
                        Severity: Minor
                        Found in test/helpers/test_puma/puma_socket.rb - About 2 hrs to fix

                          Method context has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def context
                                  ctx = MiniSSL::Context.new
                          
                                  if defined?(JRUBY_VERSION)
                                    unless params['keystore']
                          Severity: Major
                          Found in lib/puma/minissl/context_builder.rb - About 2 hrs to fix

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

                              def start(launcher)
                                path = File.join("tmp", "restart.txt")
                            
                                orig = nil
                            
                            
                            Severity: Minor
                            Found in lib/puma/plugin/tmp_restart.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

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

                              def shutdown_requests(s1_complete: true, s1_response: nil, post: false, s2_response: nil, **options)
                                mutex = Mutex.new
                                app_finished = ConditionVariable.new
                                server_run(**options) { |env|
                                  path = env['REQUEST_PATH']
                            Severity: Minor
                            Found in test/test_puma_server.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 TestThreadPool has 22 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            class TestThreadPool < Minitest::Test
                            
                              def teardown
                                @pool.shutdown(1) if defined?(@pool)
                              end
                            Severity: Minor
                            Found in test/test_thread_pool.rb - About 2 hrs to fix

                              Class Binder has 22 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                                class Binder
                                  include Puma::Const
                              
                                  RACK_VERSION = [1,6].freeze
                              
                              
                              Severity: Minor
                              Found in lib/puma/binder.rb - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language