XoopsModules25x/lexikon

View on GitHub

Showing 316 of 316 total issues

Function lexikon_block_getAuthors has a Cognitive Complexity of 11 (exceeds 5 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

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 myblocksadmin_update_blockinstance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function myblocksadmin_update_blockinstance(
    $id,
    $bside,
    $bweight,
    $bvisible,
Severity: Minor
Found in include/blocksadmin.inc.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 lx_Statistics has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function lx_Statistics()
{
    global $xoopsModule, $xoopsConfig;
    $helper = Helper::getInstance();
    xoops_load('XoopsUserUtility');
Severity: Minor
Found in admin/statistics.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 lx_getmoduleoption has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function lx_getmoduleoption($option, $repmodule = 'lexikon')
{
    global $xoopsModuleConfig, $xoopsModule;
    static $tbloptions = [];
    if (is_array($tbloptions) && array_key_exists($option, $tbloptions)) {
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 lx_create_pagetitle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function lx_create_pagetitle($article = '', $topic = '')
{
    global $xoopsModule, $xoopsTpl;
    $myts    = \MyTextSanitizer::getInstance();
    $content = '';
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

Method myblocksadmin_update_block has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

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

        public static function getModuleOption($option, $repmodule = 'lexikon')
        {
            global $xoopsModuleConfig, $xoopsModule;
            static $tbloptions = [];
            if (\is_array($tbloptions) && \array_key_exists($option, $tbloptions)) {
    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 getBlockAuthors has a Cognitive Complexity of 11 (exceeds 5 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

    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 createPageTitle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function createPageTitle($article = '', $topic = '')
        {
            global $xoopsModule, $xoopsTpl;
            $myts    = \MyTextSanitizer::getInstance();
            $content = '';
    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 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

    Method lexikon_tag_iteminfo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function lexikon_tag_iteminfo(&$items)
    {
        if (empty($items) || !is_array($items)) {
            return false;
        }
    Severity: Minor
    Found in include/plugin.tag.php - About 1 hr to fix

      Method b_lxcategories_show has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function b_lxcategories_show($options)
      {
          global $xoopsDB, $xoopsUser;
          $myts = MyTextSanitizer:: getInstance();
      
      
      Severity: Minor
      Found in blocks/categories_block.php - About 1 hr to fix

        Method lx_html2text has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function lx_html2text($document)
        {
            // PHP Manual:: function preg_replace $document should contain an HTML document.
            // This will remove HTML tags, javascript sections and white space. It will also
            // convert some common HTML entities to their text equivalent.
        Severity: Minor
        Found in include/functions.php - About 1 hr to fix

          Method categoryDelete has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function categoryDelete($categoryID = '')
          {
              //global $xoopsDB, $xoopsConfig;
              global $xoopsConfig, $xoopsDB, $xoopsModule;
              $idc = Request::getInt('categoryID', '');
          Severity: Minor
          Found in admin/category.php - About 1 hr to fix

            Method lexikon_tag_iteminfo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function lexikon_tag_iteminfo(&$items)
            {
                if (empty($items) || !is_array($items)) {
                    return false;
                }
            Severity: Minor
            Found in class/plugins/plugin.tag.php - About 1 hr to fix

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

                      if ((0 !== $helper->getConfig('com_rule')) || ((0 != $helper->getConfig('com_rule')) && is_object($xoopsUser))) {
                          if (0 != $comments) {
                              $eachentry['comments'] = "<a href='entry.php?entryID=" . $eachentry['id'] . "'>" . $comments . '&nbsp;' . _COMMENTS . '</a>';
                          } else {
                              $eachentry['comments'] = '';
              Severity: Major
              Found in letter.php and 1 other location - About 1 hr to fix
              letter.php on lines 112..118

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

              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 ((0 !== $helper->getConfig('com_rule')) || ((0 != $helper->getConfig('com_rule')) && is_object($xoopsUser))) {
                          if (0 != $comments) {
                              $eachentry['comments'] = "<a href='entry.php?entryID=" . $eachentry['id'] . "'>" . $comments . '&nbsp;' . _COMMENTS . '</a>';
                          } else {
                              $eachentry['comments'] = '';
              Severity: Major
              Found in letter.php and 1 other location - About 1 hr to fix
              letter.php on lines 186..192

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

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

              function lexikon_summary()
              {
                  global $xoopsDB;
              
                  $summary = [];
              Severity: Minor
              Found in include/functions.php - About 1 hr to fix

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

                function lx_seemsUtf8($Str)
                { # by bmorel at ssi dot fr
                    for ($i = 0, $iMax = mb_strlen($Str); $i < $iMax; ++$i) {
                        if (ord($Str[$i]) < 0x80) {
                            continue;
                Severity: Minor
                Found in include/functions.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
                    Severity
                    Category
                    Status
                    Source
                    Language