XoopsModules25x/lexikon

View on GitHub

Showing 316 of 316 total issues

Method lx_removeAccents has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function lx_removeAccents($string)
{
    $chars['in']  = chr(128)
                    . chr(131)
                    . chr(138)
Severity: Major
Found in include/functions.php - About 4 hrs to fix

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

        foreach ($mostreadterms as $entryID => $data) {
            $url1   = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/category.php?categoryID=' . $data['categoryID'];
            $url2   = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/entry.php?entryID=' . $entryID;
            $sentby = \XoopsUserUtility::getUnameFromId($data['uid']);
            $class  = ('even' === $class) ? 'odd' : 'even';
    Severity: Major
    Found in admin/statistics.php and 1 other location - About 4 hrs to fix
    admin/statistics.php on lines 140..154

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

    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

        foreach ($lessreadnews as $entryID => $data) {
            $url1   = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/category.php?categoryID=' . $data['categoryID'];
            $url2   = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/entry.php?entryID=' . $entryID;
            $sentby = \XoopsUserUtility::getUnameFromId($data['uid']);
            $class  = ('even' === $class) ? 'odd' : 'even';
    Severity: Major
    Found in admin/statistics.php and 1 other location - About 4 hrs to fix
    admin/statistics.php on lines 118..132

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

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

    function b_lxentries_random_show()
    {
        global $xoopsDB, $xoopsUser, $xoopsConfig, $xoopsModule;
        $myts = \MyTextSanitizer::getInstance();
    
    
    Severity: Major
    Found in blocks/random_term.php - About 4 hrs to fix

      Method entryDefault has 103 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function entryDefault()
      {
          global $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModule, $entryID, $pathIcon16;
          $helper = Helper::getInstance();
          require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
      Severity: Major
      Found in admin/entry.php - About 4 hrs to fix

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

            public function __construct($target)
            {
                global $helper;
                $this->targetObject = $target;
        
        
        Severity: Major
        Found in class/Form/CategoriesForm.php - About 4 hrs to fix

          Method DefinitionImport has 101 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function DefinitionImport($delete)
          {
              global $xoopsConfig, $xoopsDB, $xoopsModule;
              $sqlQuery = $xoopsDB->query('SELECT count(id) AS count FROM ' . $xoopsDB->prefix('glossaire'));
              [$count] = $xoopsDB->fetchRow($sqlQuery);
          Severity: Major
          Found in admin/importglossaire.php - About 4 hrs to fix

            Function DefinitionImport has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

            function DefinitionImport($delete)
            {
                global $xoopsConfig, $xoopsDB, $xoopsModule;
                $sqlQuery = $xoopsDB->query('SELECT count(id) AS count FROM ' . $xoopsDB->prefix('glossaire'));
                [$count] = $xoopsDB->fetchRow($sqlQuery);
            Severity: Minor
            Found in admin/importglossaire.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

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

                if ($totalRwords > 0) { // If there are definitions
                    while (list($entryID, $term) = $xoopsDB->fetchRow($resultR)) {
                        $reqentries             = [];
                        $xoopsModule            = XoopsModule::getByDirname('lexikon');
                        $linktext               = mb_ucfirst(htmlspecialchars($term, ENT_QUOTES | ENT_HTML5));
            Severity: Major
            Found in index.php and 2 other locations - About 3 hrs to fix
            index.php on lines 205..219
            index.php on lines 246..260

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

            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 ($totalSwords > 0) { // If there are definitions
                    while (list($entryID, $term) = $xoopsDB->fetchRow($resultS)) {
                        $subentries             = [];
                        $xoopsModule            = XoopsModule::getByDirname('lexikon');
                        $linktext               = mb_ucfirst(htmlspecialchars($term, ENT_QUOTES | ENT_HTML5));
            Severity: Major
            Found in index.php and 2 other locations - About 3 hrs to fix
            index.php on lines 225..239
            index.php on lines 246..260

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

            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 ($totalRwords > 0) { // If there are definitions
                    while (list($entryID, $term) = $xoopsDB->fetchRow($resultR)) {
                        $reqentries             = [];
                        $xoopsModule            = XoopsModule::getByDirname('lexikon');
                        $linktext               = mb_ucfirst(htmlspecialchars($term, ENT_QUOTES | ENT_HTML5));
            Severity: Major
            Found in index.php and 2 other locations - About 3 hrs to fix
            index.php on lines 205..219
            index.php on lines 225..239

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

            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

            File category.php has 327 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * Module: Lexikon - glossary module
             * Author: hsalazar
             * Licence: GNU
            Severity: Minor
            Found in admin/category.php - About 3 hrs to fix

              Method b_lxspot_show has 94 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function b_lxspot_show($options)
              {
                  global $xoopsDB, $xoopsUser;
                  $myts = MyTextSanitizer:: getInstance();
                  xoops_load('XoopsUserUtility');
              Severity: Major
              Found in blocks/entries_spot.php - About 3 hrs to fix

                Method removeAccents has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function removeAccents($string)
                    {
                        $chars['in']  = \chr(128)
                                        . \chr(131)
                                        . \chr(138)
                Severity: Major
                Found in class/Utility.php - About 3 hrs to fix

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

                          for ($a = 48; $a < (48 + 10); ++$a) {
                              $letterlinks             = [];
                              $initial                 = unichr($a);
                              $sql                     = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . " WHERE init = '$initial' AND submit = '0' AND offline ='0' AND request = '0' " . $catperms . '');
                              $howmany                 = $xoopsDB->getRowsNum($sql);
                  Severity: Major
                  Found in class/Utility.php and 1 other location - About 3 hrs to fix
                  class/Utility.php on lines 242..252

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

                  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

                          for ($a = 65; $a < (65 + 26); ++$a) {
                              $letterlinks             = [];
                              $initial                 = unichr($a);
                              $sql                     = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . " WHERE init = '$initial' AND submit = '0' AND offline ='0' AND request = '0' " . $catperms . '');
                              $howmany                 = $xoopsDB->getRowsNum($sql);
                  Severity: Major
                  Found in class/Utility.php and 1 other location - About 3 hrs to fix
                  class/Utility.php on lines 231..241

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

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

                  function DefinitionImport($delete)
                  {
                      global $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule, $myts;
                      $myts = \MyTextSanitizer::getInstance();
                  
                  
                  Severity: Major
                  Found in admin/importwiwimod.php - About 3 hrs to fix

                    Method categoryEdit has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function categoryEdit($categoryID = '')
                    {
                        require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
                        require_once XOOPS_ROOT_PATH . '/class/uploader.php';
                        require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
                    Severity: Major
                    Found in admin/category.php - About 3 hrs to fix

                      Function updateBlock has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                          function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups)
                          {
                              $myblock = new \XoopsBlock($bid);
                              $myblock->setVar('title', $btitle);
                              $myblock->setVar('weight', $bweight);
                      Severity: Minor
                      Found in admin/blocksadmin.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 DefinitionImport has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function DefinitionImport($delete)
                      {
                          global $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule, $myts;
                          $myts = \MyTextSanitizer::getInstance();
                      
                      
                      Severity: Minor
                      Found in admin/importwiwimod.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

                      Severity
                      Category
                      Status
                      Source
                      Language