web-app/functions.inc.php
Function get_config_html
has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring. Open
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
Method get_config_html
has 161 lines of code (exceeds 25 allowed). Consider refactoring. Open
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'>";
File functions.inc.php
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/*
Copyright 2020 Guillaume Boudreau
This file is part of Greyhole.
Function get_new_share_defaults
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
function get_new_share_defaults($all_samba_shares) {
// Default path for new share: find the most-used path in existing shares
$prefixes = [];
$prefix_shares = [];
$options = [];
- 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 get_new_share_defaults
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function get_new_share_defaults($all_samba_shares) {
// Default path for new share: find the most-used path in existing shares
$prefixes = [];
$prefix_shares = [];
$options = [];