XoopsModules25x/lexikon

View on GitHub

Showing 316 of 316 total issues

Function positiontip has a Cognitive Complexity of 24 (exceeds 5 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 3 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

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

$cache_select->addOptionArray(
    [
        0       => _NOCACHE,
        30      => sprintf(_SECONDS, 30),
        60      => _MINUTE,
Severity: Major
Found in admin/myblockform.php and 1 other location - About 3 hrs to fix
admin/blockform.php on lines 96..110

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

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

$cacheSelect->addOptionArray(
    [
        0       => _NOCACHE,
        30      => sprintf(_SECONDS, 30),
        60      => _MINUTE,
Severity: Major
Found in admin/blockform.php and 1 other location - About 3 hrs to fix
admin/myblockform.php on lines 97..111

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

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

function categorySave($categoryID = '')
{
    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    require_once XOOPS_ROOT_PATH . '/class/uploader.php';
    global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsDB, $myts, $categoryID;
Severity: Major
Found in admin/category.php - About 3 hrs to fix

    Method __construct has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct($target)
        {
            $db      = \XoopsDatabaseFactory::getDatabaseConnection();
            $helper  = Helper::getInstance();
            $utility = new Utility();
    Severity: Major
    Found in class/Form/EntriesForm.php - About 3 hrs to fix

      Function lx_extract_keywords has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      function lx_extract_keywords($content)
      {
          global $xoopsTpl, $xoTheme, $xoopsModule, $xoopsModuleConfig;
          require_once XOOPS_ROOT_PATH . '/modules/lexikon/include/common.inc.php';
          $keywords_count = $helper->getConfig('metakeywordsnum');
      Severity: Minor
      Found in include/functions.php - About 3 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

      Function extractKeywords has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function extractKeywords($content)
          {
              global $xoopsTpl, $xoTheme, $xoopsModule;
      
              $helper = Helper::getInstance();
      Severity: Minor
      Found in class/Utility.php - About 3 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

      Function checkVerModule has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function checkVerModule($helper, $source = 'github', $default = 'master')
          {
              $moduleDirName      = \basename(\dirname(__DIR__, 2));
              $moduleDirNameUpper = mb_strtoupper($moduleDirName);
              $update             = '';
      Severity: Minor
      Found in class/Common/VersionChecks.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

      File functions.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Module: lexikon
       * Author: Yerres
       * Licence: GNU
      Severity: Minor
      Found in admin/functions.php - About 2 hrs to fix

        Method lx_GetStatistics has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function lx_GetStatistics($limit)
        {
            $ret  = [];
            $db   = \XoopsDatabaseFactory::getDatabaseConnection();
            $tbls = $db->prefix('lxentries');
        Severity: Major
        Found in admin/functions.php - About 2 hrs to fix

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

          if ('term' === $category) {
              // Assume we have a valid entry id
              $sql = 'SELECT entryID,term FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE entryID = ' . $item_id;
              if (!$result = $xoopsDB->query($sql)) {
                  redirect_header('index.php', 2, _ERRORS);
          Severity: Major
          Found in include/notification.inc.php and 1 other location - About 2 hrs to fix
          include/notification.inc.php on lines 50..62

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

          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 ('category' === $category) {
              // Assume we have a valid category id
              $sql = 'SELECT name FROM ' . $xoopsDB->prefix('lxcategories') . ' WHERE categoryID = ' . $item_id;
              if (!$result = $xoopsDB->query($sql)) {
                  redirect_header('index.php', 2, _ERRORS);
          Severity: Major
          Found in include/notification.inc.php and 1 other location - About 2 hrs to fix
          include/notification.inc.php on lines 64..76

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

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

          function categoryDefault()
          {
              $helper = Helper::getInstance();
              $op = 'default';
              require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
          Severity: Major
          Found in admin/category.php - About 2 hrs to fix

            Method myblocksadmin_update_block has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function myblocksadmin_update_block(
                $bid,
                $bside,
                $bweight,
                $bvisible,
            Severity: Major
            Found in include/blocksadmin.inc.php - About 2 hrs to fix

              Function isBlockCloned has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options = null)
                  {
                      xoops_loadLanguage('admin', 'system');
                      xoops_loadLanguage('admin/blocksadmin', 'system');
                      xoops_loadLanguage('admin/groups', 'system');
              Severity: Minor
              Found in admin/blocksadmin.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

              Function lx_module_header has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              function lx_module_header()
              {
                  global $xoopsTpl, $xoTheme, $xoopsModule, $xoopsModuleConfig, $lexikon_module_header;
                  if (isset($xoTheme) && is_object($xoTheme)) {
                      $xoTheme->addStylesheet('modules/lexikon/assets/css/style.css');
              Severity: Minor
              Found in include/functions.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

              Function getModuleHeader has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getModuleHeader()
                  {
                      global $xoopsTpl, $xoTheme, $xoopsModule, $lexikon_module_header;
              
                      $helper = Helper::getInstance();
              Severity: Minor
              Found in class/Utility.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 truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
                  {
                      if ($considerHtml) {
                          // if the plain text is shorter than the maximum length, return the whole text
                          if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
              Severity: Major
              Found in class/Common/SysUtility.php - About 2 hrs to fix

                Method truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
                    {
                        if ($considerHtml) {
                            // if the plain text is shorter than the maximum length, return the whole text
                            if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
                Severity: Major
                Found in class/Utility.php - About 2 hrs to fix

                  File submissions.php has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * Module: Lexikon - glossary module
                   * Author: hsalazar
                   * Changes: Yerres
                  Severity: Minor
                  Found in admin/submissions.php - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language