XoopsModules25x/about

View on GitHub

Showing 45 of 434 total issues

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

function xoops_module_update_about(\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

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

    public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
    {
        if ($considerHtml) {
            // if the plain text is shorter than the maximum length, return the whole text
            if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
Severity: Minor
Found in class/Common/SysUtility.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

Function treeview has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        treeview: function(settings) {

            settings = $.extend({
                cookieId: "treeview"
            }, settings);
Severity: Major
Found in assets/js/jquery-treeview/jquery.treeview.js - About 4 hrs to fix

    Function getAllChildArray has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

            public function getAllChildArray($key, &$ret, $tags = [], $depth = 0)
            {
                if (0 == --$depth) {
                    return;
                }
    Severity: Minor
    Found in class/Tree.php - About 3 hrs 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 checkVerModule has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function checkVerModule($helper, $source = 'github', $default = 'master')
        {
            $moduleDirName      = \basename(dirname(__DIR__, 2));
            $moduleDirNameUpper = mb_strtoupper($moduleDirName);
            $update             = '';
    Severity: Minor
    Found in class/Common/VersionChecks.php - About 2 hrs 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 truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
        {
            if ($considerHtml) {
                // if the plain text is shorter than the maximum length, return the whole text
                if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
    Severity: Major
    Found in class/Common/SysUtility.php - About 2 hrs to fix

      Function deleteDirectory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function deleteDirectory($src)
          {
              // Only continue if user is a 'global' Admin
              if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                  return false;
      Severity: Minor
      Found in class/Common/FilesManagement.php - About 2 hrs 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 makeTreeItems has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

              public function makeTreeItems($key, &$ret, $prefix_orig, $prefix_curr = '', $tags = null)
              {
                  if ($key > 0) {
                      if ($tags && \is_array($tags)) {
                          foreach ($tags as $tag) {
      Severity: Minor
      Found in class/Tree.php - About 2 hrs 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 xoops_module_update_about has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xoops_module_update_about(\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 xoops_module_update_about has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        function xoops_module_update_about(\XoopsModule $module, $prev_version = null)
        {
            $success = true;
            // Delete files from previous version (if they exist)
            $oldFiles = [
        Severity: Minor
        Found in include/action.module.php - About 2 hrs 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 template_lookup has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function &template_lookup($index_by_page = false)
            {
                require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
        
                $files = \XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['artdirname'] . '/templates/');
        Severity: Minor
        Found in class/Utility.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 checkVerModule has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function checkVerModule($helper, $source = 'github', $default = 'master')
            {
                $moduleDirName      = \basename(dirname(__DIR__, 2));
                $moduleDirNameUpper = mb_strtoupper($moduleDirName);
                $update             = '';
        Severity: Minor
        Found in class/Common/VersionChecks.php - About 1 hr to fix

          Function getBread has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getBread(array $pages = [], $key = 0)
              {
                  if (!\is_array($pages) || 0 === \count($pages)) {
                      return false;
                  }
          Severity: Minor
          Found in class/PageHandler.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 xoops_module_update_about has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function xoops_module_update_about(\XoopsModule $module, $prev_version = null)
          {
              $success = true;
              // Delete files from previous version (if they exist)
              $oldFiles = [
          Severity: Minor
          Found in include/action.module.php - About 1 hr to fix

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

                public static function rrmdir($src)
                {
                    // Only continue if user is a 'global' Admin
                    if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                        return false;
            Severity: Minor
            Found in class/Common/FilesManagement.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 xoops_module_install_about has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function xoops_module_install_about(\XoopsModule $module)
            {
                require_once dirname(__DIR__, 3) . '/mainfile.php';
            
                $moduleDirName = basename(dirname(__DIR__));
            Severity: Minor
            Found in include/oninstall.php - About 1 hr to fix

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

                  public static function getServerStats()
                  {
                      $moduleDirName      = \basename(dirname(__DIR__, 2));
                      $moduleDirNameUpper = mb_strtoupper($moduleDirName);
                      \xoops_loadLanguage('common', $moduleDirName);
              Severity: Minor
              Found in class/Common/ServerStats.php - About 1 hr to fix

                Function xoops_module_install_about has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                function xoops_module_install_about(\XoopsModule $module)
                {
                    $success   = true;
                    $data_file = XOOPS_ROOT_PATH . '/modules/about/sql/mysql.about.sql';
                    $GLOBALS['xoopsDB']->queryF('SET NAMES utf8');
                Severity: Minor
                Found in include/action.module.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 xoops_module_install_about has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function xoops_module_install_about(\XoopsModule $module)
                {
                    $success   = true;
                    $data_file = XOOPS_ROOT_PATH . '/modules/about/sql/mysql.about.sql';
                    $GLOBALS['xoopsDB']->queryF('SET NAMES utf8');
                Severity: Minor
                Found in include/action.module.php - About 1 hr to fix

                  Method about_block_page_edit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function about_block_page_edit($options)
                  {
                      $moduleDirName = basename(dirname(__DIR__));
                      $helper       = Helper::getInstance();
                      $options_page = [];
                  Severity: Minor
                  Found in blocks/blocks.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language