XoopsModules25x/wfdownloads

View on GitHub
include/onupdate.php

Summary

Maintainability
F
4 days
Test Coverage

File onupdate.php has 541 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code
 which is considered copyrighted (c) material of the original comment or credit authors.
Severity: Major
Found in include/onupdate.php - About 1 day to fix

    Method update_tables_to_322 has 213 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function update_tables_to_322($module)
    {
        $dbupdater = new Wfdownloads\Dbupdater();
    
        // create wfdownloads_meta table
    Severity: Major
    Found in include/onupdate.php - About 1 day to fix

      Function xoops_module_update_wfdownloads has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
      Open

      function xoops_module_update_wfdownloads(XoopsModule $module, $previousVersion = null)
      {
          $moduleDirName      = basename(dirname(__DIR__));
          $moduleDirNameUpper = mb_strtoupper($moduleDirName);
      
      
      Severity: Minor
      Found in include/onupdate.php - About 1 day 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

      Method update_tables_to_323 has 131 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function update_tables_to_323(XoopsModule $module)
      {
          $dbupdater = new Wfdownloads\Dbupdater();
      
          // update wfdownloads_downloads table
      Severity: Major
      Found in include/onupdate.php - About 5 hrs to fix

        Method xoops_module_update_wfdownloads has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xoops_module_update_wfdownloads(XoopsModule $module, $previousVersion = null)
        {
            $moduleDirName      = basename(dirname(__DIR__));
            $moduleDirNameUpper = mb_strtoupper($moduleDirName);
        
        
        Severity: Major
        Found in include/onupdate.php - About 2 hrs to fix

          Function update_tables_to_322 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          function update_tables_to_322($module)
          {
              $dbupdater = new Wfdownloads\Dbupdater();
          
              // create wfdownloads_meta table
          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

          Method invert_nohtm_dohtml_values has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function invert_nohtm_dohtml_values()
          {
              $ret               = [];
              $categoriesHandler = $helper->getHandler('Category');
              $result            = $GLOBALS['xoopsDB']->query('SHOW COLUMNS FROM ' . $categoriesHandler->table);
          Severity: Minor
          Found in include/onupdate.php - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                        if (is_file($templateFolder . $v)) {
                                            unlink($templateFolder . $v);
                                        }
            Severity: Major
            Found in include/onupdate.php - About 45 mins to fix

              Function get_table_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function get_table_info($table, $default_fields)
              {
                  $result = $GLOBALS['xoopsDB']->query('SHOW COLUMNS FROM ' . $table);
                  while (false !== ($existing_field = $GLOBALS['xoopsDB']->fetchArray($result))) {
                      $fields[$existing_field['Field']] = $existing_field['Type'];
              Severity: Minor
              Found in include/onupdate.php - About 35 mins 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

              Function update_permissions_to_323 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function update_permissions_to_323(XoopsModule $module)
              {
                  /** @var \XoopsGroupPermHandler $grouppermHandler */
                  $grouppermHandler = xoops_getHandler('groupperm');
                  /** @var Wfdownloads\CategoryHandler $categoriesHandler */
              Severity: Minor
              Found in include/onupdate.php - About 35 mins 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

              There are no issues that match your filters.

              Category
              Status