Showing 334 of 371 total issues
Function loadStatusBalanceReport
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
function loadStatusBalanceReport() {
let $container = $('#balance_groups');
$.ajax({
type: 'POST',
url: './?ajax=get_status_balance_report',
- 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 drawPieChartStorage
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
function drawPieChartStorage(ctx, stats) {
let dataset_used = [];
let dataset_trash = [];
let dataset_free = [];
let drives = [];
Method execute
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$new_conf_hash = static::get_conf_hash();
if ($this->has_option(OPTION_IF_CONF_CHANGED)) {
// Let's check if the conf file changed since the last fsck
Function get_email_body
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function get_email_body($include_trash_size) {
if (empty($this->end)) {
$this->end = time();
}
- 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 close_task
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function close_task($act, $share, $fd, $fullpath, &$tasks) {
if (!empty($fullpath)) {
$prop = 'full_path';
$prop_value = $fullpath;
} else {
- 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 getopt
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getopt($short_options, $long_options) {
$opts_no_value = array();
$opts_required_value = array();
$opts_optional_value = array();
File StorageFile.php
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
Copyright 2009-2020 Guillaume Boudreau
This file is part of Greyhole.
Function choose_metastores_backups
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public static function choose_metastores_backups($try_restore=TRUE) {
$num_metastore_backups_needed = 2;
if (count(Config::storagePoolDrives()) < 2) {
Config::set(CONFIG_METASTORE_BACKUPS, array());
return;
- 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
File config_definitions.inc.php
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
$configs = [];
global $licensed;
Method create_file_copy
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function create_file_copy($source_file, &$destination_file, $expected_md5 = NULL, &$error = NULL) {
if (gh_is_file($source_file) && $source_file == $destination_file) {
Log::debug(" Destination $destination_file is the same as the source. Nothing to do here; this file copy is ready!");
return TRUE;
}
Function parse
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public static function parse() {
if (!ini_get('date.timezone')) {
// To prevent warnings that would be logged if something gets logged before the timezone setting is parsed and applied.
date_default_timezone_set('UTC');
}
- 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 getData
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public static function getData() {
$groups = [];
/** @var $drives_selectors PoolDriveSelector[] */
$drives_selectors = Config::get(CONFIG_DRIVE_SELECTION_ALGORITHM);
- 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
File trash.php
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
Copyright 2020 Guillaume Boudreau
This file is part of Greyhole.
Function loadStatusQueue
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function loadStatusQueue() {
var $table = $('#queue');
var $loading_row = $table.find('.loading');
$loading_row.show();
$.ajax({
- 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 create_file_copies
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function create_file_copies($source_file, &$metafiles) {
$copy_results = [];
$copy_source = is_link($source_file) ? readlink($source_file) : $source_file;
$source_size = gh_filesize($copy_source);
File CommandLineHelper.php
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
Copyright 2009-2020 Guillaume Boudreau
This file is part of Greyhole.
Function run
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function run() {
Log::setAction(ACTION_INITIALIZE);
Metastores::choose_metastores_backups();
Log::setAction(ACTION_MOVE);
- 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 is_pool_drive
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static function is_pool_drive($sp_drive) {
global $going_drive;
if (isset($going_drive) && $sp_drive == $going_drive) {
return FALSE;
}
- 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 _log
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function _log($local_log_level, $text, $event_code) {
if (self::$action == 'test-config' || self::$action == ACTION_CP) {
$greyhole_log_file = NULL;
$use_syslog = FALSE;
if (self::$action == ACTION_CP && $local_log_level > self::$level) {
Function drawTreeMapDiskUsage
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
function drawTreeMapDiskUsage(ctx, du_stats) {
let dataset = [];
let paths = [];
let max = 0, min = null;