kaspernj/php_process

View on GitHub

Showing 24 of 26 total issues

Avoid too many return statements within this method.
Open

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

    Function unset_ids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      function unset_ids($id, $args){
        foreach($args["ids"] as $obj_id){
          if (!array_key_exists($obj_id, $this->objects)){
            continue;
          }
    Severity: Minor
    Found in lib/php_process/php_script.php - 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 check_for_special has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def check_for_special(str)
        if str =~ /^(PHP |)Fatal error: (.+)\s*/
          $stderr.puts "Fatal error detected: #{str}" if @debug
          @fatal = str.strip
          check_alive
    Severity: Minor
    Found in lib/php_process/communicator.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 check_alive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def check_alive
        if @fatal
          message = @fatal
          @fatal = nil
          error = ::PhpProcess::FatalError.new(message)
    Severity: Minor
    Found in lib/php_process/communicator.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