Showing 103 of 103 total issues
Method updateBlock
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups): void
{
$myblock = new XoopsBlock($bid);
$myblock->setVar('title', $btitle);
$myblock->setVar('weight', $bweight);
Method b_marquee_smartpartner
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_marquee_smartpartner($limit, $dateFormat, $itemsSize)
{
$block = $newObjects = [];
if (!defined('SMARTPARTNER_DIRNAME')) {
define('SMARTPARTNER_DIRNAME', 'smartpartner');
Function b_marquee_catads
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function b_marquee_catads($limit, $dateFormat, $itemsSize)
{
global $xoopsModule, $xoopsModuleConfig, $xoopsDB;
// require_once XOOPS_ROOT_PATH . '/modules/catads/class/cat.php';
$block = [];
- 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 _getInnerSize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
XbMarquee._getInnerSize = function (elm, propName) {
var val = 0;
if (document.layers) {
// navigator 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 checkVerModule
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array
{
$moduleDirName = \basename(\dirname(__DIR__, 2));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
$update = '';
Method cloneBlock
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function cloneBlock($bid): void
{
xoops_cp_header();
$adminObject = Admin::getInstance();
$adminObject->displayNavigation(basename(__FILE__));
Method b_marquee_smartfaq
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_marquee_smartfaq($limit, $dateFormat, $itemsSize)
{
require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
$block = [];
$smartModule = &sf_getModuleInfo();
Method b_marquee_wfdownloads
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_marquee_wfdownloads($limit, $dateFormat, $itemsSize)
{
$block = [];
global $xoopsUser;
/** @var \XoopsModuleHandler $moduleHandler */
Function b_marquee_xfsection
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function b_marquee_xfsection($limit, $dateFormat, $itemsSize)
{
$block = [];
global $xoopsDB;
if (!function_exists('xfblock_checkAccess')) {
- 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 loadTableFromArrayWithReplace
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function loadTableFromArrayWithReplace($table, $data, $search, $replace)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
- 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 editBlock
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function editBlock($bid): void
{
xoops_cp_header();
$adminObject = Admin::getInstance();
$adminObject->displayNavigation(basename(__FILE__));
Method b_marquee_wfsection
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_marquee_wfsection($limit, $dateFormat, $itemsSize)
{
// require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
$block = [];
$myts = \MyTextSanitizer::getInstance();
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function metaDescription($content): void
{
global $xoopsTpl, $xoTheme;
$myts = \MyTextSanitizer::getInstance();
$content = $myts->undoHtmlSpecialChars($myts->displayTarea($content));
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 109.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function metaKeywords($content): void
{
global $xoopsTpl, $xoTheme;
$myts = \MyTextSanitizer::getInstance();
$content = $myts->undoHtmlSpecialChars($myts->displayTarea($content));
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 109.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function marquee_getmoduleoption
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function marquee_getmoduleoption($option, $repmodule = 'marquee')
{
global $xoopsModuleConfig, $xoopsModule;
static $tbloptions = [];
if (is_array($tbloptions) && array_key_exists($option, $tbloptions)) {
- 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 b_marquee_mydownloads
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_marquee_mydownloads($limit, $dateFormat, $itemsSize)
{
// require_once XOOPS_ROOT_PATH . '/modules/marquee/class/Utility.php';
require XOOPS_ROOT_PATH . '/include/comment_constants.php';
$block = [];
Method b_marquee_xfsection
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_marquee_xfsection($limit, $dateFormat, $itemsSize)
{
$block = [];
global $xoopsDB;
if (!function_exists('xfblock_checkAccess')) {
Method getServerStats
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getServerStats()
{
//mb $wfdownloads = WfdownloadsWfdownloads::getInstance();
$moduleDirName = \basename(\dirname(__DIR__, 2));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
Function getModuleOption
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function getModuleOption($option, $repmodule = 'marquee')
{
global $xoopsModule;
$helper = Helper::getInstance();
static $tbloptions = [];
- 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 xoops_module_update_marquee
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function xoops_module_update_marquee(\XoopsObject $module, $oldversion = null)
{
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$sql = 'ALTER TABLE `' . $db->prefix('marquee') . "` MODIFY `marquee_bgcolor` VARCHAR(7) NOT NULL DEFAULT '';";
$db->query($sql);
- 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"