XoopsModules25x/news

View on GitHub

Showing 310 of 310 total issues

Function makeMySelBox has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function makeMySelBox(
        $title,
        $order,
        $preset_id,
        $none,
Severity: Minor
Found in class/NewsTopic.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 rrmdir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function rrmdir($src)
    {
        // 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 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 news_tag_iteminfo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function news_tag_iteminfo(&$items)
{
    if (empty($items) || !\is_array($items)) {
        return false;
    }
Severity: Minor
Found in class/plugins/plugin.tag.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 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStats($limit)
    {
        $ret = [];
        /** @var \XoopsMySQLDatabase $db */
        $db   = \XoopsDatabaseFactory::getDatabaseConnection();
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

Function getStoriesByIds has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStoriesByIds(
        $ids,
        $checkRight = true,
        $asobject = true,
        $order = 'published',
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 delTopic has 31 lines of code (exceeds 25 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

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

        public function getAllChildTopics()
        {
            $ret       = [];
            $xt        = new \XoopsTree($this->table, 'topic_id', 'topic_pid');
            $topic_arr = $xt->getAllChild($this->topic_id, 'topic_title');
    Severity: Major
    Found in class/XoopsTopic.php and 2 other locations - About 1 hr to fix
    class/XoopsTopic.php on lines 295..307
    class/XoopsTopic.php on lines 329..341

    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 105.

    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 3 locations. Consider refactoring.
    Open

        public function getFirstChildTopics()
        {
            $ret       = [];
            $xt        = new \XoopsTree($this->table, 'topic_id', 'topic_pid');
            $topic_arr = $xt->getFirstChild($this->topic_id, 'topic_title');
    Severity: Major
    Found in class/XoopsTopic.php and 2 other locations - About 1 hr to fix
    class/XoopsTopic.php on lines 312..324
    class/XoopsTopic.php on lines 329..341

    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 105.

    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 3 locations. Consider refactoring.
    Open

        public function getChildTopicsTreeArray()
        {
            $ret       = [];
            $xt        = new \XoopsTree($this->table, 'topic_id', 'topic_pid');
            $topic_arr = $xt->getChildTreeArray($this->topic_id, 'topic_title');
    Severity: Major
    Found in class/XoopsTopic.php and 2 other locations - About 1 hr to fix
    class/XoopsTopic.php on lines 295..307
    class/XoopsTopic.php on lines 312..324

    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 105.

    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 loadTableFromArrayWithReplace has 30 lines of code (exceeds 25 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

      Method xoops_module_install_news has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xoops_module_install_news(\XoopsModule $module)
      {
          require_once \dirname(__DIR__, 3) . '/mainfile.php';
      
          $moduleDirName = \basename(\dirname(__DIR__));
      Severity: Minor
      Found in include/oninstall.php - About 1 hr to fix

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

        $months_arr = [
            1  => _CAL_JANUARY,
            2  => _CAL_FEBRUARY,
            3  => _CAL_MARCH,
            4  => _CAL_APRIL,
        Severity: Major
        Found in archive.php and 1 other location - About 1 hr to fix
        blocks/news_archives.php on lines 52..65

        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 104.

        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

            public function topic_title($format = 'S')
            {
                $myts = MyTextSanitizer::getInstance();
                switch ($format) {
                    case 'S':
        Severity: Major
        Found in class/XoopsTopic.php and 1 other location - About 1 hr to fix
        class/XoopsTopic.php on lines 267..282

        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 104.

        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

            public function topic_imgurl($format = 'S')
            {
                $myts = MyTextSanitizer::getInstance();
                switch ($format) {
                    case 'S':
        Severity: Major
        Found in class/XoopsTopic.php and 1 other location - About 1 hr to fix
        class/XoopsTopic.php on lines 245..260

        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 104.

        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

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

            $months_arr    = [
                1  => _CAL_JANUARY,
                2  => _CAL_FEBRUARY,
                3  => _CAL_MARCH,
                4  => _CAL_APRIL,
        Severity: Major
        Found in blocks/news_archives.php and 1 other location - About 1 hr to fix
        archive.php on lines 82..95

        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 104.

        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 setPruneManager has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function setPruneManager(): void
        {
            require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
            xoops_cp_header();
            $adminObject = Admin::getInstance();
        Severity: Minor
        Found in admin/index.php - About 1 hr to fix

          Method getServerStats has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getServerStats()
              {
                  //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
                  $moduleDirName      = \basename(\dirname(__DIR__, 2));
                  $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
          Severity: Minor
          Found in class/Common/ServerStats.php - About 1 hr to fix

            Method news_notify_iteminfo has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function news_notify_iteminfo($category, $item_id)
            {
                if ('global' === $category) {
                    $item['name'] = '';
                    $item['url']  = '';
            Severity: Minor
            Found in include/notification.inc.php - About 1 hr to fix

              Method deleteBeforeDate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function deleteBeforeDate($timestamp, $expired, $topicslist = '')
                  {
                      global $xoopsModule;
                      /** @var \XoopsMySQLDatabase $db */
                      $db           = \XoopsDatabaseFactory::getDatabaseConnection();
              Severity: Minor
              Found in class/NewsStory.php - About 1 hr to fix

                Method updateBlock has 9 arguments (exceeds 4 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
                Severity: Major
                Found in class/Common/Blocksadmin.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language