includes/SambaSpool.php
Function parse_samba_spool
has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function parse_samba_spool() {
Log::setAction(ACTION_READ_SAMBA_POOL);
$db_spool = DBSpool::getInstance();
- 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_samba_spool
has 197 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function parse_samba_spool() {
Log::setAction(ACTION_READ_SAMBA_POOL);
$db_spool = DBSpool::getInstance();
Function create_mem_spool
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function create_mem_spool() {
$mounted_already = exec('mount | grep /var/spool/greyhole/mem | wc -l');
if (!$mounted_already && file_exists('/var/spool/greyhole/mem')) {
// In Docker, mount doesn't list mounts... need to check using df instead:
exec("cat /proc/1/sched | grep supervisord", $output, $result);
- 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
Avoid too many return
statements within this method. Open
Open
return 1;
Avoid too many return
statements within this method. Open
Open
return 0;
Avoid too many return
statements within this method. Open
Open
return -1;
Avoid too many return
statements within this method. Open
Open
return $is_file1_write ? 1 : -1; // open before write
Avoid too many return
statements within this method. Open
Open
return -1;
Avoid too many return
statements within this method. Open
Open
return 0;
Avoid too many return
statements within this method. Open
Open
return $is_file1_write ? -1 : 1; // close after write
Avoid too many return
statements within this method. Open
Open
return 1;
Avoid too many return
statements within this method. Open
Open
return 1;