XoopsModules25x/news

View on GitHub

Showing 236 of 310 total issues

Function news_createmeta_keywords has a Cognitive Complexity of 16 (exceeds 5 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: 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 createMetaKeywords has a Cognitive Complexity of 16 (exceeds 5 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: 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 isBlockCloned has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
    {
        \xoops_loadLanguage('admin', 'system');
        \xoops_loadLanguage('admin/blocksadmin', 'system');
        \xoops_loadLanguage('admin/groups', 'system');
Severity: Major
Found in class/Common/Blocksadmin.php - About 2 hrs to fix

    File Files.php has 253 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Method lastStories has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function lastStories(): void
      {
          global $dateformat, $pathIcon16;
          news_collapsableBar('laststories', 'toplaststories');
          echo "<img onclick=\"toggle('toptable'); toggleIcon('toptableicon');\" id='toplaststories' name='toplaststories' src='" . $pathIcon16 . "/close12.gif' alt=''></a>&nbsp;" . sprintf(_AM_LAST10ARTS, Utility::getModuleOption('storycountadmin')) . '</h4>';
      Severity: Major
      Found in admin/index.php - About 2 hrs to fix

        Function b_news_randomnews_show has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        function b_news_randomnews_show($options)
        {
            /** @var Helper $helper */
            if (!class_exists(Helper::class)) {
                return false;
        Severity: Minor
        Found in blocks/news_randomnews.php - About 1 hr 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 checkVerModule has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function checkVerModule(
                \Xmf\Module\Helper $helper,
                ?string            $source = null,
                ?string            $default = null
            ): ?array {
        Severity: Minor
        Found in class/Common/VersionChecks.php - About 1 hr 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 getStats has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        function getStats(): void
        {
            global $xoopsModule, $xoopsConfig;
            xoops_cp_header();
            $myts   = \MyTextSanitizer::getInstance();
        Severity: Minor
        Found in admin/index.php - About 1 hr 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 getAllPublishedByAuthor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getAllPublishedByAuthor($uid, $checkRight = false, $asobject = true)
            {
                /** @var \XoopsMySQLDatabase $db */
                $db        = \XoopsDatabaseFactory::getDatabaseConnection();
                $myts      = \MyTextSanitizer::getInstance();
        Severity: Minor
        Found in class/NewsStory.php - About 1 hr 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 b_news_topicsnav_show has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function b_news_topicsnav_show($options)
        {
            /** @var Helper $helper */
            if (!class_exists(Helper::class)) {
                return false;
        Severity: Minor
        Found in blocks/news_topicsnav.php - About 1 hr to fix

          Method orderBlock has 15 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  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
          Severity: Major
          Found in class/Common/Blocksadmin.php - About 1 hr to fix

            Method checkVerModule has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function checkVerModule(
                    \Xmf\Module\Helper $helper,
                    ?string            $source = null,
                    ?string            $default = null
                ): ?array {
            Severity: Minor
            Found in class/Common/VersionChecks.php - About 1 hr to fix

              Function news_close_tags has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              function news_close_tags($string)
              {
                  // match opened tags
                  if (preg_match_all('/<([a-z\:\-]+)[^\/]>/', $string, $start_tags)) {
                      $start_tags = $start_tags[1];
              Severity: Minor
              Found in include/functions.php - About 1 hr 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 closeTags has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function closeTags($string)
                  {
                      // match opened tags
                      if (\preg_match_all('/<([a-z\:\-]+)[^\/]>/', $string, $start_tags)) {
                          $start_tags = $start_tags[1];
              Severity: Minor
              Found in class/Utility.php - About 1 hr 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 auto_summary has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function auto_summary($text, &$titles)
                  {
                      $auto_summary = '';
                      if (Utility::getModuleOption('enhanced_pagenav')) {
                          $expr_matches = [];
              Severity: Minor
              Found in class/NewsStory.php - About 1 hr 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 b_news_archives_show has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function b_news_archives_show($options)
              {
                  global $xoopsDB, $xoopsConfig;
                  // require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
                  require_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/calendar.php';
              Severity: Minor
              Found in blocks/news_archives.php - About 1 hr to fix

                Method b_news_topics_moderate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function b_news_topics_moderate()
                {
                    // require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
                
                    /** @var Helper $helper */
                Severity: Minor
                Found in blocks/news_moderate.php - About 1 hr to fix

                  Method updateBlock has 41 lines of code (exceeds 25 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 1 hr to fix

                    Function loadTableFromArrayWithReplace has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function loadTableFromArrayWithReplace($table, $data, $search, $replace)
                    {
                        /** @var \XoopsMySQLDatabase $db */
                        $db = \XoopsDatabaseFactory::getDatabaseConnection();
                    
                    
                    Severity: Minor
                    Found in testdata/index.php - About 1 hr 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 delTopic has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function delTopic(): void
                    {
                        global $xoopsDB, $xoopsModule;
                        if (!isset($_POST['ok'])) {
                            xoops_cp_header();
                    Severity: Minor
                    Found in admin/index.php - About 1 hr 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