mambax7/smartfaq

View on GitHub

Showing 374 of 649 total issues

Function getFaqsFromSearch has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFaqsFromSearch($queryarray = [], $andor = 'AND', $limit = 0, $offset = 0, $userid = 0)
    {
        global $xoopsUser;

        $ret              = [];
Severity: Minor
Found in class/FaqHandler.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

Function myblocksadmin_update_block has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

function myblocksadmin_update_block(
    $bid,
    $bside,
    $bweight,
    $bvisible,
Severity: Minor
Found in include/blocksadmin.inc.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

Method sf_createThumbnail has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function sf_createThumbnail($source, $thumb_width)
    {
        /** @var Smartfaq\Helper $helper */
        $helper = Smartfaq\Helper::getInstance();

Severity: Major
Found in include/functions.image.php - About 4 hrs to fix

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

        public function getContextualFaqs($limit = 0)
        {
            $ret = false;
    
            $otherCriteria = new \CriteriaCompo();
    Severity: Minor
    Found in class/FaqHandler.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

    Method render has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function render(?array $block = null)
        {
            \xoops_load('XoopsFormLoader');
            \xoops_loadLanguage('common', $this->moduleDirNameUpper);
    
    
    Severity: Major
    Found in class/Common/Blocksadmin.php - About 3 hrs to fix

      File main.php has 323 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php declare(strict_types=1);
      
      /**
       * Module: SmartFAQ
       * Author: The SmartFactory <www.smartfactory.ca>
      Severity: Minor
      Found in admin/main.php - About 3 hrs to fix

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

            public function getFaqsFromSearch($queryarray = [], $andor = 'AND', $limit = 0, $offset = 0, $userid = 0)
            {
                global $xoopsUser;
        
                $ret              = [];
        Severity: Major
        Found in class/FaqHandler.php - About 3 hrs to fix

          Method editfaq has 92 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function editfaq(string $faqid = ''): void
          {
              global $answerHandler, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModule, $XOOPS_URL, $myts, $pathIcon16;
              /** @var Smartfaq\Helper $helper */
              $helper = Helper::getInstance();
          Severity: Major
          Found in admin/answer.php - About 3 hrs to fix

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

            function registerHook(fnHookTo, fnRef, hookType, optPm) {
                var hookPt, last = typeof optPm;
                if (fnHookTo == 'plgIn' || fnHookTo == 'postParse') return;
                if (typeof hookPts == 'undefined') hookPts = new Array();
                if (typeof hookPts[fnHookTo] == 'undefined') hookPts[fnHookTo] = new FunctionReference();
            Severity: Minor
            Found in assets/js/overlib/mini/overlib_mini.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

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

            function registerHook(fnHookTo, fnRef, hookType, optPm) {
                var hookPt, last = typeof optPm;
            
                if (fnHookTo == 'plgIn' || fnHookTo == 'postParse') return;
                if (typeof hookPts == 'undefined') hookPts = new Array();
            Severity: Minor
            Found in assets/js/overlib/overlib.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

            Function generateShadow has 89 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function generateShadow(content) {
                var wd, ht, X = 0, Y = 0, zIdx = 0, txt, dpObj, puObj, bS = '', aPos, posStr = new Array();
            
                if (!o3_shadow || (o3_shadowx == 0 && o3_shadowy == 0)) return;
            
            
            Severity: Major
            Found in assets/js/overlib/overlib_shadow.js - About 3 hrs to fix

              Function generateShadow has 89 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function generateShadow(content) {
                  var wd, ht, X = 0, Y = 0, zIdx = 0, txt, dpObj, puObj, bS = '', aPos, posStr = new Array();
                  if (!o3_shadow || (o3_shadowx == 0 && o3_shadowy == 0)) return;
                  X = Math.abs(o3_shadowx);
                  Y = Math.abs(o3_shadowy);
              Severity: Major
              Found in assets/js/overlib/mini/overlib_shadow_mini.js - About 3 hrs to fix

                File CategoryHandler.php has 314 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php declare(strict_types=1);
                
                namespace XoopsModules\Smartfaq;
                
                /**
                Severity: Minor
                Found in class/CategoryHandler.php - About 3 hrs to fix

                  Function scroll_placeLayer has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function scroll_placeLayer() {
                      var placeX, placeY, widthFix = 0;
                      var hasAnchor = (typeof o3_anchor != 'undefined' && o3_anchor);
                      if (eval('o3_frame.' + docRoot) && eval("typeof o3_frame." + docRoot + ".clientWidth=='number'") && eval('o3_frame.' + docRoot + '.clientWidth')) {
                          iwidth = eval('o3_frame.' + docRoot + '.clientWidth');
                  Severity: Major
                  Found in assets/js/overlib/mini/overlib_followscroll_mini.js - About 3 hrs to fix

                    Function scroll_placeLayer has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function scroll_placeLayer() {
                        var placeX, placeY, widthFix = 0;
                        var hasAnchor = (typeof o3_anchor != 'undefined' && o3_anchor);
                    
                        // HORIZONTAL PLACEMENT
                    Severity: Major
                    Found in assets/js/overlib/overlib_followscroll.js - About 3 hrs to fix

                      SmartDbTable has 29 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class SmartDbTable
                      {
                          /**
                           * @var string $_name name of the table
                           */
                      Severity: Minor
                      Found in class/SmartDbTable.php - About 3 hrs to fix

                        Function anchorPlaceLayer has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function anchorPlaceLayer() {
                            var placeX, placeY, widthFix = 0;
                            if (eval('o3_frame.' + docRoot) && eval("typeof o3_frame." + docRoot + ".clientWidth=='number'") && eval('o3_frame.' + docRoot + '.clientWidth')) {
                                iwidth = eval('o3_frame.' + docRoot + '.clientWidth');
                            } else if (typeof(o3_frame.innerWidth) == 'number') {
                        Severity: Major
                        Found in assets/js/overlib/mini/overlib_anchor_mini.js - About 3 hrs to fix

                          Function anchorPlaceLayer has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function anchorPlaceLayer() {
                              var placeX, placeY, widthFix = 0;
                          
                              // HORIZONTAL PLACEMENT
                              if (eval('o3_frame.' + docRoot) && eval("typeof o3_frame." + docRoot + ".clientWidth ==  'number'") && eval('o3_frame.' + docRoot + '.clientWidth')) {
                          Severity: Major
                          Found in assets/js/overlib/overlib_anchor.js - About 3 hrs to fix

                            File overlib_anchor.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            //\/////
                            //\  overLIB Anchor Plugin
                            //\  This file requires overLIB 4.00 or later.
                            //\
                            //\  overLIB 4.05 - You may not remove or change this notice.
                            Severity: Minor
                            Found in assets/js/overlib/overlib_anchor.js - About 3 hrs to fix

                              Method editfaq has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function editfaq($showmenu = false, $faqid = -1): void
                              {
                                  global $faqHandler, $categoryHandler, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModule, $XOOPS_URL, $myts;
                                  /** @var Smartfaq\Helper $helper */
                                  $helper = Smartfaq\Helper::getInstance();
                              Severity: Major
                              Found in admin/question.php - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language