mambax7/mymenus

View on GitHub

Showing 93 of 115 total issues

Method updateBlock has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups)
Severity: Major
Found in class/Common/Blocksadmin.php - About 1 hr to fix

    Method saveLink has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function saveLink($id, $mid): void
        {
            $helper       = Helper::getInstance();
            $linksHandler = $helper->getHandler('Links');
    
    
    Severity: Minor
    Found in class/LinksUtility.php - About 1 hr to fix

      Method buildSelected has 28 lines of code (exceeds 25 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

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

        function check_browser_can_use_spaw()
        {
            $browser = $_SERVER['HTTP_USER_AGENT'];
            // check if msie
            if (preg_match('/MSIE[^;]*/i', $browser, $msie)) {
        Severity: Minor
        Found in admin/myblockform.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 _loadAllChildItemIds has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _loadAllChildItemIds($itemId, &$childIds): void
            {
                if (!empty($this->_itemTree[$itemId]['children'])) {
                    $first_child = $this->_itemTree[$itemId]['children'];
                    foreach ($first_child as $fcid) {
        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 loadSampleData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function loadSampleData(): void
        {
            global $xoopsConfig;
            $moduleDirName      = \basename(\dirname(__DIR__));
            $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
        Severity: Minor
        Found in testdata/index.php - About 1 hr to fix

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

              public static function getExtraValue($type, $value)
              {
                  $registry = Mymenus\Registry::getInstance();
                  $ret      = 0;
                  $values   = ['pm_new', 'pm_readed', 'pm_total'];
          Severity: Minor
          Found in class/Plugins/Mymenus/PluginItem.php - About 1 hr to fix

            Method isBlockCloned has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
            Severity: Major
            Found in class/Common/Blocksadmin.php - About 1 hr to fix

              Function setEvents has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function setEvents(): void
                  {
                      foreach ($this->plugins as $plugin) {
                          //            require $GLOBALS['xoops']->path("modules/{$this->helper->getDirname()}/plugins/{$plugin}/{$plugin}.php");
                          $dirname   = $this->helper->getDirname();
              Severity: Minor
              Found in class/Plugin.php - About 55 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 buildSubTree has a Cognitive Complexity of 9 (exceeds 5 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 55 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 rmove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function rmove($src, $dest)
                  {
                      // 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 55 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 recurseCopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function recurseCopy($src, $dst): void
                  {
                      $dir = \opendir($src);
                      //        @mkdir($dst);
                      if (!@\mkdir($dst) && !\is_dir($dst)) {
              Severity: Minor
              Found in class/Common/FilesManagement.php - About 55 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 buildUpDown has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function buildUpDown($pid = 0): void
                  {
                      static $idx = -1;
                      $prevWeight = null;
                      $up         = 0;
              Severity: Minor
              Found in class/Builder.php - About 55 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 rcopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function rcopy($src, $dest)
                  {
                      // 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 55 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

              Method setOrder has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function setOrder(string $bid, string $title, string $weight, string $visible, string $side, string $bcachetime, ?array $bmodule = null)
              Severity: Major
              Found in class/Common/Blocksadmin.php - About 50 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    switch ($filter_menus_title_condition) {
                                        case 'CONTAINS':
                                        default:
                                            $pre      = '%';
                                            $post     = '%';
                Severity: Major
                Found in admin/menus.php - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                      if (0 != $pid && !in_array($pid, array_keys($item_ids), true)) {
                                                          // one of the parent items were not selected, so skip this item
                                                          $msg[] = sprintf(_MD_AM_PERMADDNG, '<strong>' . $perm_name . '</strong>', '<strong>' . $perm_data['itemname'][$item_id] . '</strong>', '<strong>' . $group_list[$group_id] . '</strong>') . ' (' . _MD_AM_PERMADDNGP . ')';
                                                          continue 2;
                                                      }
                  Severity: Major
                  Found in admin/mygroupperm.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

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

                      Function createTree has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      ddtreemenu.createTree = function (treeid, enablepersist, persistdays) {
                          var ultags = document.getElementById(treeid).getElementsByTagName("ul");
                          if (typeof persisteduls[treeid] == "undefined")
                              persisteduls[treeid] = (enablepersist == true && ddtreemenu.getCookie(treeid) != "") ? ddtreemenu.getCookie(treeid).split(",") : "";
                          for (var i = 0; i < ultags.length; i++)
                      Severity: Minor
                      Found in skins/treemenu/simpletreemenu.js - About 45 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 saveLink has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function saveLink($id, $mid): void
                          {
                              $helper       = Helper::getInstance();
                              $linksHandler = $helper->getHandler('Links');
                      
                      
                      Severity: Minor
                      Found in class/LinksUtility.php - About 45 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

                      Severity
                      Category
                      Status
                      Source
                      Language