includes/Tasks/Md5Task.php
Function gh_check_md5
has a Cognitive Complexity of 179 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function gh_check_md5($task) {
/** @var $task AbstractTask */
$share_options = SharesConfig::getConfigForShare($task->share);
$query = "SELECT complete, COUNT(*) AS num, GROUP_CONCAT(id) AS ids FROM tasks WHERE action = 'md5' AND share = :share AND full_path = :full_path GROUP BY complete ORDER BY complete";
- 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 gh_check_md5
has 173 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function gh_check_md5($task) {
/** @var $task AbstractTask */
$share_options = SharesConfig::getConfigForShare($task->share);
$query = "SELECT complete, COUNT(*) AS num, GROUP_CONCAT(id) AS ids FROM tasks WHERE action = 'md5' AND share = :share AND full_path = :full_path GROUP BY complete ORDER BY complete";
Function spawn_threads_for_pool_drives
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function spawn_threads_for_pool_drives() {
$checksums_thread_ids = array();
foreach (Config::storagePoolDrives() as $sp_drive) {
if (StoragePool::is_pool_drive($sp_drive)) {
$already_running = (int) trim(exec("ps x | grep '/usr/bin/greyhole --md5-worker --drive=$sp_drive' | grep -v grep | grep -v bash | wc -l"));
- 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"