XoopsModules25x/smallworld

View on GitHub
include/onupdate.php

Summary

Maintainability
A
3 hrs
Test Coverage

Method xoops_module_update_smallworld has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function xoops_module_update_smallworld(\XoopsModule $module)
{
    $tables = new \Xmf\Database\Tables();

    $cTable   = 'config';
Severity: Minor
Found in include/onupdate.php - About 1 hr to fix

    Function xoops_module_update_smallworld has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    function xoops_module_update_smallworld(\XoopsModule $module)
    {
        $tables = new \Xmf\Database\Tables();
    
        $cTable   = 'config';
    Severity: Minor
    Found in include/onupdate.php - About 1 hr to fix

    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

    Consider simplifying this complex logical expression.
    Open

        if (false === ($successC = $tables->useTable($sTable))) { // if this returns true then the table exists already
            // Table does not exist -> create
            $successC = $tables->addTable($sTable);
            $successC = $successC && ($tables->setTableOptions($sTable, 'ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1'));
            $successC = $successC && ($tables->addColumn($sTable, 'id', 'INT(11) NOT NULL AUTO_INCREMENT'));
    Severity: Major
    Found in include/onupdate.php - About 40 mins to fix

      There are no issues that match your filters.

      Category
      Status