XoopsModules25x/lexikon

View on GitHub

Showing 316 of 316 total issues

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

function lx_getLinkedUnameFromId($userid = 0, $name = 0)
{
    if (!is_numeric($userid)) {
        return $userid;
    }
Severity: Minor
Found in include/functions.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 xcopy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function xcopy($source, $dest)
    {
        // Check for symlinks
        if (\is_link($source)) {
            return \symlink(\readlink($source), $dest);
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 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 makeMySelBox has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $sel_name = '', $onchange = '')
    {
        if ('' == $sel_name) {
            $sel_name = $this->id;
        }
Severity: Minor
Found in class/LexikonTree.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 getLinkedUnameFromId has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getLinkedUnameFromId($userid = 0, $name = 0)
    {
        if (!\is_numeric($userid)) {
            return $userid;
        }
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

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 xoops_module_install_lexikon has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function xoops_module_install_lexikon(\XoopsModule $module)
{
    $moduleDirName = \basename(\dirname(__DIR__));

    $helper       = Helper::getInstance();
Severity: Minor
Found in include/oninstall.php - About 1 hr to fix

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

    function lexikon_notify_iteminfo($category, $item_id)
    {
        /*global $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
    
        if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'lexikon') {
    Severity: Minor
    Found in include/notification.inc.php - About 1 hr to fix

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

      function lexikon_block_getAuthors($limit = 5, $sort = 'count', $name = 'uname', $compute_method = 'average')
      {
          $limit = (int)$limit;
          if ('uname' !== $name) {
              $name = 'name';
      Severity: Minor
      Found in include/functions.php - About 1 hr to fix

        Method render has 35 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 getAlphaArray has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getAlphaArray()
              {
                  global $xoopsUser, $xoopsDB, $xoopsModule;
                  $grouppermHandler = \xoops_getHandler('groupperm');
                  $groups           = \is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
          Severity: Minor
          Found in class/Utility.php - About 1 hr to fix

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

                public static function getBlockAuthors($limit = 5, $sort = 'count', $name = 'uname', $compute_method = 'average')
                {
                    $limit = (int)$limit;
                    if ('uname' !== $name) {
                        $name = 'name';
            Severity: Minor
            Found in class/Utility.php - About 1 hr to fix

              Method myblocksadmin_update_blockinstance has 11 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  $id,
                  $bside,
                  $bweight,
                  $bvisible,
                  $btitle,
              Severity: Major
              Found in include/blocksadmin.inc.php - About 1 hr to fix

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

                    if (1 == $helper->getConfig('multicats')) {
                        $thisterm['categoryID'] = (int)$categoryID;
                        $catname                = $xoopsDB->query('SELECT name FROM ' . $xoopsDB->prefix('lxcategories') . " WHERE categoryID = $categoryID ");
                        while (list($name) = $xoopsDB->fetchRow($catname)) {
                            $thisterm['catname'] = htmlspecialchars($name, ENT_QUOTES | ENT_HTML5);
                Severity: Major
                Found in entry.php and 2 other locations - About 1 hr to fix
                letter.php on lines 101..107
                letter.php on lines 171..177

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

                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 (1 == $helper->getConfig('multicats')) {
                            $eachentry['catid'] = (int)$categoryID;
                            $resultF            = $xoopsDB->query('SELECT name FROM ' . $xoopsDB->prefix('lxcategories') . " WHERE categoryID = $categoryID ORDER BY name ASC");
                            while (list($name) = $xoopsDB->fetchRow($resultF)) {
                                $eachentry['catname'] = htmlspecialchars($name, ENT_QUOTES | ENT_HTML5);
                Severity: Major
                Found in letter.php and 2 other locations - About 1 hr to fix
                entry.php on lines 110..116
                letter.php on lines 101..107

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

                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 (1 == $helper->getConfig('multicats')) {
                            $eachentry['catid'] = (int)$categoryID;
                            $resultF            = $xoopsDB->query('SELECT name FROM ' . $xoopsDB->prefix('lxcategories') . " WHERE categoryID = $categoryID ORDER BY name ASC");
                            while (list($name) = $xoopsDB->fetchRow($resultF)) {
                                $eachentry['catname'] = htmlspecialchars($name, ENT_QUOTES | ENT_HTML5);
                Severity: Major
                Found in letter.php and 2 other locations - About 1 hr to fix
                entry.php on lines 110..116
                letter.php on lines 171..177

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

                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 setPermissions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function setPermissions($myArray, $permissionGroup, $categoryID, $grouppermHandler, $permissionName, $mid)
                        {
                            $permissionArray = $myArray;
                            if ($categoryID > 0) {
                                $sql = 'DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('group_permission') . "` WHERE `gperm_name` = '" . $permissionName . "' AND `gperm_itemid`= $categoryID;";
                Severity: Minor
                Found in admin/categories.php - About 1 hr to fix

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

                  function positiontip(e) {
                      if (enabletip) {
                          var nondefaultpos = false;
                          var curX = (ns6) ? e.pageX : event.clientX + ietruebody().scrollLeft;
                          var curY = (ns6) ? e.pageY : event.clientY + ietruebody().scrollTop;
                  Severity: Minor
                  Found in assets/js/tooltipscript2.js - About 1 hr to fix

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

                            if (1 == $helper->getConfig('multicats')) {
                                $syndication['catID'] = $myrow['categoryID'];
                                $resultY              = $xoopsDB->query('SELECT categoryID, name FROM ' . $xoopsDB->prefix('lxcategories') . ' WHERE categoryID = ' . $myrow['categoryID'] . ' ');
                                [$categoryID, $name] = $xoopsDB->fetchRow($resultY);
                                $syndication['categoryname'] = $myts->displayTarea($name);
                    Severity: Major
                    Found in syndication.php and 1 other location - About 1 hr to fix
                    index.php on lines 185..191

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

                    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 (1 == $helper->getConfig('multicats')) {
                                $random['categoryID'] = $myrow['categoryID'];
                    
                                $resultY = $xoopsDB->query('SELECT categoryID, name FROM ' . $xoopsDB->prefix('lxcategories') . ' WHERE categoryID = ' . $myrow['categoryID'] . ' ');
                                [$categoryID, $name] = $xoopsDB->fetchRow($resultY);
                    Severity: Major
                    Found in index.php and 1 other location - About 1 hr to fix
                    syndication.php on lines 78..83

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

                    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