Showing 270 of 327 total issues

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

    def start
      require_relative 'cli'

      run_args = []

Severity: Minor
Found in lib/puma/control_cli.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

Avoid deeply nested control flow statements.
Open

              if u = params['backlog']
                backlog = Integer(u)
              end
Severity: Major
Found in lib/puma/binder.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                    @worker_write << "#{Puma::Const::PipeRequest::FORK}#{pid}:#{idx}\n" rescue nil
    Severity: Major
    Found in lib/puma/cluster/worker.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if md[1]
                      @peerip = md[1].split(" ")[0]
                    end
      Severity: Major
      Found in lib/puma/client.rb - About 45 mins to fix

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

          def thread_run_pid(replies, delay, sleep_time, mutex, refused, unix: false)
        Severity: Minor
        Found in test/test_integration_cluster.rb - About 35 mins to fix

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

              def fast_write_response(socket, body, io_buffer, chunked, content_length)
          Severity: Minor
          Found in lib/puma/request.rb - About 35 mins to fix

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

                def prepare_response(status, headers, res_body, requests, client)
            Severity: Minor
            Found in lib/puma/request.rb - About 35 mins to fix

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

                  def add_ssl_listener(host, port, ctx,
                                       optimize_for_latency=true, backlog=1024)
              Severity: Minor
              Found in lib/puma/binder.rb - About 35 mins to fix

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

                    def add_ssl_listener(host, port, ctx, optimize_for_latency = true,
                                         backlog = 1024)
                Severity: Minor
                Found in lib/puma/server.rb - About 35 mins to fix

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

                    def teardown
                      @server.stop(true)
                      # Errno::EBADF raised on macOS
                      @ios.each do |io|
                        begin
                  Severity: Minor
                  Found in test/test_puma_server.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def initialize(argv, log_writer = LogWriter.stdio, events = Events.new)
                        @debug = false
                        @argv = argv.dup
                        @log_writer = log_writer
                        @events = events
                  Severity: Minor
                  Found in lib/puma/cli.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 timeout_workers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def timeout_workers
                        @workers.each do |w|
                          if !w.term? && w.ping_timeout <= Time.now
                            details = if w.booted?
                                        "(Worker #{w.index} failed to check in within #{@options[:worker_timeout]} seconds)"
                  Severity: Minor
                  Found in lib/puma/cluster.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 assert_file_contents has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def assert_file_contents(path, include = FILE_STR)
                      retries = 0
                      retries_max = 50 # 5 seconds
                      File.open(path) do |file|
                        begin
                  Severity: Minor
                  Found in test/test_redirect_io.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 add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def add(client)
                            if client.env['REQUEST_PATH'] == '/s2'
                              Thread.pass until @pool.instance_variable_get(:@shutdown)
                            end
                            super
                  Severity: Minor
                  Found in test/test_puma_server.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 assert_ssl_client_error_match has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def assert_ssl_client_error_match(error, subject: nil, context: CTX, &blk)
                      port = 0
                  
                      app = lambda { |env| [200, {}, [env['rack.url_scheme']]] }
                  
                  
                  Severity: Minor
                  Found in test/test_puma_server_ssl.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 send_http_array has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def send_http_array(req = GET_11, len, dly: 0.000_1, max_retries: 5)
                        Array.new(len) {
                          retries = 0
                          begin
                            skt = send_http req
                  Severity: Minor
                  Found in test/helpers/test_puma/puma_socket.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 test_tls_v1_3 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def test_tls_v1_3
                      skip("TLSv1.3 protocol can not be set") unless OpenSSL::SSL::SSLContext.instance_methods(false).include?(:min_version=)
                  
                      start_server
                  
                  
                  Severity: Minor
                  Found in test/test_puma_server_ssl.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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def run(background=true, thread_name: 'srv')
                        BasicSocket.do_not_reverse_lookup = true
                  
                        @events.fire :state, :booting
                  
                  
                  Severity: Minor
                  Found in lib/puma/server.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 trigger_out_of_band_hook has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def trigger_out_of_band_hook
                        return false unless @out_of_band&.any?
                  
                        # we execute on idle hook when all threads are free
                        return false unless @spawned == @waiting
                  Severity: Minor
                  Found in lib/puma/thread_pool.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 wakeup! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def wakeup!
                        return unless @wakeup
                  
                        @wakeup.write Puma::Const::PipeRequest::WAKEUP unless @wakeup.closed?
                  
                  
                  Severity: Minor
                  Found in lib/puma/runner.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