mambax7/smartfaq

View on GitHub

Showing 374 of 649 total issues

Function editfaq has a Cognitive Complexity of 12 (exceeds 5 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: Minor
Found in admin/question.php - About 1 hr 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 sf_displayTarea has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    function &sf_displayTarea(&$text, $html = 0, $smiley = 1, $xcode = 1, $image = 1, $br = 1)
    {
        global $myts;

        if (1 != $html) {
Severity: Minor
Found in include/functions.render.php - About 1 hr 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 getRefByName has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function getRefByName(l, d) {
    var r = null, j

    d = (d || document)

Severity: Minor
Found in assets/js/overlib/overlib_anchor.js - About 1 hr 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 isBlockCloned has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
    {
        \xoops_loadLanguage('admin', 'system');
        \xoops_loadLanguage('admin/blocksadmin', 'system');
        \xoops_loadLanguage('admin/groups', 'system');
Severity: Minor
Found in class/Common/Blocksadmin.php - About 1 hr 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 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function render()
    {
        // load all child ids for javascript codes
        foreach (\array_keys($this->_itemTree) as $item_id) {
            $this->_itemTree[$item_id]['allchild'] = [];
Severity: Minor
Found in class/GroupPermForm.php - About 1 hr 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 makeMySelBox has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $sel_name = '', $onchange = ''): void
    {
        if ('' === $sel_name) {
            $sel_name = $this->id;
        }
Severity: Minor
Found in class/Tree.php - About 1 hr 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 getCategoriesWithOpenQuestion has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function &getCategoriesWithOpenQuestion(
        $limit = 0,
        $start = 0,
        $parentid = 0,
        $sort = 'weight',
Severity: Minor
Found in class/CategoryHandler.php - About 1 hr to fix

    Function getAnchorLocation has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getAnchorLocation(objRef) {
        var mkObj, of, offsets, mlyr
        mkObj = mlyr = objRef
        offsets = [o3_anchorx, o3_anchory]
        if (document.layers) {
    Severity: Minor
    Found in assets/js/overlib/mini/overlib_anchor_mini.js - About 1 hr to fix

      Function getAnchorLocation has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getAnchorLocation(objRef) {
          var mkObj, of, offsets, mlyr
      
          mkObj = mlyr = objRef
          offsets = [o3_anchorx, o3_anchory]
      Severity: Minor
      Found in assets/js/overlib/overlib_anchor.js - About 1 hr to fix

        Method cloneBlock has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function cloneBlock(int $bid)
            : void {
                //require __DIR__ . '/admin_header.php';
                //        \xoops_cp_header();
        
        
        Severity: Minor
        Found in class/Common/Blocksadmin.php - About 1 hr to fix

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

              public function render()
              {
                  $ret = '';
          
                  if (\count($this->_appendix) > 0) {
          Severity: Minor
          Found in class/GroupFormCheckBox.php - About 1 hr to fix

            Method smartfaq_notify_iteminfo has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function smartfaq_notify_iteminfo($category, $item_id)
            {
                global $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
            
                if (empty($xoopsModule) || 'smartfaq' !== $xoopsModule->getVar('dirname')) {
            Severity: Minor
            Found in include/notification.inc.php - About 1 hr to fix

              Method editBlock has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function editBlock(int $bid)
                  : void {
                      //        require_once \dirname(__DIR__,2) . '/admin/admin_header.php';
                      //        \xoops_cp_header();
                      \xoops_loadLanguage('admin', 'system');
              Severity: Minor
              Found in class/Common/Blocksadmin.php - About 1 hr to fix

                Function parseAnchorExtras has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                function parseAnchorExtras(pf, i, ar) {
                    var v, k = i;
                    if (k < ar.length) {
                        if (ar[k] == ANCHOR) {
                            eval(pf + "anchor='" + escSglQuote(ar[++k]) + "'");
                Severity: Minor
                Found in assets/js/overlib/mini/overlib_anchor_mini.js - About 1 hr 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 myblocksadmin_update_block has 10 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    $bid,
                    $bside,
                    $bweight,
                    $bvisible,
                    $btitle,
                Severity: Major
                Found in include/blocksadmin.inc.php - About 1 hr to fix

                  Function parseAnchorExtras has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function parseAnchorExtras(pf, i, ar) {
                      var v, k = i;
                  
                      if (k < ar.length) {
                          if (ar[k] == ANCHOR) {
                  Severity: Minor
                  Found in assets/js/overlib/overlib_anchor.js - About 1 hr 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 rrmdir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function rrmdir($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 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function &getObjects(CriteriaElement $criteria = null, $id_as_key = false, $as_object = true)
                      {
                          $ret   = [];
                          $limit = $start = 0;
                          $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers');
                  Severity: Minor
                  Found in class/AnswerHandler.php - About 1 hr 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 sendNotifications has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function sendNotifications($notifications = []): void
                      {
                          $smartModule = Smartfaq\Utility::getModuleInfo();
                  
                          $myts = MyTextSanitizer::getInstance();
                  Severity: Minor
                  Found in class/Faq.php - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getObjects($criteria = null, $id_as_key = false)
                      {
                          $ret   = [];
                          $limit = $start = 0;
                          $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories');
                  Severity: Minor
                  Found in class/CategoryHandler.php - About 1 hr 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