Showing 271 of 328 total issues

Avoid deeply nested control flow statements.
Open

                  w.term unless w.term?
Severity: Major
Found in lib/puma/cluster.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        rescue EOFError
                          break
    Severity: Major
    Found in test/helpers/test_puma/puma_socket.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                        if in_phased_restart && workers_not_booted.positive? && w0 = worker_at(0)
                          w0.ping!(status)
                          @events.fire(:ping!, w0)
                        end
      Severity: Major
      Found in lib/puma/cluster.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                      start_of_rest = if rest.start_with?(CHUNK_VALID_ENDING)
                        CHUNK_VALID_ENDING_SIZE
                      else # we have started a trailer section, which we do not support. skip it!
                        rest.index(CHUNK_VALID_ENDING*2) + CHUNK_VALID_ENDING_SIZE*2
                      end
        Severity: Major
        Found in lib/puma/client.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

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

            Avoid deeply nested control flow statements.
            Open

                        next if (byte_size = part.bytesize).zero?
            Severity: Major
            Found in lib/puma/request.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          next if part.nil? || (byte_size = part.bytesize).zero?
              Severity: Major
              Found in lib/puma/request.rb - About 45 mins to fix

                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 << "#{PipeRequest::IDLE}#{Process.pid}\n" rescue nil
                  Severity: Major
                  Found in lib/puma/server.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

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

                          def wait_until_not_full
                            with_mutex do
                              while true
                                return if @shutdown
                      
                      
                      Severity: Minor
                      Found in lib/puma/thread_pool.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 io_buffer.length > IO_BUFFER_LEN_MAX
                                    fast_write_str socket, io_buffer.read_and_reset
                                  end
                      Severity: Major
                      Found in lib/puma/request.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    next if part.bytesize.zero?
                        Severity: Major
                        Found in lib/puma/request.rb - About 45 mins to fix

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

                              def create_activated_fds(env_hash)
                                @log_writer.debug "ENV['LISTEN_FDS'] #{ENV['LISTEN_FDS'].inspect}  env_hash['LISTEN_PID'] #{env_hash['LISTEN_PID'].inspect}"
                                return [] unless env_hash['LISTEN_FDS'] && env_hash['LISTEN_PID'].to_i == $$
                                env_hash['LISTEN_FDS'].to_i.times do |index|
                                  sock = TCPServer.for_fd(socket_activation_fd(index))
                          Severity: Minor
                          Found in lib/puma/binder.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 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

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

                                def closed_socket?(socket)
                                  skt = socket.to_io
                                  return false unless skt.kind_of?(TCPSocket) && @precheck_closing
                          
                                  begin
                          Severity: Minor
                          Found in lib/puma/server.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

                                      next if part.bytesize.zero?
                          Severity: Major
                          Found in lib/puma/request.rb - About 45 mins to fix

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

                                def read_chunked_body
                                  while true
                                    begin
                                      chunk = @io.read_nonblock(4096, @read_buffer)
                                    rescue IO::WaitReadable
                            Severity: Minor
                            Found in lib/puma/client.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

                                          @buffer = nil if @buffer.empty?
                            Severity: Major
                            Found in lib/puma/client.rb - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                          if io_buffer.length > IO_BUFFER_LEN_MAX
                                            fast_write_str socket, io_buffer.read_and_reset
                                          end
                              Severity: Major
                              Found in lib/puma/request.rb - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language