Showing 252 of 252 total issues

File test_puma_server.rb has 1017 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative "helper"
require "puma/events"
require "net/http"
require "nio"
require "ipaddr"
Severity: Major
Found in test/test_puma_server.rb - About 2 days to fix

    Class TestPumaServer has 97 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class TestPumaServer < Minitest::Test
      parallelize_me! unless JRUBY_HEAD
    
      def setup
        @host = "127.0.0.1"
    Severity: Major
    Found in test/test_puma_server.rb - About 1 day to fix

      Method parse has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse(binds, log_writer, log_msg = 'Listening')
            binds.each do |str|
              uri = URI.parse str
              case uri.scheme
              when "tcp"
      Severity: Minor
      Found in lib/puma/binder.rb - About 1 day 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 65 (exceeds 5 allowed). Consider refactoring.
      Open

          def run
            @status = :run
      
            output_header "cluster"
      
      
      Severity: Minor
      Found in lib/puma/cluster.rb - About 1 day 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 DSL has 68 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class DSL
          include ConfigDefault
      
          # convenience method so logic can be used in CI
          # @see ssl_bind
      Severity: Major
      Found in lib/puma/dsl.rb - About 1 day to fix

        Method decode_chunk has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
        Open

            def decode_chunk(chunk)
              if @partial_part_left > 0
                if @partial_part_left <= chunk.size
                  if @partial_part_left > 2
                    write_chunk(chunk[0..(@partial_part_left-3)]) # skip the \r\n
        Severity: Minor
        Found in lib/puma/client.rb - About 1 day 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 context has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
        Open

              def context
                ctx = MiniSSL::Context.new
        
                if defined?(JRUBY_VERSION)
                  unless params['keystore']
        Severity: Minor
        Found in lib/puma/minissl/context_builder.rb - About 7 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 hot_restart_does_not_drop_connections has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
        Open

          def hot_restart_does_not_drop_connections(num_threads: 1, total_requests: 500)
            skipped = true
            skip_if :jruby, suffix: <<-MSG
         - file descriptors are not preserved on exec on JRuby; connection reset errors are expected during restarts
            MSG
        Severity: Minor
        Found in test/helpers/integration.rb - About 7 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 run has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
        Open

              def run
                title  = "puma: cluster worker #{index}: #{master}"
                title += " [#{@options[:tag]}]" if @options[:tag] && !@options[:tag].empty?
                $0 = title
        
        
        Severity: Minor
        Found in lib/puma/cluster/worker.rb - About 7 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_config.rb has 481 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require_relative "helper"
        require_relative "helpers/config_file"
        
        require "puma/configuration"
        require 'puma/log_writer'
        Severity: Minor
        Found in test/test_config.rb - About 7 hrs to fix

          Method handle_servers has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
          Open

              def handle_servers
                begin
                  check = @check
                  sockets = [check] + @binder.ios
                  pool = @thread_pool
          Severity: Minor
          Found in lib/puma/server.rb - About 7 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_cluster.rb has 472 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require_relative "helper"
          require_relative "helpers/integration"
          
          require "time"
          
          
          Severity: Minor
          Found in test/test_integration_cluster.rb - About 7 hrs to fix

            File client.rb has 438 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class IO
              # We need to use this for a jruby work around on both 1.8 and 1.9.
              # So this either creates the constant (on 1.8), or harmlessly
              # reopens it (on 1.9).
              module WaitReadable
            Severity: Minor
            Found in lib/puma/client.rb - About 6 hrs to fix

              Class TestIntegrationCluster has 47 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class TestIntegrationCluster < TestIntegration
                parallelize_me! if ::Puma.mri?
              
                def workers ; 2 ; end
              
              
              Severity: Minor
              Found in test/test_integration_cluster.rb - About 6 hrs to fix

                Method read_response has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                Open

                  def read_response(connection, timeout = nil)
                    timeout ||= RESP_READ_TIMEOUT
                    content_length = nil
                    chunked = nil
                    response = ''.dup
                Severity: Minor
                Found in test/helpers/integration.rb - About 6 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_puma_server_ssl.rb has 426 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require_relative "helper"
                
                if ::Puma::HAS_SSL
                  require "puma/minissl"
                  require "net/http"
                Severity: Minor
                Found in test/test_puma_server_ssl.rb - About 6 hrs to fix

                  File server.rb has 418 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'stringio'
                  
                  require 'puma/thread_pool'
                  require 'puma/const'
                  require 'puma/log_writer'
                  Severity: Minor
                  Found in lib/puma/server.rb - About 6 hrs to fix

                    Class TestBinderParallel has 43 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class TestBinderParallel < TestBinderBase
                      parallelize_me!
                    
                      def test_synthesize_binds_from_activated_fds_no_sockets
                        binds = ['tcp://0.0.0.0:3000']
                    Severity: Minor
                    Found in test/test_binder.rb - About 5 hrs to fix

                      Method ssl_bind_str has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def self.ssl_bind_str(host, port, opts)
                            verify = opts.fetch(:verify_mode, 'none').to_s
                      
                            tls_str =
                              if opts[:no_tlsv1_1]  then '&no_tlsv1_1=true'
                      Severity: Minor
                      Found in lib/puma/dsl.rb - About 5 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 cluster.rb has 401 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'puma/runner'
                      require 'puma/util'
                      require 'puma/plugin'
                      require 'puma/cluster/worker_handle'
                      require 'puma/cluster/worker'
                      Severity: Minor
                      Found in lib/puma/cluster.rb - About 5 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language