benchmarks/local/bench_base.rb

Summary

Maintainability
C
1 day
Test Coverage

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

    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 setup_options has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def setup_options
            OptionParser.new do |o|
              o.on "-T", "--stream-threads THREADS", OptionParser::DecimalInteger, "request_stream: loops/threads" do |arg|
                @stream_threads = arg.to_i
              end
      Severity: Minor
      Found in benchmarks/local/bench_base.rb - About 1 hr to fix

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

            def initialize
              sleep 5 # wait for server to boot
        
              @thread_loops       = nil
              @clients_per_thread = nil
        Severity: Minor
        Found in benchmarks/local/bench_base.rb - About 1 hr to fix

          Method close_clients has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def close_clients
                closed = 0
                @ios_to_close.each do |socket|
                  if socket && socket.to_io.is_a?(IO) && !socket.closed?
                    begin
          Severity: Minor
          Found in benchmarks/local/bench_base.rb - About 1 hr 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 a Cognitive Complexity of 9 (exceeds 5 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: Minor
          Found in benchmarks/local/bench_base.rb - About 55 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 setup_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def setup_options
                OptionParser.new do |o|
                  o.on "-T", "--stream-threads THREADS", OptionParser::DecimalInteger, "request_stream: loops/threads" do |arg|
                    @stream_threads = arg.to_i
                  end
          Severity: Minor
          Found in benchmarks/local/bench_base.rb - About 25 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

          There are no issues that match your filters.

          Category
          Status