XoopsModules25x/mymenus

View on GitHub

Showing 63 of 63 total issues

Function hoverIntent has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.hoverIntent = function (handlerIn, handlerOut, selector) {

        // default configuration values
        var cfg = {
            interval: 100,
Severity: Major
Found in assets/js/hoverIntent.js - About 2 hrs to fix

    Function mymenus_block_edit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    function mymenus_block_edit($options)
    {
        /** @var \XoopsModules\Mymenus\Helper $helper */
        $helper = \XoopsModules\Mymenus\Helper::getInstance();
        //
    Severity: Minor
    Found in blocks/mymenus_block.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 getModuleMenus has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected static function getModuleMenus($module, $pid)
        {
            global $xoopsModule;
            static $id = -1;
            /** @var \XoopsModules\Mymenus\Helper $helper */
    Severity: Major
    Found in class/Plugins/Dynamic/PluginItem.php - About 2 hrs to fix

      Function editLink has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function editLink($id = null, $pid = null, $mid = null)
          {
              /** @var \XoopsModules\Mymenus\Helper $helper */
              $helper = \XoopsModules\Mymenus\Helper::getInstance();
              //
      Severity: Minor
      Found in class/LinksUtility.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 getConfig has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getConfig()
      {
          $moduleDirName      = basename(dirname(__DIR__));
          $moduleDirNameUpper = strtoupper($moduleDirName);
          return (object)[
      Severity: Minor
      Found in include/config.php - About 1 hr to fix

        Method getSkinInfo has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getSkinInfo($moduleSkin = 'default', $useThemeSkin = false, $themeSkin = '')
            {
                //    require __DIR__ . '/common.php';
                /** @var \XoopsModules\Mymenus\Helper $helper */
                $helper = \XoopsModules\Mymenus\Helper::getInstance();
        Severity: Minor
        Found in class/Utility.php - About 1 hr to fix

          Function toArray has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  toArray: function (options) {
          
                      var o = $.extend({}, this.options, options),
                          sDepth = o.startDepthCount || 0,
                          ret = [],
          Severity: Minor
          Found in assets/js/nestedSortable.js - About 1 hr to fix

            Function supersubs has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                $.fn.supersubs = function (options) {
                    var opts = $.extend({}, $.fn.supersubs.defaults, options);
                    // return original object to support chaining
                    return this.each(function () {
                        // cache selections
            Severity: Minor
            Found in assets/js/supersubs.js - About 1 hr to fix

              Method addLink has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function addLink($mid)
                  {
                      /** @var \XoopsModules\Mymenus\Helper $helper */
                      $helper = \XoopsModules\Mymenus\Helper::getInstance();
                      //
              Severity: Minor
              Found in class/LinksUtility.php - About 1 hr to fix

                Method createUpdateTable has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function createUpdateTable($table, $tablename, \XoopsObject $module)
                    {
                        if (!InfoTableExists($GLOBALS['xoopsDB']->prefix($module->getInfo('dirname')) . $tablename)) {
                            $sql = 'CREATE TABLE ' . $GLOBALS['xoopsDB']->prefix($module->getInfo('dirname')) . $tablename . ' (';
                            foreach ($table as $s => $w) {
                Severity: Minor
                Found in class/Updater.php - About 1 hr to fix

                  Method checkInfoTable has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function checkInfoTable(\XoopsObject $module)
                      {
                          //    global $xoopsDB;
                          $err = true;
                  
                  
                  Severity: Minor
                  Found in class/Updater.php - About 1 hr to fix

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

                            if (submenu.getAttribute("rel") == "closed") {
                                submenu.style.display = "block";
                                submenu.setAttribute("rel", "open");
                                ulelement.parentNode.style.backgroundImage = "url(" + ddtreemenu.openfolder + ")"
                            }
                    Severity: Major
                    Found in skins/treemenu/simpletreemenu.js and 1 other location - About 1 hr to fix
                    skins/treemenu/simpletreemenu.js on lines 44..48

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

                    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

                            else if (submenu.getAttribute("rel") == "open") {
                                submenu.style.display = "none";
                                submenu.setAttribute("rel", "closed");
                                ulelement.parentNode.style.backgroundImage = "url(" + ddtreemenu.closefolder + ")"
                            }
                    Severity: Major
                    Found in skins/treemenu/simpletreemenu.js and 1 other location - About 1 hr to fix
                    skins/treemenu/simpletreemenu.js on lines 39..48

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

                    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

                    Consider simplifying this complex logical expression.
                    Open

                                if (!o.isAllowed(this.currentItem, parentItem) ||
                                    parentItem && parentItem.hasClass(o.disableNesting) ||
                                    o.protectRoot && (parentItem === null && !isRoot || isRoot && level > 1)) {
                                    this.placeholder.addClass(o.errorClass);
                                    if (maxLevels < levels && maxLevels != 0) {
                    Severity: Critical
                    Found in assets/js/nestedSortable.js - About 1 hr to fix

                      Method xoops_module_install_mymenus has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function xoops_module_install_mymenus(\XoopsModule $module)
                      {
                          require   dirname(dirname(dirname(__DIR__))) . '/mainfile.php';
                          require   dirname(__DIR__) . '/include/config.php';
                      
                      
                      Severity: Minor
                      Found in include/oninstall.php - About 1 hr to fix

                        Method getForm has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getForm($action = false)
                            {
                                //        $grouppermHandler = xoops_getHandler('groupperm');
                                //
                                xoops_load('XoopsFormLoader');
                        Severity: Minor
                        Found in class/Menus.php - About 1 hr to fix

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

                              protected static function getModuleMenus($module, $pid)
                              {
                                  global $xoopsModule;
                                  static $id = -1;
                                  /** @var \XoopsModules\Mymenus\Helper $helper */
                          Severity: Minor
                          Found in class/Plugins/Dynamic/PluginItem.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

                          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

                          Function buildSubTree has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          ddtreemenu.buildSubTree = function (treeid, ulelement, index) {
                              ulelement.parentNode.className = "submenu";
                              if (typeof persisteduls[treeid] == "object") { //if cookie exists (persisteduls[treeid] is an array versus "" string)
                                  if (ddtreemenu.searcharray(persisteduls[treeid], index)) {
                                      ulelement.setAttribute("rel", "open");
                          Severity: Minor
                          Found in skins/treemenu/simpletreemenu.js - About 1 hr to fix

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

                                public function buildMenus($pid = 0)
                                {
                                    static $idx = -1;
                                    static $level = -1;
                                    ++$level;
                            Severity: Minor
                            Found in class/builder.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language