mambax7/smartfaq

View on GitHub

Showing 374 of 649 total issues

Function sf_displayImage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    function sf_displayImage($image, $alt = '', $display = true, $extra = "class='forum_icon'")
    {
        $iconHandler = sf_getIconHandler();
        // START hacked by irmtfan
        // to show text links instead of buttons - func_num_args()==2 => only when $image, $alt is set and optional $display not set
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 editfaq has a Cognitive Complexity of 10 (exceeds 5 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: Minor
Found in admin/answer.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 insert has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function insert(\XoopsObject $object, $force = false)
    {
        if ('xoopsmodules\smartfaq\faq' !== \mb_strtolower(\get_class($object))) {
            return false;
        }
Severity: Minor
Found in class/FaqHandler.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 b_faqs_new_show has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function b_faqs_new_show($options)
{
    //    require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';

    $block = [];
Severity: Minor
Found in blocks/faqs_new.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 editcat has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function editcat($showmenu = false, $categoryid = 0): void
{
    //$moderators = []; // just to define the variable
    //$allmods = [];
    $startfaq = Request::getInt('startfaq', 0, 'GET');
Severity: Minor
Found in admin/category.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 b_faqs_recent_questions_show has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function b_faqs_recent_questions_show($options)
{
    //    require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';

    $block = [];
Severity: Minor
Found in blocks/faqs_recent_questions.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 parseExclusiveExtras has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function parseExclusiveExtras(pf, i, ar) {
    var k = i, v;

    olOverrideIsSet = false;  // a global variable

Severity: Minor
Found in assets/js/overlib/overlib_exclusive.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 getCount has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getCount($criteria = null, $notNullFields = '')
    {
        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq');
        if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) {
            $whereClause = $criteria->renderWhere();
Severity: Minor
Found in class/FaqHandler.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 getCountsByCat has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getCountsByCat($cat_id, $status)
    {
        global $xoopsUser;
        $ret = [];
        $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq');
Severity: Minor
Found in class/FaqHandler.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 _loadAllChildItemIds has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function _loadAllChildItemIds($itemId, &$childIds): void
    {
        if (!empty($this->_itemTree[$itemId]['children'])) {
            $first_child = $this->_itemTree[$itemId]['children'];
            foreach ($first_child as $fcid) {
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 deleteAttachment has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function deleteAttachment($attach_array = null)
    {
        /** @var Smartfaq\Helper $helper */
        $helper = Smartfaq\Helper::getInstance();

Severity: Minor
Found in class/Answer.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 updateTable has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateTable($table)
    {
        global $xoopsDB;

        $ret = true;
Severity: Minor
Found in class/SmartobjectDbupdater.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 overrideFaqsPermissions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function overrideFaqsPermissions($groups, $categoryid)
    {
        global $xoopsDB;

        $result      = true;
Severity: Minor
Found in class/Utility.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 loadSampleData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function loadSampleData(): void
{
    global $xoopsConfig;
    $moduleDirName      = \basename(\dirname(__DIR__));
    $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
Severity: Minor
Found in testdata/index.php - About 1 hr to fix

    Method toArray has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function toArray($faq = [], $category = null, $linkInQuestion = true)
        {
            /** @var Smartfaq\Helper $helper */
            $helper = Smartfaq\Helper::getInstance();
    
    
    Severity: Minor
    Found in class/Faq.php - About 1 hr to fix

      Method updateTable has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function updateTable($table)
          {
              global $xoopsDB;
      
              $ret = true;
      Severity: Minor
      Found in class/SmartobjectDbupdater.php - About 1 hr to fix

        Method getCountsByCat has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getCountsByCat($cat_id, $status)
            {
                global $xoopsUser;
                $ret = [];
                $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq');
        Severity: Minor
        Found in class/FaqHandler.php - About 1 hr to fix

          Method deleteAttachment has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function deleteAttachment($attach_array = null)
              {
                  /** @var Smartfaq\Helper $helper */
                  $helper = Smartfaq\Helper::getInstance();
          
          
          Severity: Minor
          Found in class/Answer.php - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                if (typeof o3_scroll != 'undefined' && o3_scroll && o3_sticky && (o3_relx || o3_rely) && (typeof o3_draggable == 'undefined' || !o3_draggable)) {
                    if (typeof over.scroller == 'undefined' || over.scroller.canScroll) over.scroller = new scroller(placeX - winoffset, placeY - scrolloffset, setTimeout("repositionOver()", 20));
                }
            Severity: Major
            Found in assets/js/overlib/mini/overlib_anchor_mini.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                  if (!olIe4 || olOp || !olIe55 || (typeof o3_shadow != 'undefined' && o3_shadow) || (typeof o3_bubble != 'undefined' && o3_bubble)) return;
              Severity: Major
              Found in assets/js/overlib/mini/overlib_hideform_mini.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language