dcadenas/preforker

View on GitHub

Showing 7 of 7 total issues

Method start_signal_loop has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def start_signal_loop
      last_check = Time.now
      begin
        loop do
          @master.reap_all_workers
Severity: Minor
Found in lib/preforker/signal_processor.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 set_pid_path has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def set_pid_path(new_pid_path, new_pid)
      if new_pid_path
        if read_pid = read_path_pid(new_pid_path)
          return new_pid_path if @pid_path && new_pid_path == @pid_path && read_pid == @pid
          raise ArgumentError, "#{$$} Already running on PID:#{read_pid} (or #{new_pid_path} is stale)"
Severity: Minor
Found in lib/preforker/pid_manager.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 start_signal_loop has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def start_signal_loop
      last_check = Time.now
      begin
        loop do
          @master.reap_all_workers
Severity: Minor
Found in lib/preforker/signal_processor.rb - About 1 hr to fix

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

      def reap_all_workers
        begin
          loop do
            worker_pid, status = Process.waitpid2(-1, Process::WNOHANG)
            break unless worker_pid
    Severity: Minor
    Found in lib/preforker.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def run(ready_write = nil)
        $stdin.reopen("/dev/null")
        set_stdout_path(@options[:stdout_path])
        set_stderr_path(@options[:stderr_path])
    
    
    Severity: Minor
    Found in lib/preforker.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

    Method sleep_master has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def sleep_master
          begin
            maximum_sleep = @master.timeout > 1 ? 1 : @master.timeout / 2
            ready = IO.select([@read_pipe], nil, nil, maximum_sleep) or return
            ready.first && ready.first.first or return
    Severity: Minor
    Found in lib/preforker/signal_processor.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

    Method murder_lazy_workers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def murder_lazy_workers
        @workers.dup.each_pair do |worker_pid, worker|
          stat = worker.tmp.stat
          # skip workers that disable fchmod or have never fchmod-ed
          next if stat.mode == 0100600
    Severity: Minor
    Found in lib/preforker.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

    Severity
    Category
    Status
    Source
    Language