XoopsModules25x/news

View on GitHub

Showing 236 of 310 total issues

Function news_search has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

function news_search($queryarray, $andor, $limit, $offset, $userid)
{
    global $xoopsDB, $xoopsUser;
    $restricted = News\Utility::getModuleOption('restrictindex');
    $highlight  = false;
Severity: Minor
Found in include/search.inc.php - About 6 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 privBuildMimeArray has 154 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function privBuildMimeArray()
    {
        return [
            'ez'      => 'application/andrew-inset',
            'hqx'     => 'application/mac-binhex40',
Severity: Major
Found in class/Mimetype.php - About 6 hrs to fix

    Function xoops_module_update_news has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

    function xoops_module_update_news()
    {
        global $xoopsDB;
        $errors = 0;
    
    
    Severity: Minor
    Found in include/update_function.php - About 6 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 xoops_module_update_news has 149 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function xoops_module_update_news()
    {
        global $xoopsDB;
        $errors = 0;
    
    
    Severity: Major
    Found in include/update_function.php - About 5 hrs to fix

      File XoopsStory.php has 412 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php declare(strict_types=1);
      
      namespace XoopsModules\News;
      
      use MyTextSanitizer;
      Severity: Minor
      Found in class/XoopsStory.php - About 5 hrs to fix

        Method listBlocks has 144 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function listBlocks(): void
            {
                global $xoopsModule, $pathIcon16;
                require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                //        xoops_loadLanguage('admin', 'system');
        Severity: Major
        Found in class/Common/Blocksadmin.php - About 5 hrs to fix

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

          function getStats(): void
          {
              global $xoopsModule, $xoopsConfig;
              xoops_cp_header();
              $myts   = \MyTextSanitizer::getInstance();
          Severity: Major
          Found in admin/index.php - About 5 hrs to fix

            Function topicsmanager has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
            Open

            function topicsmanager(): void
            {
                global $xoopsDB, $xoopsConfig, $xoopsModule, $myts;
                require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
                xoops_cp_header();
            Severity: Minor
            Found in admin/index.php - About 5 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 getAllPublished has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getAllPublished(
                    $limit = 0,
                    $start = 0,
                    $checkRight = false,
                    $topic = 0,
            Severity: Minor
            Found in class/NewsStory.php - About 5 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 getRandomNews has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getRandomNews(
                    $limit = 0,
                    $start = 0,
                    $checkRight = false,
                    $topic = 0,
            Severity: Minor
            Found in class/NewsStory.php - About 4 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 store has 120 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Method createMetaKeywords has 119 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function createMetaKeywords($content)
                  {
                      global $cfg;
                      require_once XOOPS_ROOT_PATH . '/modules/news/config.php';
                      // require_once XOOPS_ROOT_PATH . '/modules/news/class/blacklist.php';
              Severity: Major
              Found in class/Utility.php - About 4 hrs to fix

                Method news_createmeta_keywords has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function news_createmeta_keywords($content)
                {
                    require_once XOOPS_ROOT_PATH . '/modules/news/config.php';
                    // require_once XOOPS_ROOT_PATH . '/modules/news/class/blacklist.php';
                    // require_once XOOPS_ROOT_PATH . '/modules/news/class/registryfile.php';
                Severity: Major
                Found in include/functions.php - About 4 hrs to fix

                  Function listBlocks has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function listBlocks(): void
                      {
                          global $xoopsModule, $pathIcon16;
                          require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                          //        xoops_loadLanguage('admin', 'system');
                  Severity: Minor
                  Found in class/Common/Blocksadmin.php - About 4 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 prepare2show has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function prepare2show($filescount)
                      {
                          global $xoopsUser, $xoopsConfig, $xoopsModule;
                          /** @var News\Helper $helper */
                          $helper = Helper::getInstance();
                  Severity: Minor
                  Found in class/NewsStory.php - About 4 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 prepare2show has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function prepare2show($filescount)
                      {
                          global $xoopsUser, $xoopsConfig, $xoopsModule;
                          /** @var News\Helper $helper */
                          $helper = Helper::getInstance();
                  Severity: Major
                  Found in class/NewsStory.php - About 4 hrs to fix

                    Function modTopicS has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function modTopicS(): void
                    {
                        global $xoopsDB, $xoopsModule;
                        $helper = Helper::getInstance();
                    
                    
                    Severity: Minor
                    Found in admin/index.php - About 4 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 store has 97 lines of code (exceeds 25 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: Major
                    Found in class/NewsStory.php - About 3 hrs to fix

                      Method b_news_top_edit has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function b_news_top_edit($options)
                      {
                          global $xoopsDB;
                          $tmpstory = new NewsStory();
                          $form     = _MB_NEWS_ORDER . "&nbsp;<select name='options[]'>";
                      Severity: Major
                      Found in blocks/news_top.php - About 3 hrs to fix

                        Method render has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function render(?array $block = null): void
                            {
                                \xoops_load('XoopsFormLoader');
                                \xoops_loadLanguage('common', $this->moduleDirNameUpper);
                        
                        
                        Severity: Major
                        Found in class/Common/Blocksadmin.php - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language