Function draft
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function draft() {
$drives = array();
$drives_last_resort = array();
while (count($drives)<$this->num_drives_per_draft) {
- 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
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
static function parse($config_string, $drive_selection_groups) {
$ds = array();
if ($config_string == 'least_used_space' || $config_string == 'most_available_space') {
$ds[] = new PoolDriveSelector(count(Config::storagePoolDrives()), $config_string, Config::storagePoolDrives(), FALSE, 'all', 'all');
return $ds;
- 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 init
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function init(&$sorted_target_drives, &$last_resort_sorted_target_drives) {
// Sort by used space (asc) for least_used_space, or by available space (desc) for most_available_space
if ($this->selection_algorithm == 'least_used_space') {
$sorted_target_drives = $sorted_target_drives['used_space'];
$last_resort_sorted_target_drives = $last_resort_sorted_target_drives['used_space'];
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function __construct($num_drives_per_draft, $selection_algorithm, $drives, $is_forced, $group_name, $num_drives_config) {