test/test_integration_cluster.rb

Summary

Maintainability
F
3 days
Test Coverage

File test_integration_cluster.rb has 565 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative "helper"
require_relative "helpers/integration"

require "puma/configuration"

Severity: Major
Found in test/test_integration_cluster.rb - About 1 day to fix

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

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

      Method term_closes_listeners has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def term_closes_listeners(unix: false)
          skip_unless_signal_exist? :TERM
      
          cli_server "-w #{workers} -t 0:6 -q test/rackup/sleep_step.ru", unix: unix
          threads = []
      Severity: Minor
      Found in test/test_integration_cluster.rb - About 1 hr to fix

        Method usr1_all_respond has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def usr1_all_respond(unix: false, config: '')
            cli_server "-w #{workers} -t 0:5 -q test/rackup/sleep_pid.ru #{config}", unix: unix
            threads = []
            replies = []
            mutex = Mutex.new
        Severity: Minor
        Found in test/test_integration_cluster.rb - About 1 hr to fix

          Method test_worker_index_is_with_in_options_limit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def test_worker_index_is_with_in_options_limit
              skip_unless_signal_exist? :TERM
          
              cli_server "-C test/config/t3_conf.rb test/rackup/hello.ru"
          
          
          Severity: Minor
          Found in test/test_integration_cluster.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 term_closes_listeners has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def term_closes_listeners(unix: false)
              skip_unless_signal_exist? :TERM
          
              cli_server "-w #{workers} -t 0:6 -q test/rackup/sleep_step.ru", unix: unix
              threads = []
          Severity: Minor
          Found in test/test_integration_cluster.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 thread_run_step has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def thread_run_step(replies, delay, sleep_time, step, mutex, refused, unix: false)
          Severity: Minor
          Found in test/test_integration_cluster.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 bad_exit_pids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def bad_exit_pids(pids)
                  t = pids.map do |pid|
                    begin
                      pid if Process.kill 0, pid
                    rescue Errno::ESRCH
              Severity: Minor
              Found in test/test_integration_cluster.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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                def test_culling_strategy_oldest_fork_worker
                  cli_server "-w 2 test/rackup/hello.ru", config: <<~RUBY
                    worker_culling_strategy :oldest
                    fork_worker
                  RUBY
              Severity: Minor
              Found in test/test_integration_cluster.rb and 2 other locations - About 20 mins to fix
              test/test_integration_cluster.rb on lines 470..482
              test/test_integration_cluster.rb on lines 485..497

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 28.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                def test_culling_strategy_oldest
                  cli_server "-w 2 test/rackup/hello.ru", config: "worker_culling_strategy :oldest"
                  get_worker_pids # to consume server logs
              
                  Process.kill :TTIN, @pid
              Severity: Minor
              Found in test/test_integration_cluster.rb and 2 other locations - About 20 mins to fix
              test/test_integration_cluster.rb on lines 470..482
              test/test_integration_cluster.rb on lines 500..516

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 28.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                def test_culling_strategy_youngest
                  cli_server "-w 2 test/rackup/hello.ru", config: "worker_culling_strategy :youngest"
                  get_worker_pids # to consume server logs
              
                  Process.kill :TTIN, @pid
              Severity: Minor
              Found in test/test_integration_cluster.rb and 2 other locations - About 20 mins to fix
              test/test_integration_cluster.rb on lines 485..497
              test/test_integration_cluster.rb on lines 500..516

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 28.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status