test/test_thread_pool.rb
File test_thread_pool.rb
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require_relative "helper"
require "puma/thread_pool"
class TestThreadPool < Minitest::Test
Class TestThreadPool
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class TestThreadPool < Minitest::Test
def teardown
@pool.shutdown(1) if defined?(@pool)
end
Method test_thread_name_linux
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def test_thread_name_linux
skip 'Thread.name not supported' unless Thread.current.respond_to?(:name)
task_dir = File.join('', 'proc', Process.pid.to_s, 'task')
skip 'This test only works under Linux and MRI Ruby with appropriate permissions' if !(File.directory?(task_dir) && File.readable?(task_dir) && Puma::IS_MRI)
- Read upRead up
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"