mambax7/adslight

View on GitHub

Showing 5,122 of 5,122 total issues

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

    case 'save':
        if (!$GLOBALS['xoopsSecurity']->check()) {
            redirect_header('itemvotes.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
        }
        if (0 !== Request::getInt('ratingid', 0)) {
Severity: Major
Found in admin/itemvotes.php and 1 other location - About 1 day to fix
admin/uservotes.php on lines 56..81

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

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

function index(): void
{
    global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $mytree, $meta, $mid, $prem_perm;
    $pathIcon16    = Admin::iconUrl('', '16');
    $moduleDirName = \basename(__DIR__);
Severity: Major
Found in index.php - About 1 day to fix

    Function ajax has 253 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        ajax: function( url, options ) {
    
            // If url is an object, simulate pre-1.5 signature
            if ( typeof url === "object" ) {
                options = url;
    Severity: Major
    Found in assets/js/lightbox/js/lightbox-plus-jquery.js - About 1 day to fix

      File Utility.php has 585 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php declare(strict_types=1);
      
      namespace XoopsModules\Adslight;
      
      /*
      Severity: Major
      Found in class/Utility.php - About 1 day to fix

        Function setDocument has 245 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        setDocument = Sizzle.setDocument = function( node ) {
            var hasCompare, subWindow,
                doc = node ? node.ownerDocument || node : preferredDoc;
        
            // Return early if doc is invalid or already selected
        Severity: Major
        Found in assets/js/lightbox/js/lightbox-plus-jquery.js - About 1 day to fix

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

          <?php declare(strict_types=1);
          
          namespace XoopsModules\Adslight;
          
          /*
          Severity: Major
          Found in class/Itemvotes.php and 2 other locations - About 1 day to fix
          class/Iplog.php on lines 1..103
          class/Uservotes.php on lines 1..104

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

          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

          <?php declare(strict_types=1);
          
          namespace XoopsModules\Adslight;
          
          /*
          Severity: Major
          Found in class/Uservotes.php and 2 other locations - About 1 day to fix
          class/Iplog.php on lines 1..103
          class/Itemvotes.php on lines 1..103

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

          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

          <?php declare(strict_types=1);
          
          namespace XoopsModules\Adslight;
          
          /*
          Severity: Major
          Found in class/Iplog.php and 2 other locations - About 1 day to fix
          class/Itemvotes.php on lines 1..103
          class/Uservotes.php on lines 1..104

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

          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 Blocksadmin.php has 554 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php declare(strict_types=1);
          
          namespace XoopsModules\Adslight\Common;
          
          /**
          Severity: Major
          Found in class/Common/Blocksadmin.php - About 1 day to fix

            Method modifyAd has 223 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function modifyAd($lid): void
            {
                global $xoopsDB, $xoopsModule, $xoopsConfig, $myts;
                $contactselect = '';
                require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
            Severity: Major
            Found in modify.php - About 1 day to fix

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

              class Uservotedata extends \XoopsObject
              {
                  private $ratingid;
                  private $usid;
                  private $ratinguser;
              Severity: Major
              Found in class/Uservotedata.php and 1 other location - About 1 day to fix
              class/Itemvotedata.php on lines 36..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 261.

              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

              class Itemvotedata extends \XoopsObject
              {
                  private $ratingid;
                  private $lid;
                  private $ratinguser;
              Severity: Major
              Found in class/Itemvotedata.php and 1 other location - About 1 day to fix
              class/Uservotedata.php on lines 33..108

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

              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

              Function xoops_module_update_adslight has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
              Open

              function xoops_module_update_adslight(\XoopsModule $module, $previousVersion = null): bool
              {
                  global $xoopsDB;
                  $moduleDirName = \basename(\dirname(__DIR__));
                  $helper        = Helper::getInstance();
              Severity: Minor
              Found in include/onupdate.php - About 1 day 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 truncateHtml has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function truncateHtml(
                      string $text,
                      ?int $length = 100,
                      string $ending = '...',
                      bool $exact = false,
              Severity: Minor
              Found in class/Common/SysUtility.php - About 1 day 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 findRows has 205 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      findRows: function( table, filters, currentFilters ) {
                          if (
                              tsf.equalFilters(table.config, table.config.lastSearch, currentFilters) ||
                              !table.config.widgetOptions.filter_initialized
                          ) {
              Severity: Major
              Found in assets/js/tablesorter/js/jquery.tablesorter.widgets.js - About 1 day to fix

                Function findRows has 205 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        findRows: function( table, filters, currentFilters ) {
                            if (
                                tsf.equalFilters(table.config, table.config.lastSearch, currentFilters) ||
                                !table.config.widgetOptions.filter_initialized
                            ) {
                Severity: Major
                Found in assets/js/tablesorter/js/jquery.tablesorter.combined.js - About 1 day to fix

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

                      public static function updateUserRating($sel_id): void
                      {
                          global $xoopsDB;
                  
                          $usid = Request::getInt('usid', 0, 'GET');
                  Severity: Major
                  Found in class/Utility.php and 1 other location - About 1 day to fix
                  class/Utility.php on lines 206..228

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

                  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 (\class_exists('XoopsFormEditor')) {
                              $editorOptions           = [];
                              $editorOptions['name']   = 'message';
                              $editorOptions['value']  = $this->targetObject->getVar('message', 'e');
                              $editorOptions['rows']   = 5;
                  Severity: Major
                  Found in class/Form/RepliesForm.php and 2 other locations - About 1 day to fix
                  class/Form/CategoriesForm.php on lines 88..105
                  class/Form/ListingForm.php on lines 91..108

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

                  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 (\class_exists('XoopsFormEditor')) {
                              $editorOptions           = [];
                              $editorOptions['name']   = 'cat_desc';
                              $editorOptions['value']  = $this->targetObject->getVar('cat_desc', 'e');
                              $editorOptions['rows']   = 5;
                  Severity: Major
                  Found in class/Form/CategoriesForm.php and 2 other locations - About 1 day to fix
                  class/Form/ListingForm.php on lines 91..108
                  class/Form/RepliesForm.php on lines 81..98

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

                  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

                      public static function updateItemRating($sel_id): void
                      {
                          global $xoopsDB;
                  
                          $lid = Request::getInt('lid', 0, 'GET');
                  Severity: Major
                  Found in class/Utility.php and 1 other location - About 1 day to fix
                  class/Utility.php on lines 177..199

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

                  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