XoopsModules25x/news

View on GitHub

Showing 310 of 310 total issues

Method makeSelectElement has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $name,
        $fieldName,
        $prefix = '-',
        $selected = '',
        $addEmptyOption = false,
Severity: Major
Found in class/ObjectTree.php - About 1 hr to fix

    Method isBlockCloned has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
    Severity: Major
    Found in class/Common/Blocksadmin.php - About 1 hr to fix

      Method getAllPublished has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $limit = 0,
              $start = 0,
              $checkRight = false,
              $topic = 0,
              $ihome = 0,
      Severity: Major
      Found in class/NewsStory.php - About 1 hr to fix

        Function remove_blacklisted has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function remove_blacklisted($keywords)
            {
                $ret       = [];
                $tmp_array = \array_values($this->keywords);
                foreach ($keywords as $onekeyword) {
        Severity: Minor
        Found in class/Blacklist.php - About 55 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 addkeywords has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function addkeywords($keyword): void
            {
                $myts = \MyTextSanitizer::getInstance();
                if (\is_array($keyword)) {
                    foreach ($keyword as $onekeyword) {
        Severity: Minor
        Found in class/Blacklist.php - About 55 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 b_news_randomnews_edit has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        function b_news_randomnews_edit($options)
        {
            global $xoopsDB;
            $form = _MB_NEWS_ORDER . "&nbsp;<select name='options[]'>";
            $form .= "<option value='published'";
        Severity: Minor
        Found in blocks/news_randomnews.php - About 55 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 rcopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function rcopy($src, $dest)
            {
                // 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 55 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 recurseCopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function recurseCopy($src, $dst): void
            {
                $dir = \opendir($src);
                //        @mkdir($dst);
                if (!@\mkdir($dst) && !\is_dir($dst)) {
        Severity: Minor
        Found in class/Common/FilesManagement.php - About 55 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 rmove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function rmove($src, $dest)
            {
                // 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 55 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 b_news_bigstory_show has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        function b_news_bigstory_show()
        {
            // require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
        
            /** @var Helper $helper */
        Severity: Minor
        Found in blocks/news_bigstory.php - About 55 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 getAllSubmitted has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getAllSubmitted($limit = 0, $asobject = true, $checkRight = false, $start = 0)
            {
                /** @var \XoopsMySQLDatabase $db */
                $db       = \XoopsDatabaseFactory::getDatabaseConnection();
                $myts     = \MyTextSanitizer::getInstance();
        Severity: Minor
        Found in class/NewsStory.php - About 55 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 uname has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function uname($uid = 0)
            {
                global $xoopsConfig;
                static $tblusers = [];
                $option = -1;
        Severity: Minor
        Found in class/NewsStory.php - About 55 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 getAllStoriesCount has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getAllStoriesCount($storytype = 1, $checkRight = false)
            {
                /** @var \XoopsMySQLDatabase $db */
                $db  = \XoopsDatabaseFactory::getDatabaseConnection();
                $sql = 'SELECT count(*) AS cpt FROM ' . $db->prefix('news_stories') . ' WHERE ';
        Severity: Minor
        Found in class/NewsStory.php - About 55 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 store has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function store($approved = false)
            {
                $myts        = \MyTextSanitizer::getInstance();
                $counter     = $this->counter ?? 0;
                $title       = $GLOBALS['xoopsDB']->escape($myts->censorString($this->title));
        Severity: Minor
        Found in class/NewsStory.php - About 55 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 _searchPreviousOrNextArticle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _searchPreviousOrNextArticle($storyid, $next = true, $checkRight = false)
            {
                /** @var \XoopsMySQLDatabase $db */
                $db      = \XoopsDatabaseFactory::getDatabaseConnection();
                $ret     = [];
        Severity: Minor
        Found in class/NewsStory.php - About 55 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                echo "<td align='center'><b>" . $eachstory->storyid() . "</b>
                    </td><td align='left'><a href='" . XOOPS_URL . '/modules/news/article.php?storyid=' . $eachstory->storyid() . "'>" . $eachstory->title() . "</a>
                    </td><td align='center'>" . $topic->topic_title() . "
                    </td><td align='center'><a href='" . XOOPS_URL . '/userinfo.php?uid=' . $eachstory->uid() . "'>" . $eachstory->uname() . "</a></td><td align='center' class='nw'>" . $published . "</td><td align='center'>" . $eachstory->counter() . "</td><td align='center'>
        Severity: Minor
        Found in admin/index.php and 1 other location - About 55 mins to fix
        admin/index.php on lines 368..371

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 98.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    echo "<td align='center'><b>" . $eachstory->storyid() . "</b>
                        </td><td align='left'><a href='" . XOOPS_URL . '/modules/news/article.php?returnside=1&amp;storyid=' . $eachstory->storyid() . "'>" . $eachstory->title() . "</a>
                        </td><td align='center'>" . $topic->topic_title() . "
                        </td><td align='center'><a href='" . XOOPS_URL . '/userinfo.php?uid=' . $eachstory->uid() . "'>" . $eachstory->uname() . "</a></td><td align='center' class='nw'>" . $created . "</td><td align='center' class='nw'>" . $expired . "</td><td align='center'>
        Severity: Minor
        Found in admin/index.php and 1 other location - About 55 mins to fix
        admin/index.php on lines 293..296

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 98.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method makeSelBox has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                $name,
                $fieldName,
                $prefix = '-',
                $selected = '',
                $addEmptyOption = false,
        Severity: Major
        Found in class/ObjectTree.php - About 50 mins to fix

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

                  $title,
                  $order,
                  $preset_id,
                  $none,
                  $sel_name,
          Severity: Major
          Found in class/NewsTopic.php - About 50 mins to fix

            Method setOrder has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function setOrder(string $bid, string $title, string $weight, string $visible, string $side, string $bcachetime, ?array $bmodule = null): void
            Severity: Major
            Found in class/Common/Blocksadmin.php - About 50 mins to fix
              Severity
              Category
              Status
              Source
              Language