test/test_puma_server.rb

Summary

Maintainability
F
1 wk
Test Coverage

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

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

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

    class TestPumaServer < Minitest::Test
      parallelize_me!
    
      STATUS_CODES = ::Puma::HTTP_STATUS_CODES
    
    
    Severity: Major
    Found in test/test_puma_server.rb - About 2 days to fix

      Method shutdown_requests has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        def shutdown_requests(s1_complete: true, s1_response: nil, post: false, s2_response: nil, **options)
          mutex = Mutex.new
          app_finished = ConditionVariable.new
          server_run(**options) { |env|
            path = env['REQUEST_PATH']
      Severity: Minor
      Found in test/test_puma_server.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 shutdown_requests has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def shutdown_requests(s1_complete: true, s1_response: nil, post: false, s2_response: nil, **options)
          mutex = Mutex.new
          app_finished = ConditionVariable.new
          server_run(**options) { |env|
            path = env['REQUEST_PATH']
      Severity: Minor
      Found in test/test_puma_server.rb - About 1 hr to fix

        Method test_chunked_keep_alive_two_back_to_back has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def test_chunked_keep_alive_two_back_to_back
            body = nil
            content_length = nil
            server_run { |env|
              body = env['rack.input'].read
        Severity: Minor
        Found in test/test_puma_server.rb - About 1 hr to fix

          Method test_drain_on_shutdown has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def test_drain_on_shutdown(drain=true)
              num_connections = 10
          
              wait = Queue.new
              server_run(drain_on_shutdown: drain, max_threads: 1) do
          Severity: Minor
          Found in test/test_puma_server.rb - About 1 hr to fix

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

              def test_drain_on_shutdown(drain=true)
                num_connections = 10
            
                wait = Queue.new
                server_run(drain_on_shutdown: drain, max_threads: 1) do
            Severity: Minor
            Found in test/test_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

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

              def teardown
                @server.stop(true)
                # Errno::EBADF raised on macOS
                @ios.each do |io|
                  begin
            Severity: Minor
            Found in test/test_puma_server.rb - About 35 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 add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                    def add(client)
                      if client.env['REQUEST_PATH'] == '/s2'
                        Thread.pass until @pool.instance_variable_get(:@shutdown)
                      end
                      super
            Severity: Minor
            Found in test/test_puma_server.rb - About 35 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 send_proxy_v1_http has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def send_proxy_v1_http(req, remote_ip, multisend = false)
                addr = IPAddr.new(remote_ip)
                family = addr.ipv4? ? "TCP4" : "TCP6"
                target = addr.ipv4? ? "127.0.0.1" : "::1"
                conn = new_connection
            Severity: Minor
            Found in test/test_puma_server.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 7 locations. Consider refactoring.
            Open

              def test_chunked_request_pause_mid_count
                body = nil
                content_length = nil
                server_run { |env|
                  body = env['rack.input'].read
            Severity: Major
            Found in test/test_puma_server.rb and 6 other locations - About 55 mins to fix
            test/test_puma_server.rb on lines 959..977
            test/test_puma_server.rb on lines 980..998
            test/test_puma_server.rb on lines 1022..1040
            test/test_puma_server.rb on lines 1043..1061
            test/test_puma_server.rb on lines 1094..1113
            test/test_puma_server.rb on lines 1116..1135

            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 44.

            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 7 locations. Consider refactoring.
            Open

              def test_chunked_request_pause_before_closing_cr_lf
                body = nil
                content_length = nil
                server_run { |env|
                  body = env['rack.input'].read
            Severity: Major
            Found in test/test_puma_server.rb and 6 other locations - About 55 mins to fix
            test/test_puma_server.rb on lines 959..977
            test/test_puma_server.rb on lines 980..998
            test/test_puma_server.rb on lines 1001..1019
            test/test_puma_server.rb on lines 1022..1040
            test/test_puma_server.rb on lines 1043..1061
            test/test_puma_server.rb on lines 1094..1113

            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 44.

            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 7 locations. Consider refactoring.
            Open

              def test_chunked_request_pause_between_closing_cr_lf
                body = nil
                content_length = nil
                server_run { |env|
                  body = env['rack.input'].read
            Severity: Major
            Found in test/test_puma_server.rb and 6 other locations - About 55 mins to fix
            test/test_puma_server.rb on lines 959..977
            test/test_puma_server.rb on lines 980..998
            test/test_puma_server.rb on lines 1001..1019
            test/test_puma_server.rb on lines 1022..1040
            test/test_puma_server.rb on lines 1043..1061
            test/test_puma_server.rb on lines 1116..1135

            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 44.

            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 7 locations. Consider refactoring.
            Open

              def test_chunked_request_pause_before_value
                body = nil
                content_length = nil
                server_run { |env|
                  body = env['rack.input'].read
            Severity: Major
            Found in test/test_puma_server.rb and 6 other locations - About 55 mins to fix
            test/test_puma_server.rb on lines 980..998
            test/test_puma_server.rb on lines 1001..1019
            test/test_puma_server.rb on lines 1022..1040
            test/test_puma_server.rb on lines 1043..1061
            test/test_puma_server.rb on lines 1094..1113
            test/test_puma_server.rb on lines 1116..1135

            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 44.

            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 7 locations. Consider refactoring.
            Open

              def test_chunked_request_pause_mid_value
                body = nil
                content_length = nil
                server_run { |env|
                  body = env['rack.input'].read
            Severity: Major
            Found in test/test_puma_server.rb and 6 other locations - About 55 mins to fix
            test/test_puma_server.rb on lines 959..977
            test/test_puma_server.rb on lines 980..998
            test/test_puma_server.rb on lines 1001..1019
            test/test_puma_server.rb on lines 1022..1040
            test/test_puma_server.rb on lines 1094..1113
            test/test_puma_server.rb on lines 1116..1135

            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 44.

            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 7 locations. Consider refactoring.
            Open

              def test_chunked_request_pause_before_count_newline
                body = nil
                content_length = nil
                server_run { |env|
                  body = env['rack.input'].read
            Severity: Major
            Found in test/test_puma_server.rb and 6 other locations - About 55 mins to fix
            test/test_puma_server.rb on lines 959..977
            test/test_puma_server.rb on lines 980..998
            test/test_puma_server.rb on lines 1001..1019
            test/test_puma_server.rb on lines 1043..1061
            test/test_puma_server.rb on lines 1094..1113
            test/test_puma_server.rb on lines 1116..1135

            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 44.

            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 7 locations. Consider refactoring.
            Open

              def test_chunked_request_pause_between_chunks
                body = nil
                content_length = nil
                server_run { |env|
                  body = env['rack.input'].read
            Severity: Major
            Found in test/test_puma_server.rb and 6 other locations - About 55 mins to fix
            test/test_puma_server.rb on lines 959..977
            test/test_puma_server.rb on lines 1001..1019
            test/test_puma_server.rb on lines 1022..1040
            test/test_puma_server.rb on lines 1043..1061
            test/test_puma_server.rb on lines 1094..1113
            test/test_puma_server.rb on lines 1116..1135

            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 44.

            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 2 locations. Consider refactoring.
            Open

              def test_normalize_host_header_ipv4
                server_run do |env|
                  [200, {}, [env["SERVER_NAME"], "\n", env["SERVER_PORT"]]]
                end
            
            
            Severity: Minor
            Found in test/test_puma_server.rb and 1 other location - About 35 mins to fix
            test/test_puma_server.rb on lines 120..129

            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 34.

            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 2 locations. Consider refactoring.
            Open

              def test_normalize_host_header_hostname
                server_run do |env|
                  [200, {}, [env["SERVER_NAME"], "\n", env["SERVER_PORT"]]]
                end
            
            
            Severity: Minor
            Found in test/test_puma_server.rb and 1 other location - About 35 mins to fix
            test/test_puma_server.rb on lines 132..141

            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 34.

            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 2 locations. Consider refactoring.
            Open

              def test_immediate_pipeline_terminates_last_request
                bodies = []
                server_run { |e|
                  bodies << e['rack.input'].read
                  [200, {}, ["ok #{bodies.size}"]]
            Severity: Minor
            Found in test/test_puma_server.rb and 1 other location - About 30 mins to fix
            test/test_puma_server.rb on lines 340..350

            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 33.

            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 2 locations. Consider refactoring.
            Open

              def test_immediate_pipeline_not_confused_for_body
                bodies = []
                server_run { |e|
                  bodies << e['rack.input'].read
                  [200, {}, ["ok #{bodies.size}"]]
            Severity: Minor
            Found in test/test_puma_server.rb and 1 other location - About 30 mins to fix
            test/test_puma_server.rb on lines 353..363

            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 33.

            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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

              def server_run(**options, &block)
                options[:log_writer]  ||= @log_writer
                options[:min_threads] ||= 1
                @server = Puma::Server.new block || @app, @events, options
                @port = (@server.add_tcp_listener @host, 0).addr[1]
            Severity: Minor
            Found in test/test_puma_server.rb and 1 other location - About 25 mins to fix
            test/test_puma_server_hijack.rb on lines 49..54

            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 31.

            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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                @ios.each do |io|
                  begin
                    io.close if io.respond_to?(:close) && !io.closed?
                    File.unlink io.path if io.is_a? File
                  rescue Errno::EBADF
            Severity: Minor
            Found in test/test_puma_server.rb and 1 other location - About 25 mins to fix
            test/test_puma_server_hijack.rb on lines 38..44

            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 31.

            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 2 locations. Consider refactoring.
            Open

              def test_supported_http_methods_no_match
                server_run(supported_http_methods: ['PROPFIND', 'PROPPATCH']) do |env|
                  body = [env['REQUEST_METHOD']]
                  [200, {}, body]
                end
            Severity: Minor
            Found in test/test_puma_server.rb and 1 other location - About 15 mins to fix
            test/test_puma_server.rb on lines 1835..1841

            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 26.

            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 2 locations. Consider refactoring.
            Open

              def test_supported_http_methods_match
                server_run(supported_http_methods: ['PROPFIND', 'PROPPATCH']) do |env|
                  body = [env['REQUEST_METHOD']]
                  [200, {}, body]
                end
            Severity: Minor
            Found in test/test_puma_server.rb and 1 other location - About 15 mins to fix
            test/test_puma_server.rb on lines 1844..1850

            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 26.

            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