enkessler/childprocess

View on GitHub

Showing 14 of 14 total issues

Method launch_process has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

      def launch_process
        if @io
          stdout = @io.stdout
          stderr = @io.stderr
        end
Severity: Minor
Found in lib/childprocess/unix/fork_exec_process.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 launch_process has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def launch_process
        pid_ptr = FFI::MemoryPointer.new(:pid_t)
        actions = Lib::FileActions.new
        attrs   = Lib::Attrs.new

Severity: Minor
Found in lib/childprocess/unix/posix_spawn_process.rb - About 1 hr to fix

    Method pump has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

          def pump
            buffer = Java.byte[BUFFER_SIZE].new
    
            until @stop && (@input.available == 0)
              read, avail = 0, 0
    Severity: Minor
    Found in lib/childprocess/jruby/pump.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 launch_process has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def launch_process
            if @io
              stdout = @io.stdout
              stderr = @io.stderr
            end
    Severity: Minor
    Found in lib/childprocess/unix/fork_exec_process.rb - About 1 hr to fix

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

            def launch_process
              pid_ptr = FFI::MemoryPointer.new(:pid_t)
              actions = Lib::FileActions.new
              attrs   = Lib::Attrs.new
      
      
      Severity: Minor
      Found in lib/childprocess/unix/posix_spawn_process.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 handle_for has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

              def handle_for(fd_or_io)
                if fd_or_io.kind_of?(IO) || fd_or_io.respond_to?(:fileno)
                  if ChildProcess.jruby?
                    handle = ChildProcess::JRuby.windows_handle_for(fd_or_io)
                  else
      Severity: Minor
      Found in lib/childprocess/windows/lib.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 posix_fileno_for has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.posix_fileno_for(obj)
            channel = ::JRuby.reference(obj).channel
            begin
              channel.getFDVal
            rescue NoMethodError
      Severity: Minor
      Found in lib/childprocess/jruby.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 posix_spawn? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def posix_spawn?
            enabled = @posix_spawn || %w[1 true].include?(ENV['CHILDPROCESS_POSIX_SPAWN'])
            return false unless enabled
      
            begin
      Severity: Minor
      Found in lib/childprocess.rb - About 55 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 create_environment_pointer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def create_environment_pointer
              return unless @environment.kind_of?(Hash) && @environment.any?
      
              strings = []
      
      
      Severity: Minor
      Found in lib/childprocess/windows/process_builder.rb - About 55 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 launch_process has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def launch_process
              builder = ProcessBuilder.new(@args)
              builder.leader      = leader?
              builder.detach      = detach?
              builder.duplex      = duplex?
      Severity: Minor
      Found in lib/childprocess/windows/process.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 close_on_exec has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def close_on_exec(file)
            if file.respond_to?(:close_on_exec=)
              file.close_on_exec = true
            elsif file.respond_to?(:fcntl) && defined?(Fcntl::FD_CLOEXEC)
              file.fcntl Fcntl::F_SETFD, Fcntl::FD_CLOEXEC
      Severity: Minor
      Found in lib/childprocess.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 exited? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def exited?
              return true if @exit_code
      
              assert_started
              pid, status = ::Process.waitpid2(@pid, ::Process::WNOHANG | ::Process::WUNTRACED)
      Severity: Minor
      Found in lib/childprocess/unix/process.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def initialize(env)
                @ptrs = env.map do |key, val|
                  next if val.nil?
      
                  if key =~ /=|\0/ || val.to_s.include?("\0")
      Severity: Minor
      Found in lib/childprocess/unix/posix_spawn_process.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def execute(src, opts)
              program = Array(opts[:define]).map do |key, value|
                <<-SRC
      #ifndef #{key}
      #define #{key} #{value}
      Severity: Minor
      Found in lib/childprocess/tools/generator.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