Showing 334 of 371 total issues
Function gh_fsck_file
has a Cognitive Complexity of 489 (exceeds 5 allowed). Consider refactoring. Open
public function gh_fsck_file($path, $filename, $file_type, $source, $share, $storage_path = FALSE, $num_retries = 1) {
$landing_zone = get_share_landing_zone($share);
if($storage_path === FALSE) {
$file_path = trim(mb_substr($path, mb_strlen($landing_zone)+1), '/');
}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
Function gh_check_md5
has a Cognitive Complexity of 179 (exceeds 5 allowed). Consider refactoring. 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
Function choose_target_drives
has a Cognitive Complexity of 164 (exceeds 5 allowed). Consider refactoring. Open
public static function choose_target_drives($filesize_kb, $include_full_drives, $share, $path, $log_prefix = '', &$is_sticky = NULL) {
global $last_OOS_notification;
foreach (SharesConfig::get($share, CONFIG_DRIVE_SELECTION_ALGORITHM) as $ds) {
$algo = $ds->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 scripts.js
has 1209 lines of code (exceeds 250 allowed). Consider refactoring. Open
window.chartColors = {
red: 'rgba(222, 66, 91, 1)',
orange: 'rgba(255, 159, 64, 1)',
yellow: 'rgba(255, 236, 152, 1)',
Function execute
has a Cognitive Complexity of 125 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$this->fix_symlinks_scanned_dirs = [];
$share = $this->share;
$full_path = $this->full_path;
- 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_samba_spool
has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring. 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 gh_fsck_file
has 440 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function gh_fsck_file($path, $filename, $file_type, $source, $share, $storage_path = FALSE, $num_retries = 1) {
$landing_zone = get_share_landing_zone($share);
if($storage_path === FALSE) {
$file_path = trim(mb_substr($path, mb_strlen($landing_zone)+1), '/');
}else{
File common.php
has 797 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
Copyright 2009-2020 Guillaume Boudreau, Andrew Hopkinson
This file is part of Greyhole.
Function getopt
has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring. Open
protected function getopt($short_options, $long_options) {
$opts_no_value = array();
$opts_required_value = array();
$opts_optional_value = array();
- 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 execute
has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$share = $this->share;
$full_path = $this->full_path;
$task_id = $this->id;
- 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 change_config
has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring. Open
public static function change_config($name, $value, $log_fct, &$error = NULL) {
if (empty($log_fct)) {
$log_fct = function($log) { error_log($log); };
}
- 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 FsckTask.php
has 710 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
Copyright 2009-2020 Guillaume Boudreau
This file is part of Greyhole.
Function get_config_html
has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring. Open
function get_config_html($config, $current_value = NULL, $fixed_width_label = TRUE) {
$config = (object) $config;
$html = '';
if ($config->type == 'group') {
$html .= "<div class='input_group mt-4'>";
- 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 ConfigHelper.php
has 649 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
Copyright 2014-2017 Guillaume Boudreau
This file is part of Greyhole.
File init.inc.php
has 631 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
Copyright 2020 Guillaume Boudreau
This file is part of Greyhole.
Function init
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
private static function init() {
Log::setLevel(Config::get(CONFIG_LOG_LEVEL));
self::$df_command = "df -k";
foreach (Config::storagePoolDrives() as $sp_drive) {
- 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 inject_in_file
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
function inject_in_file($file, $level=0) {
global $require_once_already_included;
$file_content = file_get_contents($file);
$new_content = '';
- 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 get_metafiles_for_file
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
public static function get_metafiles_for_file($share, $path, $filename=NULL, $load_nok_metafiles=FALSE, $quiet=FALSE, $check_symlink=TRUE) {
if (!$quiet) {
Log::debug("Loading metafiles for " . clean_dir($share . (!empty($path) ? "/$path" : "") . "/$filename") . ' ...');
}
$metafiles_data_file = static::get_metafile_data_filename($share, $path, $filename);
- 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 test_cases.php
has 614 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/php
<?php
/*
Copyright 2010-2020 Guillaume Boudreau
Function check_drives
has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring. Open
public static function check_drives() {
Log::setAction(ACTION_CHECK_POOL);
// If last 'df' ran less than 10s ago, all the drives are already awake; no harm checking them at this time.
global $last_df_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"