Showing 26 of 26 total issues
File php_script.php
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env php5
<?php
//Controls the PHP-process on the PHP-side.
class php_process{
php_process
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class php_process{
private $errortypes = array (
E_ERROR => 'Error',
E_WARNING => 'Warning',
E_PARSE => 'Parsing Error',
Method read_loop
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def read_loop
@stdout.each_line do |line|
parsed = parse_line(line.to_s.strip)
next if parsed == :next
id = parsed[:id]
- Read upRead up
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
Function parse_data
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function parse_data($data){
if (is_array($data)){
foreach($data as $key => $val){
if (is_object($val)){
$data[$key] = $this->parse_data($val);
- Read upRead up
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
Function func
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function func($id, $args){
//These functions cant be called normally. Hack them with eval instead.
$newargs = $this->read_parsed_data($args["args"]);
if (in_array($args["func_name"], $this->func_specials)){
- Read upRead up
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 read_parsed_data
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def read_parsed_data(data)
if data.is_a?(Array) && data.length == 2 && data[0] == "proxyobj"
id = data[1].to_i
if (proxy_obj = @objects_handler.find_by_id(id))
- Read upRead up
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 read_loop
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def read_loop
@stderr.each_line do |str|
@args[:on_err].call(str) if @args[:on_err]
$stderr.print "Process error: #{str}" if @debug || @args[:debug_stderr]
@communicator.__send__(:check_for_special, str.to_s)
- Read upRead up
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 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"
]
- Read upRead up
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 wait_for_and_read_response
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def wait_for_and_read_response(id)
$stderr.print "php_process: Waiting for answer to ID: #{id}\n" if @debug
check_alive
begin
- Read upRead up
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
Function handle_line
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function handle_line($line){
$data = explode(":", $line);
$type = $data[0];
$id = intval($data[1]);
$args = unserialize(base64_decode($data[2]));
- Read upRead up
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_line
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handle_line($line){
$data = explode(":", $line);
$type = $data[0];
$id = intval($data[1]);
$args = unserialize(base64_decode($data[2]));
Method parse_line
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_line(line)
if line.empty? || @stdout.closed?
$stderr.puts "Got empty line from process - skipping: #{line}" if @debug
return :next
end
- Read upRead up
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
- Read upRead up
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_error_reader_thread
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def start_error_reader_thread
@err_thread = Thread.new do
begin
read_loop
$stderr.puts "stderr thread died!" if @debug
- Read upRead up
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
Function read_parsed_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function read_parsed_data($data){
if (is_array($data) and array_key_exists("type", $data) and $data["type"] == "proxyobj" and array_key_exists("id", $data)){
$object = $this->objects[$data["id"]]["obj"];
if (!$object){
throw new exception("No object by that ID: " . $data["id"]);
- Read upRead up
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_read_loop
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def start_read_loop
@thread = Thread.new do
begin
read_loop
$stderr.puts "php_process: Read-loop stopped." if @debug
- Read upRead up
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 error_handler
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function error_handler($error_number, $error_message, $file_name, $line_number, $vars, $args = null){
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?
- Read upRead up
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]}
- Read upRead up
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 flush_unset_ids
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def flush_unset_ids(force = false)
return nil if @php_process.destroyed? || (!force && @object_unset_ids.length < 500)
while @object_unset_ids.length > 0 && (elements = @object_unset_ids.shift(500))
$stderr.print "Sending unsets: #{elements}\n" if @debug
@communicator.__send__(:communicate_real, "type" => "unset_ids", "ids" => elements)
- Read upRead up
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"