cloudfoundry/warden

View on GitHub
em-posix-spawn/lib/em/posix/spawn/child.rb

Summary

Maintainability
C
1 day
Test Coverage

Method exec! has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

        def exec!
          # The signal handler MUST be installed before spawning a new process
          SignalHandler.setup!

          if RUBY_PLATFORM =~ /linux/i && @options.delete(:close_others)
Severity: Minor
Found in em-posix-spawn/lib/em/posix/spawn/child.rb - About 3 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

File child.rb has 305 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'eventmachine'
require 'posix/spawn'

module EventMachine

Severity: Minor
Found in em-posix-spawn/lib/em/posix/spawn/child.rb - About 3 hrs to fix

    Method exec! has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def exec!
              # The signal handler MUST be installed before spawning a new process
              SignalHandler.setup!
    
              if RUBY_PLATFORM =~ /linux/i && @options.delete(:close_others)
    Severity: Major
    Found in em-posix-spawn/lib/em/posix/spawn/child.rb - About 2 hrs to fix

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

                def setup!
                  @pipe = ::IO.pipe
                  @notifier = ::EM.watch @pipe[0], SignalNotifier, self
                  @notifier.notify_readable = true
      
      
      Severity: Minor
      Found in em-posix-spawn/lib/em/posix/spawn/child.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 signal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

                def signal
                  # The SIGCHLD handler may not be called exactly once for every
                  # child. I.e., multiple children exiting concurrently may trigger
                  # only one SIGCHLD in the parent. Therefore, reap all processes
                  # that can be reaped.
      Severity: Minor
      Found in em-posix-spawn/lib/em/posix/spawn/child.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