mambax7/moduleinstaller

View on GitHub

Showing 198 of 198 total issues

File prototype.js has 6104 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*  Prototype JavaScript framework, version 1.7.3
 *  (c) 2005-2010 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
Severity: Major
Found in assets/js/prototype.js - About 2 wks to fix

    Function xoops_module_update has a Cognitive Complexity of 320 (exceeds 5 allowed). Consider refactoring.
    Open

    function xoops_module_update($dirname)
    {
        global $xoopsUser, $xoopsConfig, $xoopsTpl;
        $dirname = trim($dirname);
        //    $xoopsDB = $GLOBALS['xoopsDB'];
    Severity: Minor
    Found in extras/modulesadmin.php - About 6 days 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 xoops_module_install has a Cognitive Complexity of 277 (exceeds 5 allowed). Consider refactoring.
    Open

    function xoops_module_install($dirname)
    {
        global $xoopsUser, $xoopsConfig;
        $dirname = trim($dirname);
        //    $db = $GLOBALS['xoopsDB'];
    Severity: Minor
    Found in extras/modulesadmin.php - About 5 days 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

    File modulesadmin.php has 1215 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php declare(strict_types=1);
    /*
     * 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 extras/modulesadmin.php - About 3 days to fix

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

          foreach ($dirlist as $file) {
              clearstatcache();
              if (in_array($file, $listed_mods, true)) {
                  $value = 0;
                  $style = '';
      Severity: Major
      Found in admin/uninstall.php and 2 other locations - About 2 days to fix
      admin/activate.php on lines 107..139
      admin/deactivate.php on lines 106..138

      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 474.

      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

      Further Reading

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

          foreach ($dirlist as $file) {
              clearstatcache();
              if (in_array($file, $listed_mods, true)) {
                  $value = 0;
                  $style = '';
      Severity: Major
      Found in admin/activate.php and 2 other locations - About 2 days to fix
      admin/deactivate.php on lines 106..138
      admin/uninstall.php on lines 98..130

      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 474.

      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

      Further Reading

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

          foreach ($dirlist as $file) {
              clearstatcache();
              if (in_array($file, $listed_mods, true)) {
                  $value = 0;
                  $style = '';
      Severity: Major
      Found in admin/deactivate.php and 2 other locations - About 2 days to fix
      admin/activate.php on lines 107..139
      admin/uninstall.php on lines 98..130

      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 474.

      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

      Further Reading

      Method xoops_module_install has 474 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xoops_module_install($dirname)
      {
          global $xoopsUser, $xoopsConfig;
          $dirname = trim($dirname);
          //    $db = $GLOBALS['xoopsDB'];
      Severity: Major
      Found in extras/modulesadmin.php - About 2 days to fix

        Method xoops_module_update has 440 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xoops_module_update($dirname)
        {
            global $xoopsUser, $xoopsConfig, $xoopsTpl;
            $dirname = trim($dirname);
            //    $xoopsDB = $GLOBALS['xoopsDB'];
        Severity: Major
        Found in extras/modulesadmin.php - About 2 days to fix

          Function xoops_module_uninstall has a Cognitive Complexity of 107 (exceeds 5 allowed). Consider refactoring.
          Open

          function xoops_module_uninstall($dirname)
          {
              global $xoopsConfig;
              $reservedTables = [
                  'avatar',
          Severity: Minor
          Found in extras/modulesadmin.php - About 2 days 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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  if (false !== $configs) {
                      if (0 != $module->getVar('hascomments')) {
                          require XOOPS_ROOT_PATH . '/include/comment_constants.php';
                          $configs[] = [
                              'name'        => 'com_rule',
          Severity: Major
          Found in extras/modulesadmin.php and 1 other location - About 1 day to fix
          extras/modulesadmin.php on lines 308..359

          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 309.

          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

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                      if (false !== $configs) {
                          if (0 != $module->getVar('hascomments')) {
                              require XOOPS_ROOT_PATH . '/include/comment_constants.php';
                              $configs[] = [
                                  'name'        => 'com_rule',
          Severity: Major
          Found in extras/modulesadmin.php and 1 other location - About 1 day to fix
          extras/modulesadmin.php on lines 1155..1206

          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 309.

          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

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          if ('POST' === $_SERVER['REQUEST_METHOD']) {
              require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
              require_once XOOPS_ROOT_PATH . '/kernel/module.php';
              require_once XOOPS_ROOT_PATH . '/include/cp_functions.php';
              require_once XOOPS_ROOT_PATH . '/include/version.php';
          Severity: Major
          Found in admin/deactivate.php and 1 other location - About 1 day to fix
          admin/activate.php on lines 42..146

          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 263.

          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

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          if ('POST' === $_SERVER['REQUEST_METHOD']) {
              require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
              require_once XOOPS_ROOT_PATH . '/kernel/module.php';
              require_once XOOPS_ROOT_PATH . '/include/cp_functions.php';
              require_once XOOPS_ROOT_PATH . '/include/version.php';
          Severity: Major
          Found in admin/activate.php and 1 other location - About 1 day to fix
          admin/deactivate.php on lines 42..145

          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 263.

          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

          Further Reading

          Function setDocument has 215 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              setDocument = Sizzle.setDocument = function (node) {
                  var hasCompare,
                      doc = node ? node.ownerDocument || node : preferredDoc,
                      parent = doc.defaultView;
          
          
          Severity: Major
          Found in assets/js/prototype.js - About 1 day to fix

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

            function xoops_module_update_moduleinstaller(\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 Enumerable has 206 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var Enumerable = (function () {
                function each(iterator, context) {
                    try {
                        this._each(iterator, context);
                    } catch (e) {
            Severity: Major
            Found in assets/js/prototype.js - About 1 day to fix

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              if ('POST' === $_SERVER['REQUEST_METHOD']) {
                  require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
                  require_once XOOPS_ROOT_PATH . '/kernel/module.php';
                  require_once XOOPS_ROOT_PATH . '/include/cp_functions.php';
                  require_once XOOPS_ROOT_PATH . '/include/version.php';
              Severity: Major
              Found in admin/update.php and 2 other locations - About 7 hrs to fix
              admin/install.php on lines 39..141
              admin/uninstall.php on lines 38..137

              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 236.

              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

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              if ('POST' === $_SERVER['REQUEST_METHOD']) {
                  require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
                  require_once XOOPS_ROOT_PATH . '/kernel/module.php';
                  require_once XOOPS_ROOT_PATH . '/include/cp_functions.php';
                  require_once XOOPS_ROOT_PATH . '/include/version.php';
              Severity: Major
              Found in admin/install.php and 2 other locations - About 7 hrs to fix
              admin/uninstall.php on lines 38..137
              admin/update.php on lines 70..175

              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 236.

              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

              Further Reading

              Severity
              Category
              Status
              Source
              Language