Showing 327 of 327 total issues

Method process_client has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def process_client(client)
      # Advertise this server into the thread
      Thread.current[THREAD_LOCAL_KEY] = self

      clean_thread_locals = options[:clean_thread_locals]
Severity: Major
Found in lib/puma/server.rb - About 2 hrs to fix

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

      def teardown
        if @server && defined?(@control_tcp_port) && Puma.windows?
          cli_pumactl 'stop'
        elsif @server && @pid && !Puma.windows?
          stop_server @pid, signal: :INT
    Severity: Minor
    Found in test/helpers/integration.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 after_teardown has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def after_teardown
          return if skipped?
          super
          # Errno::EBADF raised on macOS
          @ios_to_close.each do |io|
    Severity: Minor
    Found in test/helpers/test_puma/puma_socket.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 save has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def save(path, permission = nil)
          contents = +"---\n"
          @options.each do |k,v|
            next unless ALLOWED_FIELDS.include? k
            case v
    Severity: Minor
    Found in lib/puma/state_file.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 run_wrk_parse has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def run_wrk_parse(cmd, log: false)
          STDOUT.syswrite cmd.ljust 55
    
          if @dly_app
            cmd.sub! ' -H ', " -H 'Dly: #{@dly_app.round 4}' -H "
    Severity: Major
    Found in benchmarks/local/bench_base.rb - About 2 hrs to fix

      Method send_request has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def send_request
            uri = URI.parse @control_url
      
            host = uri.host
      
      
      Severity: Major
      Found in lib/puma/control_cli.rb - About 2 hrs to fix

        File test_rack_handler.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require_relative "helper"
        
        # Most tests check that ::Rack::Handler::Puma works by itself
        # RackUp#test_bin runs Puma using the rackup bin file
        module TestRackUp
        Severity: Minor
        Found in test/test_rack_handler.rb - About 2 hrs to fix

          Class TestResponseHeader has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class TestResponseHeader < Minitest::Test
            parallelize_me!
          
            # this file has limited response length, so 10kB works.
            CLIENT_SYSREAD_LENGTH = 10_240
          Severity: Minor
          Found in test/test_response_header.rb - About 2 hrs to fix

            Class TestIntegrationSingle has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

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

              Class TestRequestInvalid has 21 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class TestRequestInvalid < Minitest::Test
                # running parallel seems to take longer...
                # parallelize_me! unless JRUBY_HEAD
              
                GET_PREFIX = "GET / HTTP/1.1\r\nConnection: close\r\n"
              Severity: Minor
              Found in test/test_request_invalid.rb - About 2 hrs to fix

                Class Runner has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Runner
                    def initialize(launcher)
                      @launcher = launcher
                      @log_writer = launcher.log_writer
                      @events = launcher.events
                Severity: Minor
                Found in lib/puma/runner.rb - About 2 hrs to fix

                  Class Configuration has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class Configuration
                      DEFAULTS = {
                        auto_trim_time: 30,
                        binds: ['tcp://0.0.0.0:9292'.freeze],
                        clean_thread_locals: false,
                  Severity: Minor
                  Found in lib/puma/configuration.rb - About 2 hrs to fix

                    Method ssl_bind_str has 54 lines of code (exceeds 25 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: Major
                    Found in lib/puma/dsl.rb - About 2 hrs to fix

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

                          def setup_signals
                            begin
                              Signal.trap "SIGUSR2" do
                                restart
                              end
                      Severity: Major
                      Found in lib/puma/launcher.rb - About 2 hrs to fix

                        Method setup_signals has a Cognitive Complexity of 16 (exceeds 5 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 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 initialize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def initialize(argv, stdout=STDOUT, stderr=STDERR)
                              @state = nil
                              @quiet = false
                              @pidfile = nil
                              @pid = nil
                        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 call has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def call(env)
                              path = env['PATH_INFO']
                              script_name = env['SCRIPT_NAME']
                              http_host = env['HTTP_HOST']
                              server_name = env['SERVER_NAME']
                        Severity: Minor
                        Found in lib/puma/rack/urlmap.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 config has a Cognitive Complexity of 16 (exceeds 5 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 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 try_to_parse_proxy_protocol has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def try_to_parse_proxy_protocol
                              if @read_proxy
                                if @expect_proxy_proto == :v1
                                  if @buffer.include? "\r\n"
                                    if md = PROXY_PROTOCOL_V1_REGEX.match(@buffer)
                        Severity: Minor
                        Found in lib/puma/client.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 setup_signals has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def setup_signals
                              begin
                                Signal.trap "SIGUSR2" do
                                  restart
                                end
                        Severity: Minor
                        Found in lib/puma/launcher.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

                        Severity
                        Category
                        Status
                        Source
                        Language