Showing 334 of 371 total issues
Avoid deeply nested control flow statements. Open
Open
if (empty($file_path)) {
$expected_md5 = DB::getFirstValue($q, ['share' => $share, 'full_path' => $filename]);
}
Avoid deeply nested control flow statements. Open
Open
if (isset($this->metafiles[$full_filename])) {
continue;
}
Avoid deeply nested control flow statements. Open
Open
if ($file=='.' || $file=='..') {
continue;
}
Avoid deeply nested control flow statements. Open
Open
if (file_exists($path_to_delete)) {
$rm_command = "rm -rf " . escapeshellarg($path_to_delete);
error_log($rm_command);
exec($rm_command);
Avoid deeply nested control flow statements. Open
Open
} else if (empty($metafile->is_linked) && $metafile->path == $share_file_link_to) {
if (!$quiet) {
Log::debug(' Changing is_linked to TRUE for ' . $metafile->path);
}
$metafile->is_linked = TRUE;
Avoid deeply nested control flow statements. Open
Open
if ($return_var) {
$output = implode(" ", $output);
echo json_encode(['result' => 'error', 'message' => "Error: UNIX user doesn't not exist, and failed to create ($output).\nYou can only create Samba users for existing UNIX users."]);
}
Avoid deeply nested control flow statements. Open
Open
if (!$quiet) {
Log::debug(' Changing is_linked to FALSE for ' . $metafile->path);
}
Avoid deeply nested control flow statements. Open
Open
if (!is_dir($v)) {
echo json_encode(['result' => 'error', 'message' => "Specified dir not found: " . $v]);
exit();
}
Method close_task
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function close_task($act, $share, $fd, $fullpath, &$tasks) {
Method get_file_copies_inodes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function get_file_copies_inodes($share, $file_path, $filename, &$file_metafiles, $one_is_enough = FALSE) {
Method create_file_copies_from_metafiles
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function create_file_copies_from_metafiles($metafiles, $share, $full_path, $source_file, $missing_only = FALSE) {
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function __construct($share, $path, $load_nok_metafiles=FALSE, $quiet=FALSE, $check_symlink=TRUE) {
Method gh_error_handler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function gh_error_handler($errno, $errstr, $errfile, $errline, $errcontext = NULL) {
Method insert
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function insert($action, $share, $full_path, $additional_info, $fd) {
Method update_symlink
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private function update_symlink($target, $symlink, $share, $file_path, $filename) {
Method create_metafiles
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function create_metafiles($share, $full_path, $num_copies_required, $filesize, $metafiles=[]) {
Method _queue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
protected static function _queue($action, $share, $full_path, $additional_info, $complete) {
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function __construct($longOpt, $opt, $paramName, $cliRunnerClass, $help) {
Function bytes_to_human
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function bytes_to_human(bytes) {
let units = 'B';
if (Math.abs(bytes) > 1024) {
bytes /= 1024;
units = 'KiB';
- 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 migrate_18_full_path_utf8mb4
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
private static function migrate_18_full_path_utf8mb4() {
$q = "ALTER TABLE `checksums` CHANGE `full_path` `full_path` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL";
DB::execute($q);
$query = "DESCRIBE tasks";
- 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"