mambax7/smartfaq

View on GitHub

Showing 374 of 649 total issues

Function getAnchorOffsets has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

function getAnchorOffsets(mkObj) {
    var fx = fy = 0, mp, puc, mkAry, sx = sy = 0, w = o3_anchoralign
    var mW = mH = pW = pH = 0
    var off = [0, 0]
    mkAry = w.split(',');
Severity: Minor
Found in assets/js/overlib/mini/overlib_anchor_mini.js - 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 getAnchorOffsets has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

function getAnchorOffsets(mkObj) {
    var fx = fy = 0, mp, puc, mkAry, sx = sy = 0, w = o3_anchoralign
    var mW = mH = pW = pH = 0
    var off = [0, 0]

Severity: Minor
Found in assets/js/overlib/overlib_anchor.js - 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($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: 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

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

function editfaq($showmenu = false, $faqid = -1, $answerid = -1, $merge = false): void
{
    global $answerHandler, $faqHandler, $categoryHandler, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModule, $XOOPS_URL, $myts;
    /** @var Smartfaq\Helper $helper */
    $helper = Helper::getInstance();
Severity: Major
Found in admin/faq.php - About 1 day to fix

    Function list_blocks has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

    function list_blocks(): void
    {
        global $query4redirect, $block_arr;
    
        // cachetime options
    Severity: Minor
    Found in admin/myblocksadmin.php - About 7 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 list_blocks has 194 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function list_blocks(): void
    {
        global $query4redirect, $block_arr;
    
        // cachetime options
    Severity: Major
    Found in admin/myblocksadmin.php - About 7 hrs to fix

      Function sf_createThumbnail has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
      Open

          function sf_createThumbnail($source, $thumb_width)
          {
              /** @var Smartfaq\Helper $helper */
              $helper = Smartfaq\Helper::getInstance();
      
      
      Severity: Minor
      Found in include/functions.image.php - About 7 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 olMain has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

      function olMain() {
          var layerhtml, styleType;
          runHook("olMain", FBEFORE);
          if (o3_background != "" || o3_fullhtml) {
              layerhtml = runHook('ol_content_background', FALTERNATE, o3_css, o3_text, o3_background, o3_fullhtml);
      Severity: Minor
      Found in assets/js/overlib/mini/overlib_mini.js - About 6 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 olMain has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

      function olMain() {
          var layerhtml, styleType;
          runHook("olMain", FBEFORE);
      
          if (o3_background != "" || o3_fullhtml) {
      Severity: Minor
      Found in assets/js/overlib/overlib.js - About 6 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 Faq.php has 401 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        File faq.php has 400 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/faq.php - About 5 hrs to fix

          Faq has 39 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Faq extends XoopsObject
          {
              public $db;
              /**
               * @var Smartfaq\Category|null
          Severity: Minor
          Found in class/Faq.php - About 5 hrs to fix

            Function parseCSSStyleExtras has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            function parseCSSStyleExtras(pf, i, ar) {
                var k = i;
                if (k < ar.length) {
                    if (ar[k] == CSSSTYLE) {
                        eval(pf + 'css=' + ar[k]);
            Severity: Minor
            Found in assets/js/overlib/mini/overlib_cssstyle_mini.js - 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 parseCSSStyleExtras has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            function parseCSSStyleExtras(pf, i, ar) {
                var k = i;
            
                if (k < ar.length) {
                    if (ar[k] == CSSSTYLE) {
            Severity: Minor
            Found in assets/js/overlib/overlib_cssstyle.js - 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 listBlocks has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
            Open

                public function listBlocks()
                : void
                {
                    global $xoopsModule, $pathIcon16;
                    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 admin.php has 353 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 language/english/admin.php - About 4 hrs to fix

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

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

                Function editfaq has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                function editfaq($showmenu = false, $faqid = -1, $answerid = -1, $merge = false): void
                {
                    global $answerHandler, $faqHandler, $categoryHandler, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModule, $XOOPS_URL, $myts;
                    /** @var Smartfaq\Helper $helper */
                    $helper = Helper::getInstance();
                Severity: Minor
                Found in admin/faq.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 OLonLoad_handler has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                function OLonLoad_handler(e) {
                    var re = /\w+\(.*\)[;\s]+/g, olre = /overlib\(|nd\(|cClick\(/, fn, l, i;
                
                    if (!olLoaded) olLoaded = 1;
                
                
                Severity: Minor
                Found in assets/js/overlib/overlib.js - 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 OLonLoad_handler has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                function OLonLoad_handler(e) {
                    var re = /\w+\(.*\)[;\s]+/g, olre = /overlib\(|nd\(|cClick\(/, fn, l, i;
                    if (!olLoaded) olLoaded = 1;
                    if (window.removeEventListener && e.eventPhase == 3) window.removeEventListener("load", OLonLoad_handler, false); else if (window.detachEvent) {
                        window.detachEvent("onload", OLonLoad_handler);
                Severity: Minor
                Found in assets/js/overlib/mini/overlib_mini.js - 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

                Severity
                Category
                Status
                Source
                Language