kaspernj/php_process

View on GitHub
lib/php_process.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method php_cmd_as_string has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def php_cmd_as_string
    bin_path_tries = [
      "/usr/bin/php5",
      "/usr/bin/php"
    ]
Severity: Minor
Found in lib/php_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 check_php_process_startup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def check_php_process_startup
    $stderr.print "Waiting for PHP-script to be ready.\n" if @debug
    started = false
    @stdout.each_line do |line|
      puts "Line: #{line}" if @debug
Severity: Minor
Found in lib/php_process.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 parse_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_data(data)
    if data.is_a?(PhpProcess::ProxyObject)
      return {type: :proxyobj, id: data.args[:id]}
    elsif data.is_a?(PhpProcess::CreatedFunction)
      return {type: :php_process_created_function, id: data.args[:id]}
Severity: Minor
Found in lib/php_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 destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy
    @destroyed = true
    @stdout.close if @stdout && !@stdout.closed?
    @stdin.close if @stdin && !@stdin.closed?
    @stderr.close if @stderr && !@stderr.closed?
Severity: Minor
Found in lib/php_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

Avoid too many return statements within this method.
Open

      return data
Severity: Major
Found in lib/php_process.rb - About 30 mins to fix

    There are no issues that match your filters.

    Category
    Status