mambax7/adslight

View on GitHub

Showing 5,122 of 5,122 total issues

Function listingDel has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

function listingDel($lid, $ok): void
{
    global $xoopsDB;
    $helper = Helper::getInstance();
    $sql = 'SELECT usid FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid=' . $xoopsDB->escape($lid);
Severity: Minor
Found in modify.php - About 5 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 indexView has 134 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function indexView($lid = null): void
{
    global $xoopsDB, $myts, $desctext, $admin_lang;
    $helper = Helper::getInstance();
    $mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
Severity: Major
Found in admin/view_ads.php - About 5 hrs to fix

    Method index has 132 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function index(): void
    {
        global $xoopsDB, $myts, $desctext;
    
        $mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
    Severity: Major
    Found in admin/main.php - About 5 hrs to fix

      Method adslight_seo_title has 132 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function adslight_seo_title($title = '', $withExt = false)
      {
          /**
           * if XOOPS ML is present, let's sanitize the title with the current language
           */
      Severity: Major
      Found in seo_url.php - About 5 hrs to fix

        File modify_ads.php has 386 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php declare(strict_types=1);
        
        /*
         * You may not change or alter any portion of this comment or credits
         * of supporting developers from this source code or any supporting source code
        Severity: Minor
        Found in admin/modify_ads.php - About 5 hrs to fix

          Function index has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

          function index(): void
          {
              global $xoopsDB, $xoopsModule, $myts, $desctext, $admin_lang;
              $helper = Helper::getInstance();
              $mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
          Severity: Minor
          Found in admin/validate_ads.php - About 5 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 buildCache has 129 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  buildCache : function( c, callback, $tbodies ) {
                      var cache, val, txt, rowIndex, colIndex, tbodyIndex, $tbody, $row,
                          cols, $cells, cell, cacheTime, totalRows, rowData, prevRowData,
                          colMax, span, cacheIndex, hasParser, max, len, index,
                          table = c.table,
          Severity: Major
          Found in assets/js/tablesorter/js/jquery.tablesorter.combined.js - About 5 hrs to fix

            Function buildCache has 129 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    buildCache : function( c, callback, $tbodies ) {
                        var cache, val, txt, rowIndex, colIndex, tbodyIndex, $tbody, $row,
                            cols, $cells, cell, cacheTime, totalRows, rowData, prevRowData,
                            colMax, span, cacheIndex, hasParser, max, len, index,
                            table = c.table,
            Severity: Major
            Found in assets/js/tablesorter/js/jquery.tablesorter.js - About 5 hrs to fix

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

                  if ($numrows > 0) {
                      echo '<form method="post" action="options.php">
                          <b>' . _AM_ADSLIGHT_MODCONDITION . '</b></font><br><br>';
                      $sql     = 'SELECT id_condition, nom_condition FROM ' . $xoopsDB->prefix('adslight_condition') . ' ORDER BY nom_condition';
                      $result8 = $xoopsDB->query($sql);
              Severity: Major
              Found in admin/options.php and 2 other locations - About 5 hrs to fix
              admin/options.php on lines 58..78
              admin/options.php on lines 97..116

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

              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 ($numrows > 0) {
                      echo '<form method="post" action="options.php">
                           <b>' . _AM_ADSLIGHT_MODTYPE . '</b></font><br><br>';
                      $sql     = 'SELECT id_type, nom_type FROM ' . $xoopsDB->prefix('adslight_type') . ' ORDER BY nom_type';
                      $result2 = $xoopsDB->query($sql);
              Severity: Major
              Found in admin/options.php and 2 other locations - About 5 hrs to fix
              admin/options.php on lines 97..116
              admin/options.php on lines 135..155

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

              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 ($numrows > 0) {
                      echo '<form method="post" action="options.php">
                          <b>' . _AM_ADSLIGHT_MODPRICE . '</b></font><br><br>';
                      $sql     = 'SELECT id_price, nom_price FROM ' . $xoopsDB->prefix('adslight_price') . ' ORDER BY nom_price';
                      $result3 = $xoopsDB->query($sql);
              Severity: Major
              Found in admin/options.php and 2 other locations - About 5 hrs to fix
              admin/options.php on lines 58..78
              admin/options.php on lines 135..155

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

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

              <?php declare(strict_types=1);
              
              /*
               * You may not change or alter any portion of this comment or credits
               * of supporting developers from this source code or any supporting source code
              Severity: Minor
              Found in viewcats.php - About 5 hrs to fix

                Function initSort has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        initSort : function( c, cell, event ) {
                            if ( c.table.isUpdating ) {
                                // let any updates complete before initializing a sort
                                return setTimeout( function() {
                                    ts.initSort( c, cell, event );
                Severity: Major
                Found in assets/js/tablesorter/js/jquery.tablesorter.combined.js - About 4 hrs to fix

                  Function initSort has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          initSort : function( c, cell, event ) {
                              if ( c.table.isUpdating ) {
                                  // let any updates complete before initializing a sort
                                  return setTimeout( function() {
                                      ts.initSort( c, cell, event );
                  Severity: Major
                  Found in assets/js/tablesorter/js/jquery.tablesorter.js - About 4 hrs to fix

                    File lightbox.js has 373 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /*!
                     * Lightbox v2.11.3
                     * by Lokesh Dhakar
                     *
                     * More info:
                    Severity: Minor
                    Found in assets/js/lightbox/js/lightbox.js - About 4 hrs to fix

                      Function defaultPrefilter has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function defaultPrefilter( elem, props, opts ) {
                          var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
                              isBox = "width" in props || "height" in props,
                              anim = this,
                              orig = {},
                      Severity: Major
                      Found in assets/js/lightbox/js/lightbox-plus-jquery.js - About 4 hrs to fix

                        Function Callbacks has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        jQuery.Callbacks = function( options ) {
                        
                            // Convert options from String-formatted to Object-formatted if needed
                            // (we check in cache first)
                            options = typeof options === "string" ?
                        Severity: Major
                        Found in assets/js/lightbox/js/lightbox-plus-jquery.js - About 4 hrs to fix

                          Method getFormFeedback has 120 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getFormFeedback($action = false): \XoopsThemeForm
                              {
                                  if (!$action) {
                                      $action = $_SERVER['REQUEST_URI'];
                                  }
                          Severity: Major
                          Found in class/Common/ModuleFeedback.php - About 4 hrs to fix

                            Function listBlocks has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function listBlocks(): void
                                {
                                    $pathIcon16 = Admin::iconUrl('', '16');
                            
                                    require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                            Severity: Minor
                            Found in class/Common/Blocksadmin.php - About 4 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 Tree.php has 362 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php declare(strict_types=1);
                            
                            namespace XoopsModules\Adslight;
                            
                            /*
                            Severity: Minor
                            Found in class/Tree.php - About 4 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language