mambax7/mymenus

View on GitHub

Showing 115 of 115 total issues

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

    public function render()
    {
        $ret = '';

        if (\count($this->_appendix) > 0) {
Severity: Minor
Found in class/GroupFormCheckBox.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 render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function render()
    {
        // load all child ids for javascript codes
        foreach (\array_keys($this->_itemTree) as $item_id) {
            $this->_itemTree[$item_id]['allchild'] = [];
Severity: Minor
Found in class/GroupPermForm.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 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 render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function render()
        {
            $ret = '';
    
            if (\count($this->_appendix) > 0) {
    Severity: Minor
    Found in class/GroupFormCheckBox.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

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

              $.fn.hoverIntent = function(handlerIn,handlerOut,selector) {
                  // instance ID, used as a key to store and retrieve state information on an element
                  var instanceId = INSTANCE_COUNT++;
          
                  // extend the default configuration and parse parameters
          Severity: Minor
          Found in assets/js/jquery.hoverIntent.js - About 1 hr to fix

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

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

              Method cloneBlock has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function cloneBlock(int $bid)
                  : void {
                      //require __DIR__ . '/admin_header.php';
                      //        \xoops_cp_header();
              
              
              Severity: Minor
              Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

                    public function editBlock(int $bid)
                    : void {
                        //        require_once \dirname(__DIR__,2) . '/admin/admin_header.php';
                        //        \xoops_cp_header();
                        \xoops_loadLanguage('admin', 'system');
                Severity: Minor
                Found in class/Common/Blocksadmin.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 buildSelected has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function buildSelected(): void
                      {
                          //get the currentpage
                          $sel = [];
                          //        $queryString = $_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '';
                  Severity: Minor
                  Found in class/Builder.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 xoops_module_install_mymenus has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Method loadTableFromArrayWithReplace has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function loadTableFromArrayWithReplace($table, $data, $search, $replace)
                      {
                          /** @var \XoopsMySQLDatabase $db */
                          $db = \XoopsDatabaseFactory::getDatabaseConnection();
                      
                      
                      Severity: Minor
                      Found in testdata/index.php - About 1 hr to fix

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

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

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

                              public static function getServerStats()
                              {
                                  //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
                                  $moduleDirName      = \basename(\dirname(__DIR__, 2));
                                  $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
                          Severity: Minor
                          Found in class/Common/ServerStats.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language