mambax7/smartfaq

View on GitHub

Showing 374 of 649 total issues

Function orderBlock has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function orderBlock(
        array $bid,
        array $oldtitle,
        array $oldside,
        array $oldweight,
Severity: Minor
Found in class/Common/Blocksadmin.php - About 2 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 checkVerModule has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public static function checkVerModule(Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array
    {
        $moduleDirName      = \basename(\dirname(__DIR__, 2));
        $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
        $update             = '';
Severity: Minor
Found in class/Common/VersionChecks.php - About 2 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 68 lines of code (exceeds 25 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: Major
Found in assets/js/overlib/mini/overlib_cssstyle_mini.js - About 2 hrs to fix

    Function parseCSSStyleExtras has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function parseCSSStyleExtras(pf, i, ar) {
        var k = i;
    
        if (k < ar.length) {
            if (ar[k] == CSSSTYLE) {
    Severity: Major
    Found in assets/js/overlib/overlib_cssstyle.js - About 2 hrs to fix

      Method myblocksadmin_update_block has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function myblocksadmin_update_block(
          $bid,
          $bside,
          $bweight,
          $bvisible,
      Severity: Major
      Found in include/blocksadmin.inc.php - About 2 hrs to fix

        Function addSrcToDestList has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        function addSrcToDestList() {
            destList = window.document.forms[0].destList;
            srcList = window.document.forms[0].srcList;
            var len = destList.length;
            for (var i = 0; i < srcList.length; i++) {
        Severity: Minor
        Found in admin/funcs.js - About 2 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 truncateHtml has 63 lines of code (exceeds 25 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: Major
        Found in class/Common/SysUtility.php - About 2 hrs to fix

          File Answer.php has 271 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            Method getObjectsAdminSide has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getObjectsAdminSide(\CriteriaElement $criteria = null, $id_as_key = false, $notNullFields = '')
                {
                    $ret   = [];
                    $limit = $start = 0;
                    $sql   = 'SELECT
            Severity: Major
            Found in class/FaqHandler.php - About 2 hrs to fix

              Function deleteDirectory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function deleteDirectory($src)
                  {
                      // Only continue if user is a 'global' Admin
                      if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                          return false;
              Severity: Minor
              Found in class/Common/FilesManagement.php - About 2 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 displayAttachment has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function displayAttachment($asSource = false)
                  {
                      global $xoopsModule;
                      /** @var Smartfaq\Helper $helper */
                      $helper = Smartfaq\Helper::getInstance();
              Severity: Minor
              Found in class/Answer.php - About 2 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 getLinkedUnameFromId has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getLinkedUnameFromId($userid = 0, $name = 0, $users = [])
                  {
                      if (!\is_numeric($userid)) {
                          return $userid;
                      }
              Severity: Minor
              Found in class/Utility.php - About 2 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

              FaqHandler has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class FaqHandler extends \XoopsObjectHandler
              {
                  protected $helper;
              
                  /**
              Severity: Minor
              Found in class/FaqHandler.php - About 2 hrs to fix

                Method getContextualFaqs has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getContextualFaqs($limit = 0)
                    {
                        $ret = false;
                
                        $otherCriteria = new \CriteriaCompo();
                Severity: Major
                Found in class/FaqHandler.php - About 2 hrs to fix

                  File question.php has 261 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/question.php - About 2 hrs to fix

                    Function getObjectsAdminSide has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getObjectsAdminSide(\CriteriaElement $criteria = null, $id_as_key = false, $notNullFields = '')
                        {
                            $ret   = [];
                            $limit = $start = 0;
                            $sql   = 'SELECT
                    Severity: Minor
                    Found in class/FaqHandler.php - About 2 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 getFaqs has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getFaqs(
                            $limit = 0,
                            $start = 0,
                            $status = '',
                            $categoryid = -1,
                    Severity: Minor
                    Found in class/FaqHandler.php - About 2 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 getObjects has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getObjects(\CriteriaElement $criteria = null, $id_as_key = false, $notNullFields = '')
                        {
                            $ret   = [];
                            $limit = $start = 0;
                            $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq');
                    Severity: Minor
                    Found in class/FaqHandler.php - About 2 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 render has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function render(?array $block = null)
                        {
                            \xoops_load('XoopsFormLoader');
                            \xoops_loadLanguage('common', $this->moduleDirNameUpper);
                    
                    
                    Severity: Minor
                    Found in class/Common/Blocksadmin.php - About 2 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 reOrder has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function reOrder(hookPt, fnRef, order) {
                        if (!order || typeof order == 'undefined' || typeof order == 'number') return;
                    
                        var newPt = new Array(), match;
                    
                    
                    Severity: Major
                    Found in assets/js/overlib/overlib.js - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language