lib/puma/launcher.rb

Summary

Maintainability
D
2 days
Test Coverage

Class Launcher has 34 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Launcher
    autoload :BundlePruner, 'puma/launcher/bundle_pruner'

    # Returns an instance of Launcher
    #
Severity: Minor
Found in lib/puma/launcher.rb - About 4 hrs to fix

    File launcher.rb has 331 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_relative 'log_writer'
    require_relative 'events'
    require_relative 'detect'
    require_relative 'cluster'
    require_relative 'single'
    Severity: Minor
    Found in lib/puma/launcher.rb - About 3 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
              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

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

            def initialize(conf, launcher_args={})
              @runner        = nil
              @log_writer    = launcher_args[:log_writer] || LogWriter::DEFAULT
              @events        = launcher_args[:events] || Events.new
              @argv          = launcher_args[:argv] || []
        Severity: Minor
        Found in lib/puma/launcher.rb - About 1 hr to fix

          Method initialize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def initialize(conf, launcher_args={})
                @runner        = nil
                @log_writer    = launcher_args[:log_writer] || LogWriter::DEFAULT
                @events        = launcher_args[:events] || Events.new
                @argv          = launcher_args[:argv] || []
          Severity: Minor
          Found in lib/puma/launcher.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 generate_restart_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def generate_restart_data
                if dir = @options[:directory]
                  @restart_dir = dir
          
                elsif Puma.windows?
          Severity: Minor
          Found in lib/puma/launcher.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_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def thread_status
                Thread.list.each do |thread|
                  name = "Thread: TID-#{thread.object_id.to_s(36)}"
                  name += " #{thread['label']}" if thread['label']
                  name += " #{thread.name}" if thread.respond_to?(:name) && thread.name
          Severity: Minor
          Found in lib/puma/launcher.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