XoopsModules25x/news

View on GitHub

Showing 236 of 310 total issues

Consider simplifying this complex logical expression.
Open

            if ((0 == $options[5]) && (1 == $options[4])
                && (($options[6] > 0 && $options[6] == $story->storyid())
                    || (0 == $options[6] && 0 == $key))) {
                $spotlight = [];
                $visible   = true;
Severity: Major
Found in blocks/news_top.php - About 40 mins to fix

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

    function news_search($queryarray, $andor, $limit, $offset, $userid)
    Severity: Minor
    Found in include/search.inc.php - About 35 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 getChildTreeArray has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function getChildTreeArray($sel_id = 0, $order = '', $perms = '', $parray = [], $r_prefix = '')
        Severity: Minor
        Found in class/NewsTopic.php - About 35 mins to fix

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

              protected function addSelectOptions($element, $fieldName, $key, $prefix_orig, $prefix_curr = ''): void
          Severity: Minor
          Found in class/ObjectTree.php - About 35 mins to fix

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

                public function __construct($total_items, $items_perpage, $current_start, $start_name = 'start', $extra_arg = '')
            Severity: Minor
            Found in class/PageNav.php - About 35 mins to fix

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

                      $ids,
                      $checkRight = true,
                      $asobject = true,
                      $order = 'published',
                      $onlyOnline = true
              Severity: Minor
              Found in class/NewsStory.php - About 35 mins to fix

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

                        $publish_start,
                        $publish_end,
                        $checkRight = false,
                        $asobject = true,
                        $order = 'published'
                Severity: Minor
                Found in class/NewsStory.php - About 35 mins to fix

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

                      public static function getAllExpired($limit = 0, $start = 0, $topic = 0, $ihome = 0, $asobject = true)
                  Severity: Minor
                  Found in class/NewsStory.php - About 35 mins to fix

                    Function getEditor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function getEditor($helper = null, $options = null)
                        {
                            /** @var Helper $helper */
                            if (null === $options) {
                                $options           = [];
                    Severity: Minor
                    Found in class/Common/SysUtility.php - About 35 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 createUploadName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function createUploadName($folder, $filename, $trimname = false)
                        {
                            $workingfolder = $folder;
                            if ('/' !== \xoops_substr($workingfolder, mb_strlen($workingfolder) - 1, 1)) {
                                $workingfolder .= '/';
                    Severity: Minor
                    Found in class/Files.php - About 35 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 makeSelBoxOptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = ''): void
                        {
                            if ($key > 0) {
                                $value = $this->tree[$key]['obj']->getVar($this->myId);
                                $ret   .= '<option value="' . $value . '"';
                    Severity: Minor
                    Found in class/ObjectTree.php - About 35 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 news_resizePicture has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function news_resizePicture(
                        $src_path,
                        $dst_path,
                        $param_width,
                        $param_height,
                    Severity: Minor
                    Found in include/functions.php - About 35 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 news_notify_iteminfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function news_notify_iteminfo($category, $item_id)
                    {
                        if ('global' === $category) {
                            $item['name'] = '';
                            $item['url']  = '';
                    Severity: Minor
                    Found in include/notification.inc.php - About 35 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 delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function delete($keyword): void
                        {
                            if (\is_array($keyword)) {
                                foreach ($keyword as $onekeyword) {
                                    if (isset($this->keywords[$onekeyword])) {
                    Severity: Minor
                    Found in class/Blacklist.php - About 35 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 getTopicsList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getTopicsList($frontpage = false, $perms = false)
                        {
                            $ret = [];
                            $sql = 'SELECT topic_id, topic_pid, topic_title, topic_color FROM ' . $this->table . ' WHERE 1 ';
                            if ($frontpage) {
                    Severity: Minor
                    Found in class/NewsTopic.php - About 35 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 hometext has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function hometext($format = 'Show')
                        {
                            $hometext = '';
                            $myts     = \MyTextSanitizer::getInstance();
                            $html     = $smiley = $xcodes = 1;
                    Severity: Minor
                    Found in class/NewsStory.php - About 35 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 bodytext has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function bodytext($format = 'Show')
                        {
                            $myts   = \MyTextSanitizer::getInstance();
                            $html   = 1;
                            $smiley = 1;
                    Severity: Minor
                    Found in class/NewsStory.php - About 35 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 getEditor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function getEditor($helper = null, $options = null)
                        {
                            /** @var Helper $helper */
                            if (null === $options) {
                                $options           = [];
                    Severity: Minor
                    Found in class/Utility.php - About 35 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 hometext has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function hometext($format = 'Show')
                        {
                            $myts   = MyTextSanitizer::getInstance();
                            $html   = 1;
                            $smiley = 1;
                    Severity: Minor
                    Found in class/XoopsStory.php - About 35 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

                    Severity
                    Category
                    Status
                    Source
                    Language