XoopsModules25x/news

View on GitHub

Showing 236 of 310 total issues

Method store has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function store($approved = false)
    {
        //$newpost = 0;
        $myts     = MyTextSanitizer::getInstance();
        $title    = $myts->censorString($this->title);
Severity: Major
Found in class/XoopsStory.php - About 3 hrs to fix

    Method getStats has 94 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getStats($limit)
        {
            $ret = [];
            /** @var \XoopsMySQLDatabase $db */
            $db   = \XoopsDatabaseFactory::getDatabaseConnection();
    Severity: Major
    Found in class/NewsStory.php - About 3 hrs to fix

      Method launchNewsletter has 93 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function launchNewsletter(): void
      {
          global $xoopsConfig, $dateformat;
          xoops_cp_header();
          $adminObject = Admin::getInstance();
      Severity: Major
      Found in admin/index.php - About 3 hrs to fix

        File article.php has 321 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php declare(strict_types=1);
        /*
         * You may not change or alter any portion of this comment or credits
         * of supporting developers from this source code or any supporting source code
         * which is considered copyrighted (c) material of the original comment or credit authors.
        Severity: Minor
        Found in article.php - About 3 hrs to fix

          Method news_search has 90 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function news_search($queryarray, $andor, $limit, $offset, $userid)
          {
              global $xoopsDB, $xoopsUser;
              $restricted = News\Utility::getModuleOption('restrictindex');
              $highlight  = false;
          Severity: Major
          Found in include/search.inc.php - About 3 hrs to fix

            Method store has 89 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function store()
                {
                    $myts   = MyTextSanitizer::getInstance();
                    $title  = '';
                    $imgurl = '';
            Severity: Major
            Found in class/XoopsTopic.php - About 3 hrs to fix

              Function renderNav has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function renderNav($offset = 4)
                  {
                      $ret = '';
                      if ($this->total <= $this->perpage) {
                          return $ret;
              Severity: Minor
              Found in class/PageNav.php - About 3 hrs 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 renderImageNav has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function renderImageNav($offset = 4)
                  {
                      if ($this->total < $this->perpage) {
                          return null;
                      }
              Severity: Minor
              Found in class/PageNav.php - About 3 hrs 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 launchExport has 80 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function launchExport(): void
              {
                  xoops_cp_header();
                  $adminObject = Admin::getInstance();
                  $adminObject->displayNavigation('index.php?op=export');
              Severity: Major
              Found in admin/index.php - About 3 hrs to fix

                Method modTopicS has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function modTopicS(): void
                {
                    global $xoopsDB, $xoopsModule;
                    $helper = Helper::getInstance();
                
                
                Severity: Major
                Found in admin/index.php - About 3 hrs to fix

                  Method autoStories has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function autoStories(): void
                  {
                      global $dateformat, $pathIcon16;
                  
                      $start        = Request::getInt('startauto', 0, 'GET');
                  Severity: Major
                  Found in admin/index.php - About 3 hrs to fix

                    Function updateBlock has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
                        {
                            $myblock = new \XoopsBlock($bid);
                            $myblock->setVar('title', $btitle);
                            $myblock->setVar('weight', $bweight);
                    Severity: Minor
                    Found in class/Common/Blocksadmin.php - About 2 hrs 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 orderBlock has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function orderBlock(
                            array $bid, array $oldtitle, array $oldside, array $oldweight, array $oldvisible, array $oldgroups, array $oldbcachetime, array $oldbmodule, array $title, array $weight, array $visible, array $side, array $bcachetime, array $groups, array $bmodule
                        ): void {
                            if (!$GLOBALS['xoopsSecurity']->check()) {
                                \redirect_header($_SERVER['SCRIPT_NAME'], 3, \implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
                    Severity: Minor
                    Found in class/Common/Blocksadmin.php - About 2 hrs 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_top_edit has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function b_news_top_edit($options)
                    {
                        global $xoopsDB;
                        $tmpstory = new NewsStory();
                        $form     = _MB_NEWS_ORDER . "&nbsp;<select name='options[]'>";
                    Severity: Minor
                    Found in blocks/news_top.php - About 2 hrs 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

                    File XoopsTopic.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php declare(strict_types=1);
                    
                    namespace XoopsModules\News;
                    
                    /**
                    Severity: Minor
                    Found in class/XoopsTopic.php - About 2 hrs to fix

                      Method addTopic has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function addTopic(): void
                      {
                          global $xoopsDB, $xoopsModule;
                          $helper = Helper::getInstance();
                      
                      
                      Severity: Major
                      Found in admin/index.php - About 2 hrs to fix

                        NewsTopic has 25 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class NewsTopic extends XoopsTopic
                        {
                            public $menu;
                            public $topic_description;
                            public $topic_frontpage;
                        Severity: Minor
                        Found in class/NewsTopic.php - About 2 hrs to fix

                          Function news_CreateMetaDatas has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function news_CreateMetaDatas($story = null): void
                          {
                              global $xoopsConfig, $xoTheme, $xoopsTpl;
                              $content = '';
                              $myts    = \MyTextSanitizer::getInstance();
                          Severity: Minor
                          Found in include/functions.php - About 2 hrs 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 createMetaDatas has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function createMetaDatas($story = null): void
                              {
                                  global $xoopsConfig, $xoTheme, $xoopsTpl;
                                  $content = '';
                                  $myts    = MyTextSanitizer::getInstance();
                          Severity: Minor
                          Found in class/Utility.php - About 2 hrs 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 getAllPublishedByAuthor has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getAllPublishedByAuthor($uid, $checkRight = false, $asobject = true)
                              {
                                  /** @var \XoopsMySQLDatabase $db */
                                  $db        = \XoopsDatabaseFactory::getDatabaseConnection();
                                  $myts      = \MyTextSanitizer::getInstance();
                          Severity: Major
                          Found in class/NewsStory.php - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language