XoopsModules25x/rss

View on GitHub

Showing 80 of 101 total issues

Function xoops_module_update_rssfit has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

function xoops_module_update_rssfit(\XoopsModule $module, int $previousVersion): bool
{
    $moduleDirName      = \basename(\dirname(__DIR__));

    /** @var Rssfit\Helper $helper */
Severity: Minor
Found in include/onupdate.php - About 1 day 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 truncateHtml has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

    public static function truncateHtml(
        string $text,
        ?int $length = 100,
        string $ending = '...',
        bool $exact = false,
Severity: Minor
Found in class/Common/SysUtility.php - About 1 day 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 getRssFeedAsHtml has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getRssFeedAsHtml(string $feed_url, int $maxItemCount = 10, bool $show_date = true, bool $show_description = true, int $max_words = 0, int $cache_timeout = 7200, string $cache_prefix = XOOPS_VAR_PATH . '/caches/xoops_cache/rss2html-'): string
    {
        $result = '';
        // get feeds and parse items
        $rss       = new \DOMDocument();
Severity: Minor
Found in class/Utility.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 getItems has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    public function getItems(array &$feed): void
    {
        $entries = [];
        $db      = \XoopsDatabaseFactory::getDatabaseConnection();
        if (!empty($feed['plugin'])) {
Severity: Minor
Found in class/FeedHandler.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

File FeedHandler.php has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace XoopsModules\Rssfit;
Severity: Minor
Found in class/FeedHandler.php - About 4 hrs to fix

    Function getChannel has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getChannel(array &$feed): void
        {
            $channel  = [];
            $elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel'));
            if (\is_array($elements) && !empty($elements)) {
    Severity: Minor
    Found in class/FeedHandler.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 grabEntries has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array
        {
            $ret  = null;
    
            $i        = -1;
    Severity: Minor
    Found in class/Plugins/Surnames.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 checkPlugin has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkPlugin(\XoopsObject $object)
        {
            $ret = null;
            $file = \RSSFIT_ROOT_PATH . 'class/Plugins/' . $object->getVar('rssf_filename');
            if (\is_file($file)) {
    Severity: Minor
    Found in class/PluginHandler.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 getRssFeedAsHtml has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getRssFeedAsHtml(string $feed_url, int $maxItemCount = 10, bool $show_date = true, bool $show_description = true, int $max_words = 0, int $cache_timeout = 7200, string $cache_prefix = XOOPS_VAR_PATH . '/caches/xoops_cache/rss2html-'): string
        {
            $result = '';
            // get feeds and parse items
            $rss       = new \DOMDocument();
    Severity: Major
    Found in class/Utility.php - About 2 hrs to fix

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

          public static function checkVerModule(Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array
          {
              $moduleDirName      = \basename(\dirname(__DIR__, 2));
              $moduleDirNameUpper = mb_strtoupper($moduleDirName);
              $update             = '';
      Severity: Minor
      Found in class/Common/VersionChecks.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 truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function truncateHtml(
              string $text,
              ?int $length = 100,
              string $ending = '...',
              bool $exact = false,
      Severity: Major
      Found in class/Common/SysUtility.php - About 2 hrs to fix

        Function deleteDirectory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function deleteDirectory(string $src): bool
            {
                // 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 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 insert has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public function insert(\XoopsObject $object, $force = true)
            {
                if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) {
                    return false;
                }
        Severity: Minor
        Found in class/PluginHandler.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 insert has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public function insert(\XoopsObject $object, $force = false)
            {
                //        $force = false;
                if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) {
                    return false;
        Severity: Minor
        Found in class/MiscHandler.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 xoops_module_update_rssfit has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xoops_module_update_rssfit(\XoopsModule $module, int $previousVersion): bool
        {
            $moduleDirName      = \basename(\dirname(__DIR__));
        
            /** @var Rssfit\Helper $helper */
        Severity: Major
        Found in include/onupdate.php - About 2 hrs to fix

          Function doSubstr has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function doSubstr(string $text): string
              {
                  $ret      = $text;
                  $len      = \function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : mb_strlen($ret);
                  $maxChars = $this->helper->getConfig('max_char');
          Severity: Minor
          Found in class/FeedHandler.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 PluginHandler.php has 253 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            Method getChannel has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getChannel(array &$feed): void
                {
                    $channel  = [];
                    $elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel'));
                    if (\is_array($elements) && !empty($elements)) {
            Severity: Minor
            Found in class/FeedHandler.php - About 1 hr to fix

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

                  public function getObjects2($criteria = null, string $fields = '*', string $key = ''): ?array
                  {
                      $ret   = null;
                      $limit = $start = 0;
                      switch ($fields) {
              Severity: Minor
              Found in class/PluginHandler.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 getItems has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getItems(array &$feed): void
                  {
                      $entries = [];
                      $db      = \XoopsDatabaseFactory::getDatabaseConnection();
                      if (!empty($feed['plugin'])) {
              Severity: Minor
              Found in class/FeedHandler.php - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language