mambax7/smartfaq

View on GitHub

Showing 374 of 649 total issues

Function alterTable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function alterTable()
    {
        global $xoopsDB;

        $ret = true;
Severity: Minor
Found in class/SmartDbTable.php - About 45 mins 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 getWhoAndWhen has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getWhoAndWhen($answerObj = null, $users = [])
    {
        /** @var Smartfaq\Helper $helper */
        $helper            = Smartfaq\Helper::getInstance();
        $smartModuleConfig = $helper->getConfig();
Severity: Minor
Found in class/Faq.php - About 45 mins 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 getCategories has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $limit = 0,
        $start = 0,
        $parentid = 0,
        $sort = 'weight',
        $order = 'ASC',
Severity: Minor
Found in class/CategoryHandler.php - About 45 mins to fix

    Method makeMySelBox has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $sel_name = '', $onchange = ''): void
    Severity: Minor
    Found in class/Tree.php - About 45 mins to fix

      Method getAllAnswers has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $faqid = 0,
              $status = -1,
              $limit = 0,
              $start = 0,
              $sort = 'datesub',
      Severity: Minor
      Found in class/AnswerHandler.php - About 45 mins to fix

        Function question has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function question($maxLength = 0, $format = 'S')
            {
                $ret = $this->getVar('question', $format);
                if (('s' === $format) || ('S' === $format) || ('show' === $format)) {
                    $myts = MyTextSanitizer::getInstance();
        Severity: Minor
        Found in class/Faq.php - About 45 mins 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 getCategoriesWithOpenQuestionsCount has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getCategoriesWithOpenQuestionsCount($parentid = 0)
            {
                if (-1 == $parentid) {
                    return $this->getCount();
                }
        Severity: Minor
        Found in class/CategoryHandler.php - About 45 mins 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

        Consider simplifying this complex logical expression.
        Open

            if (o3_followscroll && 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, o3_followscrollrefresh);
            }
        Severity: Major
        Found in assets/js/overlib/mini/overlib_followscroll_mini.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

              if (o3_followscroll && 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, o3_followscrollrefresh);
              }
          Severity: Major
          Found in assets/js/overlib/overlib_followscroll.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                        if ($oldtitle[$i] !== $title[$i]
                            || $oldweight[$i] !== $weight[$i]
                            || $oldvisible[$i] !== $visible[$i]
                            || $oldside[$i] !== $side[$i]
                            || $oldbcachetime[$i] !== $bcachetime[$i]
            Severity: Major
            Found in class/Common/Blocksadmin.php - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

              if (!($isAdmin
                    || (null !== $helper->getConfig('allowrequest')
                        && 1 == $helper->getConfig('allowrequest')
                        && (is_object($xoopsUser) || (null !== $helper->getConfig('anonpost') && 1 == $helper->getConfig('anonpost')))))) {
                  redirect_header('index.php', 1, _NOPERM);
              Severity: Major
              Found in request.php - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                if (!($isAdmin
                      || (null !== $helper->getConfig('allowsubmit') && 1 == $helper->getConfig('allowsubmit')
                          && (is_object($xoopsUser)
                              || (null !== $helper->getConfig('anonpost')
                                  && 1 == $helper->getConfig('anonpost')))))) {
                Severity: Major
                Found in submit.php - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if ($isAdmin
                              || (isset($smartConfig['allowsubmit']) && 1 == $smartConfig['allowsubmit']
                                  && (is_object($xoopsUser)
                                      || (isset($smartConfig['anonpost'])
                                          && 1 == $smartConfig['anonpost'])))) {
                  Severity: Major
                  Found in xoops_version.php - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if ($isAdmin
                                || (isset($smartConfig['allowrequest']) && 1 == $smartConfig['allowrequest']
                                    && (is_object($xoopsUser)
                                        || (isset($smartConfig['anonpost'])
                                            && 1 == $smartConfig['anonpost'])))) {
                    Severity: Major
                    Found in xoops_version.php - About 40 mins to fix

                      Method truncateHtml has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
                      Severity: Minor
                      Found in class/Common/SysUtility.php - About 35 mins to fix

                        Method sf_getButton has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            function sf_getButton($link, $button, $alt = '', $asImage = true, $extra = "class='forum_button'")
                        Severity: Minor
                        Found in include/functions.render.php - About 35 mins to fix

                          Method smartfaq_search has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function smartfaq_search($queryarray, $andor, $limit, $offset, $userid)
                          Severity: Minor
                          Found in include/search.inc.php - About 35 mins to fix

                            Method getFaqsFromSearch has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public function getFaqsFromSearch($queryarray = [], $andor = 'AND', $limit = 0, $offset = 0, $userid = 0)
                            Severity: Minor
                            Found in class/FaqHandler.php - About 35 mins to fix

                              Method getCategoriesWithOpenQuestion has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      $limit = 0,
                                      $start = 0,
                                      $parentid = 0,
                                      $sort = 'weight',
                                      $order = 'ASC'
                              Severity: Minor
                              Found in class/CategoryHandler.php - About 35 mins to fix

                                Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize = 0, $maxWidth = 0, $maxHeight = 0)
                                Severity: Minor
                                Found in class/Uploader.php - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language